]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Use gcc to build shared objects (Phil Oester <kernel@linuxace.com>)
authorPhil Oester <kernel@linuxace.com>
Thu, 20 Jul 2006 16:59:04 +0000 (16:59 +0000)
committerPatrick McHardy <kaber@trash.net>
Thu, 20 Jul 2006 16:59:04 +0000 (16:59 +0000)
As suggested by Dmitry Levin and included in Fedora Core releases,
use gcc instead of ld to link shared objects.  Fedora rpm notes
refer to this fixing a plugin problem, but does not offer specifics.
But in any event, 'gcc -dumpspecs' does show gcc will pass a number
of parameters which in theory it thinks are better.

Compile tested both with and without NO_SHARED_LIBS.

Closes bug #454.

Makefile
Rules.make
include/iptables_common.h

index 12cc34b249b3c654baeeb09ef6228bc0f2b4d43e..2673fd58f7a23fcd5c6e05a3b4a2ac323e1e9496 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -67,7 +67,7 @@ ifeq ($(shell uname -m),sparc64)
                # The kernel is 64-bit, even though userspace is 32.
                CFLAGS+=-DIPT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
        else
-               EXT_LDFLAGS=-m elf64_sparc
+               EXT_LDFLAGS+=-Wl,-m,elf64_sparc
        endif
 endif
 
index ffc8996be4c5bdf20490ee76412f22943901da25..17ea017225df2c409256c36563c0278e0893fd0e 100644 (file)
@@ -31,7 +31,7 @@ $(SHARED_LIBS:%.so=%.d): %.d: %.c
            sed -e 's@^.*\.o:@$*.d $*_sh.o:@' > $@
 
 $(SHARED_LIBS): %.so : %_sh.o
-       $(LD) -shared $(EXT_LDFLAGS) -o $@ $<
+       $(CC) -shared $(EXT_LDFLAGS) -o $@ $<
 
 $(SHARED_SE_LIBS:%.so=%.d): %.d: %.c
        @-$(CC) -M -MG $(CFLAGS) $< | \
index 64723c3c5b233cd095f782617827cf0afdb1abb8..e214d1fd002a274e385513434c56b79ced81c741 100644 (file)
@@ -33,8 +33,10 @@ void exit_error(enum exittype, char *, ...)__attribute__((noreturn,
 extern const char *program_name, *program_version;
 extern char *lib_dir;
 
+#define _init __attribute__((constructor)) my_init
 #ifdef NO_SHARED_LIBS
 # ifdef _INIT
+#  undef _init
 #  define _init _INIT
 # endif
   extern void init_extensions(void);