673 | @@ -674,6 +674,11 @@ if test x$use_glibc_compat != xno; then
674 | AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
675 | AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"])
676 | AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"])
677 | + case $host in
678 | + powerpc64* | ppc64*)
679 | + AX_CHECK_LINK_FLAG([[-Wl,--no-tls-get-addr-optimize]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--no-tls-get-addr-optimize"])
If this were a gcc switch, we would test against --tls-get-addr-optimize, then add --no-tls-get-addr-optimize to COMPAT_LDFLAGS if it succeeded. That is because gcc issues warnings for --no-foo if unsupported, but errors for --foo.
I'm thinking we should do the same here. I don't know how most linkers handle this, but I can't imagine that causing any problems. That would also mean that we could safely run this check for all platforms without constraining it to specific ppc's.
It should work without the no- prefix, but upon further research, I'm not sure if this is the correct solution at all.
According to the documentation, systems without the glibc-side part can still explicitly enable the option and produce binaries that work (with a performance hit) on older systems. I'm not sure how this is technically implemented.
Managed to get an old glibc running and confirmed --no-tls-get-addr-optimize is in fact needed. No clue why the docs imply otherwise. :/
As for the original comment:
- At least GNU ld errors if --no-foo is provided.
- Other platforms might not have compatibility issues using this flag.