On Fri, May 22, 2015 at 10:20:38AM +0200, Antoine Jacoutot wrote: > > > > Seems luarexlib needs the same kind of love. > > > > > > Yeah. I sent out a diff for that a week ago or so, but nobody > > > bothered to ok it. > > > > Ah sorry I missed it. I'll look at it. > > Hmm, I just grep'd for 'luarexlib' in my ports@ archive and could not find > anything. > Where did you send it?
Mark sent it to tech@: ----- Forwarded message from Mark Kettenis <mark.kette...@xs4all.nl> ----- Date: Sun, 10 May 2015 22:20:10 +0200 From: Mark Kettenis <mark.kette...@xs4all.nl> To: t...@openbsd.org Subject: luarexlib patch [ 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_mak 9 Sep 2009 18:02:01 -0000 1.1 +++ patches/patch-src_common_mak 10 May 2015 20:05:23 -0000 @@ -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) ----- End forwarded message -----