Message ID | Ye4lrkAX7ED7mq0V@squeak.grove.modra.org |
---|---|
State | New |
Headers | show |
Series | [PowerPC64] Use medium model toc accesses throughout | expand |
* Alan Modra via Libc-alpha: > diff --git a/sysdeps/powerpc/powerpc64/configure.ac b/sysdeps/powerpc/powerpc64/configure.ac > index 1f3d54414c..5eedd2f81c 100644 > --- a/sysdeps/powerpc/powerpc64/configure.ac > +++ b/sysdeps/powerpc/powerpc64/configure.ac > @@ -1,6 +1,13 @@ > GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. > # Local configure fragment for sysdeps/powerpc/powerpc64. > > +dnl It is always possible to access static and hidden symbols in an > +dnl position independent way. > +AC_DEFINE(PI_STATIC_AND_HIDDEN) I must say that this is the most surprising glibc patch I've seen in a while. But I think it's true—once you've set up the TOC pointer, the link editor can generate a fixed offset offset for local and hidden symbols. Has this always been the case for powerpc64le? Thanks, Florian
On Thu, Jan 27, 2022 at 07:39:44PM +0100, Florian Weimer wrote: > * Alan Modra via Libc-alpha: > > > diff --git a/sysdeps/powerpc/powerpc64/configure.ac b/sysdeps/powerpc/powerpc64/configure.ac > > index 1f3d54414c..5eedd2f81c 100644 > > --- a/sysdeps/powerpc/powerpc64/configure.ac > > +++ b/sysdeps/powerpc/powerpc64/configure.ac > > @@ -1,6 +1,13 @@ > > GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. > > # Local configure fragment for sysdeps/powerpc/powerpc64. > > > > +dnl It is always possible to access static and hidden symbols in an > > +dnl position independent way. > > +AC_DEFINE(PI_STATIC_AND_HIDDEN) > > I must say that this is the most surprising glibc patch I've seen in a > while. > > But I think it's true—once you've set up the TOC pointer, the link > editor can generate a fixed offset offset for local and hidden symbols. > Has this always been the case for powerpc64le? 2010-06-25 binutils git commit ba761f19f5. I'm not at all sure the optimisation was perfect in binutils-2.21, but yes, medium and large code model toc-indirect code has been converted to toc-relative for a long time.
diff --git a/sysdeps/powerpc/powerpc64/configure b/sysdeps/powerpc/powerpc64/configure index fddea0355a..4a219ab8ac 100644 --- a/sysdeps/powerpc/powerpc64/configure +++ b/sysdeps/powerpc/powerpc64/configure @@ -1,6 +1,13 @@ # This file is generated from configure.ac by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/powerpc/powerpc64. +$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + + +# Static PIE is supported. +$as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for support for overlapping .opd entries" >&5 $as_echo_n "checking for support for overlapping .opd entries... " >&6; } if ${libc_cv_overlapping_opd+:} false; then : diff --git a/sysdeps/powerpc/powerpc64/configure.ac b/sysdeps/powerpc/powerpc64/configure.ac index 1f3d54414c..5eedd2f81c 100644 --- a/sysdeps/powerpc/powerpc64/configure.ac +++ b/sysdeps/powerpc/powerpc64/configure.ac @@ -1,6 +1,13 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/powerpc/powerpc64. +dnl It is always possible to access static and hidden symbols in an +dnl position independent way. +AC_DEFINE(PI_STATIC_AND_HIDDEN) + +# Static PIE is supported. +AC_DEFINE(SUPPORT_STATIC_PIE) + AC_CACHE_CHECK(for support for overlapping .opd entries, libc_cv_overlapping_opd, [dnl libc_cv_overlapping_opd=no diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure index a4c809fd98..7183573bc0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/configure +++ b/sysdeps/unix/sysv/linux/powerpc/configure @@ -93,7 +93,13 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_linker_feature=yes + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-tls-get-addr-optimize -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: --no-tls-get-addr-optimize ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi fi rm -f conftest* fi