This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PPC64 _dl_lookup_symbol_internal clobbers fpr2


On Tue, Aug 26, 2003 at 10:01:47AM -0500, Steven Munroe wrote:
> The resolve path of ld.so does not actually use fp operations but gcc has a
> nasty habit of using volitile fprs to move/copy structs inline. So a function
> that is dynamically linked and has float/double parms may find its parametes
> globbled by plt-fixup on the first call. This is the case with
> _dl_lookup_symbol_internal in the current current RHEL 3 beta. 
> 
> There are three possible solutions:
> 
> 1) change the dl-machine.h TRAMPOLINE to save/restore fprs 2-13. This would
> slow down all dynamic resolves.
> 2) change gcc to not use fprs for struct copies. This would have negative
> impact on SPEC benchmarks
> 3) apply -msoft-float to the compile of the appropriate loader modules so that
> the dynamic resolve path does not use fprs.
> 
> For now I would like to go with option 3:
> 
> 2003-08-26  Steven Munroe  <sjmunroe@us.ibm.com>
> 
> 	* sysdeps/powerpc/powerpc64/elf/Makefile: New file.

Why dl-reloc.c and rtld.c?
I don't see how code in them could be called from fixup() or
profile_fixup().
On the other side, profile_fixup() can call _dl_mcount from
dl-profile.c and both can call strlen, strcmp, stpcpy and mempcpy.
The former 3 seem to be either written in assembly or don't use fpr2-13,
mempcpy apparently uses fpr2-13, but it seems to be called only when
error will be signalled, so it will never return and thus doesn't matter.
Maybe CFLAGS-rtld-strlen.os := -msoft-float etc. would be useful too,
if that works.

Also, why don't you just add CFLAGS-dl-runtime.os etc instead of
CFLAGS-dl-runtime.c? Lazy binding matters in the dynamic linker only.

> diff -urN libc23-cvstip-20030825/sysdeps/powerpc/powerpc64/elf/Makefile libc23/sysdeps/powerpc/powerpc64/elf/Makefile
> --- libc23-cvstip-20030825/sysdeps/powerpc/powerpc64/elf/Makefile	Wed Dec 31 18:00:00 1969
> +++ libc23/sysdeps/powerpc/powerpc64/elf/Makefile	Mon Aug 25 14:57:54 2003
> @@ -0,0 +1,9 @@
> +# powerpc64/ELF specific definitions.
> +
> +# Need to prevent gcc from using fprs durring dynamic linking.
> +
> +CFLAGS-dl-runtime.c := -msoft-float
> +CFLAGS-dl-lookup.c := -msoft-float
> +CFLAGS-dl-reloc.c := -msoft-float
> +CFLAGS-dl-misc.c := -msoft-float
> +CFLAGS-rtld.c := -msoft-float


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]