From patchwork Thu Sep 29 14:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp19788wrs; Thu, 29 Sep 2022 07:58:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7i0yaY19N+LS3LdvfrTyDZI5AVYoljOQoJXVVyZYyuRifw8sPNK0b4UR+ID4opL/OdnZ46 X-Received: by 2002:a05:6402:510c:b0:451:f363:24ee with SMTP id m12-20020a056402510c00b00451f36324eemr3784626edd.156.1664463520423; Thu, 29 Sep 2022 07:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664463520; cv=none; d=google.com; s=arc-20160816; b=0IsRcXB5S/gwcWoqCEXy9/4sk9bgAQbCIDJwAWnWALomydKOxLpcYJpO2h1LN8Aj/5 +oWHQGszOCBtt0Qoe+fGUnWODRFjJn8cDe1BWVE4P7DqOcKeVmxq0ZtXq5cgj1h8EaxS svkHMZjNfqFDkuW6LIW0AkCDrpgH+ZVwZA3QM5UPSP87erYAHrwoZjx23Z2mQxFKllGa lKbvYdcw7r+Jlm1UJQc+WaptnTa6wVj1PHMfT/AQAAomO+cuo/KxencLmBNydoStGgPF vvIK+ruojIjtQTdKHghsGLTANPB6EcCEyyq1oRTt4cK8qkicDXjhSmZLmaELwwLFWHKk 0OPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=CxwRaQHOB8ZooIZRNzRIOeM6ParMlsGJlleuDAO0MnM=; b=oYy87IF+e6ycVOivrUT35AaJbVNhxwiQCkh/hqCCQr0NDY1mSfqTHvqsWUqNYhnEjO G3RgBxCVlUEOW/kWD7wPhsNmW0lcidMtn9Hj5dS5kQcqjPu/6xUFRUjKkXAQCxI4JQSQ dD0yPbxYva0l//y7B1J/cHEwXgUoXkcw4i5Lv2Y09xaNFoILPGV/myulEupDAFuvwYkq ES5uWW3aionkXcWtxpG8ns2kz7axCe5sykaFHhgMbiy4AK6Dk5GJ5chp9ghqbgT48EHO ny7dNQURNFP2s5hB28bAsAyKBYNMyinazoODHRuVlxON1pFDUOuQ40I80/tmGrYj2yB7 W7Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PeEKSd78; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qp3-20020a170907206300b00781363ae09esi7425804ejb.950.2022.09.29.07.58.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 07:58:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PeEKSd78; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6E77B3857419 for ; Thu, 29 Sep 2022 14:58:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E77B3857419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664463516; bh=CxwRaQHOB8ZooIZRNzRIOeM6ParMlsGJlleuDAO0MnM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=PeEKSd78b7unYjf88bPsE6VvHdwplzEK5PjFbr1DyPMVITTjvgVoXELdTyBHaeqqR c3j4JWQg56t5xEj9P2hhZVNyWpiezJhUwxsn6DMKNoKU9tiPqyjcHuoILEchQvjBTT r36QWuLz4UoPaFmE5pzmiV4wk2PSHtcCfmweHxzQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id CBCD23858D39 for ; Thu, 29 Sep 2022 14:57:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CBCD23858D39 Received: by mail-wm1-x335.google.com with SMTP id i203-20020a1c3bd4000000b003b3df9a5ecbso3402423wma.1 for ; Thu, 29 Sep 2022 07:57:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=CxwRaQHOB8ZooIZRNzRIOeM6ParMlsGJlleuDAO0MnM=; b=vknfxCtKwuWKdpOuLnMCprX3+GUZgCPg8DWtwyc4cpLEBxeIRfjpBsoky2ZU6WNAwZ AtQnEoBw/kua6JM4i7zappI7YU82VLviCIvYXhA1u6D1Fq1usvRxaeBb/T2Sv9Ii9z0c RHS31fShCh5Ilpu38exRSbqubTbB2e10SatFAwpYz8sSrxSBGzcN8JlBlh4bo2KjDyYa UOkejKm9kfe29+tTgIx13pu8Nl6wjqQLSR3Ldl1kLQie4vJKlHHedtu1k4CXcrog+Sq+ Lpzu/txvMq0KkSFih1AyK1R4XXjl7wfT1y5sBO3RNEvJYLS6g6PkB19a7cA8ZFz81XRc pz/g== X-Gm-Message-State: ACrzQf2f0vgQ5Qg0XNfoMUKxaqK3kxPVnRtAZjYoRhQfIS6QE17Syrpa RmuT5RIcXbIIACPMbZOuYo4pga33JHg= X-Received: by 2002:a7b:cb91:0:b0:3b4:75b9:5a4b with SMTP id m17-20020a7bcb91000000b003b475b95a4bmr2640642wmi.33.1664463470043; Thu, 29 Sep 2022 07:57:50 -0700 (PDT) Received: from localhost ([88.83.123.243]) by smtp.gmail.com with ESMTPSA id l2-20020a1c7902000000b003b33943ce5esm5151496wme.32.2022.09.29.07.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 07:57:48 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS Date: Thu, 29 Sep 2022 15:57:40 +0100 Message-Id: <20220929145740.4846-1-shorne@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: openrisc@lists.librecores.org, Yann Morin Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745316500318569593?= X-GMAIL-MSGID: =?utf-8?q?1745316500318569593?= 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. Tested-by: Yann E. MORIN gcc/ChangeLog: * config/or1k/or1k.cc (TARGET_HAVE_TLS): Only define if HAVE_AS_TLS is defined. --- 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