From: Bart Van Assche Date: Wed, 16 Apr 2008 18:19:45 +0000 (+0000) Subject: Replaced -nostdlib by -nodefaultlibs such that constructors are executed at shared... X-Git-Tag: svn/VALGRIND_3_4_0~729 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76f817a0c5e312b38693ca07eeb78f337bff01b5;p=thirdparty%2Fvalgrind.git Replaced -nostdlib by -nodefaultlibs such that constructors are executed at shared library load time. Replaced _init() function in drd_pthread_intercepts.c by a function with a constructor attribute in order to increase portability. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7883 --- diff --git a/Makefile.flags.am b/Makefile.flags.am index 1dad49add5..14ad4bea59 100644 --- a/Makefile.flags.am +++ b/Makefile.flags.am @@ -64,8 +64,8 @@ endif # Baseline link flags for making dynamic shared objects. # -PRELOAD_LDFLAGS_COMMON_LINUX = -nostdlib -shared -Wl,-z,interpose,-z,initfirst -PRELOAD_LDFLAGS_COMMON_AIX5 = -nostdlib -shared -Wl,-G -Wl,-bnogc +PRELOAD_LDFLAGS_COMMON_LINUX = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst +PRELOAD_LDFLAGS_COMMON_AIX5 = -nodefaultlibs -shared -Wl,-G -Wl,-bnogc PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ diff --git a/exp-drd/drd_pthread_intercepts.c b/exp-drd/drd_pthread_intercepts.c index 6e1e6d8dfa..94e9dd3b0d 100644 --- a/exp-drd/drd_pthread_intercepts.c +++ b/exp-drd/drd_pthread_intercepts.c @@ -83,7 +83,7 @@ typedef struct /* Function declarations. */ -void _init(void); +static void init(void) __attribute__((constructor)); static void check_threading_library(void); static void vg_set_main_thread_state(void); @@ -94,7 +94,7 @@ static void vg_set_main_thread_state(void); * after dlopen() has loaded the shared library. This function must not * be declared static. */ -void _init(void) +static void init(void) { check_threading_library(); vg_set_main_thread_state();