From 138ab553e6e7e928ff163bdae0ddd0d403c62d56 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org" Date: Thu, 20 Jul 2006 16:59:04 +0000 Subject: [PATCH] Use gcc to build shared objects (Phil Oester ) 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 | 2 +- Rules.make | 2 +- include/iptables_common.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 12cc34b..2673fd5 100644 --- 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 diff --git a/Rules.make b/Rules.make index ffc8996..17ea017 100644 --- a/Rules.make +++ b/Rules.make @@ -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) $< | \ diff --git a/include/iptables_common.h b/include/iptables_common.h index 64723c3..e214d1f 100644 --- a/include/iptables_common.h +++ b/include/iptables_common.h @@ -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); -- cgit v1.2.3