From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2020) id EB76D385842E; Sat, 1 Oct 2022 10:15:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB76D385842E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664619341; bh=bSnRamvCSS9VOHcMxw4+GzguY0itFCGXgyPre7CPHqI=; h=From:To:Subject:Date:From; b=T70EXqNEVojzfg45jDAzTKqo3gVh4nfzvSZaXPxGiLRqahSkqYOij5z9Z7mQHm7SY HKUt1xZr4+oTp0+rX5tNrIQtwLXAoeD1XK4H0J0T4l5NnmtgmXIiC/qWiKDfEbiAR6 0tskcIl26mPaYNJe+ppRD1LA5hJCMC+o2e6KZ+nU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Stafford Horne To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3012] or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS X-Act-Checkin: gcc X-Git-Author: Stafford Horne X-Git-Refname: refs/heads/master X-Git-Oldrev: 153ca019b7794c97972dcd291021cf074514fb3b X-Git-Newrev: ca01d2526917ec6e54b30472d3aedfd46d4ca585 Message-Id: <20221001101541.EB76D385842E@sourceware.org> Date: Sat, 1 Oct 2022 10:15:41 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ca01d2526917ec6e54b30472d3aedfd46d4ca585 commit r13-3012-gca01d2526917ec6e54b30472d3aedfd46d4ca585 Author: Stafford Horne Date: Thu Sep 29 15:32:39 2022 +0100 or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS 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 Diff: --- gcc/config/or1k/or1k.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc index da2f59062ba..0ce7b234417 100644 --- a/gcc/config/or1k/or1k.cc +++ b/gcc/config/or1k/or1k.cc @@ -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