Message ID | 20150602180401.GA28489@glebfm.cloud.tilaa.com |
---|---|
State | New |
Headers | show |
I think it's better just to give libpthread its own build of interp.c. The simplest thing is to add a pt-interp to libpthread-routines and have pt-interp.c be: #include <elf/interp.c>.
On Tue, Jun 02, 2015 at 01:09:48PM -0700, Roland McGrath wrote: > I think it's better just to give libpthread its own build of interp.c. > The simplest thing is to add a pt-interp to libpthread-routines and > have pt-interp.c be: #include <elf/interp.c>. In that case $(objpfx)pt-interp.os would have to depend on $(elf-objpfx)runtime-linker.h; this dependence doesn't work as is and looks as dirty as -DNO_SYMBOL_HACKS.
> On Tue, Jun 02, 2015 at 01:09:48PM -0700, Roland McGrath wrote: > > I think it's better just to give libpthread its own build of interp.c. > > The simplest thing is to add a pt-interp to libpthread-routines and > > have pt-interp.c be: #include <elf/interp.c>. > > In that case $(objpfx)pt-interp.os would have to depend on > $(elf-objpfx)runtime-linker.h; this dependence doesn't work as is > and looks as dirty as -DNO_SYMBOL_HACKS. We could move runtime-linker.h to $(common-objpfx) and the rules for it to Rules.
diff --git a/elf/Makefile b/elf/Makefile index e5b142c..0f646a7 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -354,6 +354,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map) mv -f $@.new $@ # interp.c exists just to get the runtime linker path into libc.so. +CPPFLAGS-interp.c = -DNO_SYMBOL_HACKS=1 $(objpfx)interp.os: $(elf-objpfx)runtime-linker.h $(elf-objpfx)runtime-linker.h: $(elf-objpfx)runtime-linker.st; @: diff --git a/nptl/Makefile b/nptl/Makefile index 7c39d6d..0e546bb 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -542,6 +542,7 @@ extra-B-pthread.so = -B$(common-objpfx)nptl/ $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs)) $(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs)) $(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs)) +$(objpfx)libpthread.so: $(+interp) # Make sure we link with the thread library. ifeq ($(build-shared),yes) diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index ce576c9..e2da923 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -1,6 +1,7 @@ /* Some compiler optimizations may transform loops into memset/memmove calls and without proper declaration it may generate PLT calls. */ -#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED +#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED \ + && !defined NO_SYMBOL_HACKS asm ("memmove = __GI_memmove"); asm ("memset = __GI_memset"); asm ("memcpy = __GI_memcpy"); diff --git a/sysdeps/wordsize-32/symbol-hacks.h b/sysdeps/wordsize-32/symbol-hacks.h index ceabb76..0bdf785 100644 --- a/sysdeps/wordsize-32/symbol-hacks.h +++ b/sysdeps/wordsize-32/symbol-hacks.h @@ -23,7 +23,8 @@ therefore we get PLTs. Unnecessarily so. Changing gcc is a big task which might not be worth it so we play tricks with the assembler. */ -#if !defined __ASSEMBLER__ && !defined in_divdi3_c && IS_IN (libc) && defined SHARED +#if !defined __ASSEMBLER__ && !defined in_divdi3_c && IS_IN (libc) \ + && defined SHARED && !defined NO_SYMBOL_HACKS asm ("__divdi3 = __divdi3_internal"); asm ("__udivdi3 = __udivdi3_internal"); asm ("__moddi3 = __moddi3_internal");