tcpdump mailing list archives

[PATCH] libpcap: patch to correct linker flag sequence


From: Nimesh Prajapati <nimesh.prajapati () rockwellcollins com>
Date: Tue, 28 Nov 2017 01:40:36 -0600

From: Yogesh Prasad <yogesh.prasad () rockwellcollins com>

Description
 This patch will correct the sequence of -pie and -shared options.
 When used together, -pie should be provided to the linker before
 -shared. If -pie is provided after -shared, the linker throws
 below error.
-------------------------------------------------------------------------
/host/powerpc-buildroot-linux-gnu/sysroot/usr/lib/Scrt1.o:(.data+0x4):
 undefined reference to `main'
/host/lib/gcc/powerpc-buildroot-linux-gnu/6.4.0/../../../../
powerpc-buildroot-linux-gnu/bin/ld: BFD (GNU Binutils) 2.28.1 assertion
fail elf32-ppc.c:8923
collect2: error: ld returned 1 exit status
make[2]: *** [libpcap.so] Error 1
make[1]: *** [/build/libpcap-1.8.1/.stamp_built] Error 2
make: *** [_all] Error 2
-------------------------------------------------------------------------

Signed-off-by: Yogesh Prasad <yogesh.prasad () rockwellcollins com>
Signed-off-by: Matt Weber <matthew.weber () rockwellcollins com>
---
 Makefile.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e71d973..34b1097 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -371,7 +371,7 @@ libpcap.so: $(OBJ)
        @rm -f $@
        VER=`cat $(srcdir)/VERSION`; \
        MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
-       @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
+       @V_SHLIB_CMD@ $(LDFLAGS) @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER \
            -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
 
 #
@@ -434,7 +434,7 @@ libpcap.sl: $(OBJ)
 #
 libpcap.shareda: $(OBJ)
        @rm -f $@ shr.o
-       $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS)
+       $(CC) $(LDFLAGS) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LIBS)
        $(AR) rc $@ shr.o
 
 #
-- 
1.9.1

_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: