Re: luarexlib patch

2015-05-22 Thread Antoine Jacoutot
On Sun, May 10, 2015 at 10:20:10PM +0200, Mark Kettenis wrote:
 [ Sending this to tech@ since I don't just want the ports people to
   know about this ]
 
 Invoking the linker directly to build executables or shared libraries
 is strongly discouraged.  It really doesn't work properly unless you
 also link in the appropriate /usr/lib/crt*.o files.  We rely on code
 in these files for:
 
  * The private stack protector cookie.
 
  * For atexit(3) to work in shared libraries that can be dlclose()ed.
 
  * For pthread_atfork(3) to work in shared libraries that can be dlclose()ed.
 
 With binutils 2.15 linking will succeed, but you might see random
 crashes if executable and shared libraries happen to be loaded more
 than 2G apart from eachother.  With binutils 2.17 you'll see the
 R_X86_64_PC32 relocation failure, and linking will fail.
 
 In general, you should just invoke cc(1) instead of ld(1), since it
 will take care of all the magic.
 
 Diff below fixes things for devel/luarexlib.
 
 ok?

OK aja (with a rev bump)


 
 
 Index: patches/patch-src_common_mak
 ===
 RCS file: /cvs/ports/devel/luarexlib/patches/patch-src_common_mak,v
 retrieving revision 1.1
 diff -u -p -r1.1 patch-src_common_mak
 --- patches/patch-src_common_mak  9 Sep 2009 18:02:01 -   1.1
 +++ patches/patch-src_common_mak  10 May 2015 20:05:23 -
 @@ -1,6 +1,6 @@
  $OpenBSD: patch-src_common_mak,v 1.1 2009/09/09 18:02:01 jolan Exp $
  --- src/common.mak.orig  Sat Jun 14 20:11:08 2008
 -+++ src/common.mak   Wed Sep  9 12:13:00 2009
  src/common.mak   Sun May 10 22:02:08 2015
  @@ -3,11 +3,11 @@
   V = 2.4
   
 @@ -9,8 +9,9 @@ $OpenBSD: patch-src_common_mak,v 1.1 200
  +CFLAGS+= $(MYCFLAGS) $(DEFS) $(INC)
   TRG_AR = lib$(TRG).a
   TRG_SO = $(TRG).so
 - LD = ld
 +-LD = ld
  -LDFLAGS= -shared
 ++LD = cc
  +LDFLAGS= -fPIC -shared
   
   all: $(TRG_AR) $(TRG_SO)
 

-- 
Antoine



luarexlib patch

2015-05-10 Thread Mark Kettenis
[ Sending this to tech@ since I don't just want the ports people to
  know about this ]

Invoking the linker directly to build executables or shared libraries
is strongly discouraged.  It really doesn't work properly unless you
also link in the appropriate /usr/lib/crt*.o files.  We rely on code
in these files for:

 * The private stack protector cookie.

 * For atexit(3) to work in shared libraries that can be dlclose()ed.

 * For pthread_atfork(3) to work in shared libraries that can be dlclose()ed.

With binutils 2.15 linking will succeed, but you might see random
crashes if executable and shared libraries happen to be loaded more
than 2G apart from eachother.  With binutils 2.17 you'll see the
R_X86_64_PC32 relocation failure, and linking will fail.

In general, you should just invoke cc(1) instead of ld(1), since it
will take care of all the magic.

Diff below fixes things for devel/luarexlib.

ok?


Index: patches/patch-src_common_mak
===
RCS file: /cvs/ports/devel/luarexlib/patches/patch-src_common_mak,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_common_mak
--- patches/patch-src_common_mak9 Sep 2009 18:02:01 -   1.1
+++ patches/patch-src_common_mak10 May 2015 20:05:23 -
@@ -1,6 +1,6 @@
 $OpenBSD: patch-src_common_mak,v 1.1 2009/09/09 18:02:01 jolan Exp $
 --- src/common.mak.origSat Jun 14 20:11:08 2008
-+++ src/common.mak Wed Sep  9 12:13:00 2009
 src/common.mak Sun May 10 22:02:08 2015
 @@ -3,11 +3,11 @@
  V = 2.4
  
@@ -9,8 +9,9 @@ $OpenBSD: patch-src_common_mak,v 1.1 200
 +CFLAGS+= $(MYCFLAGS) $(DEFS) $(INC)
  TRG_AR = lib$(TRG).a
  TRG_SO = $(TRG).so
- LD = ld
+-LD = ld
 -LDFLAGS= -shared
++LD = cc
 +LDFLAGS= -fPIC -shared
  
  all: $(TRG_AR) $(TRG_SO)