]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
authorStafford Horne <shorne@gmail.com>
Thu, 29 Sep 2022 14:32:39 +0000 (15:32 +0100)
committerStafford Horne <shorne@gmail.com>
Sat, 1 Oct 2022 09:58:01 +0000 (10:58 +0100)
This was found when testing buildroot with linuxthreads enabled.  In
this case, the build passes --disable-tls to the toolchain during
configuration.  After building the OpenRISC toolchain it was still
generating TLS code sequences and causing linker failures such as:

 ..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl
 ..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr'

This patch fixes this by disabling tls for the OpenRISC target when requested
via --disable-tls.

gcc/ChangeLog:

* config/or1k/or1k.cc (TARGET_HAVE_TLS): Only define if
HAVE_AS_TLS is defined.

Tested-by: Yann E. MORIN <yann.morin@orange.com>
gcc/config/or1k/or1k.cc

index da2f59062ba47bce6d6305ba108f68cceec72f8f..0ce7b234417d7d17fae5339050690cde5e242ccd 100644 (file)
@@ -2206,8 +2206,10 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
 #undef  TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P or1k_legitimate_address_p
 
+#ifdef HAVE_AS_TLS
 #undef  TARGET_HAVE_TLS
 #define TARGET_HAVE_TLS true
+#endif
 
 #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed