From patchwork Fri Nov 26 19:43:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 48200 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BA953858036 for ; Fri, 26 Nov 2021 19:44:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BA953858036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637955859; bh=tLB5FKO1cDkfUmS1BDJ4BRYHJ+i25ad2cw9rT4JerZU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eLDDA/vtmvGqqnzwKIkZgfPSG4aHcZhzhW7ZnsV7bhm0PRU6O9oZVMEdAQMeRKO+S kbGswrawL1XUBZGViiBCVBVhOUlTyYxMALhTUfIbiHBEC2aE/iifnXs9Di3dTmQuwn EZoAiBhNoWfaxeYD+tFQrgQX55snf4mfsWKdbQSU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 1C04E3858D39 for ; Fri, 26 Nov 2021 19:43:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1C04E3858D39 Received: by mail-wm1-x32c.google.com with SMTP id o29so8978093wms.2 for ; Fri, 26 Nov 2021 11:43:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:reply-to :mime-version:content-transfer-encoding; bh=tLB5FKO1cDkfUmS1BDJ4BRYHJ+i25ad2cw9rT4JerZU=; b=e8eecJHH8aOVKCiNPQB4BDHOQkBgRvk4WcSSsXCR+894wLi3ddySCd02HfltYYnVB3 C4CGDWFAJR78x7h7js36ONRKyDds+Zdj4rXu4pyNiF/EjkinfKWV3xEjD4YlXtVIzYmW SUUuHRX/QZGOv7wWciPDG5otb6E0Zzi5oyZs9vKrCudJ7roHSYJPM4P2wteHpxC2V8dh o3vzVeZahmCY7n0yl9CieFczDrlKVTcj16KIFdS3yQn7+T0qBe1Y/FLVydE3iQR9Z6lZ 5MdtDHAEyH2xxVypo05FQMXNSMh0DYW4IrZSo9ilgtWsFj/N6ZCuiT2KJhgJjt3H3ttM tK+Q== X-Gm-Message-State: AOAM532YIzdUtJT/UYOnJxmUzCywZUsDVSrZvilrNVaDlDea2m0KB01u QpwEPnt2QtlqRgx032+Luu8UtNQs/7M= X-Google-Smtp-Source: ABdhPJxlMr4qGAxGiEL3m6Gg0nKJnhlSW6TbUu5XnwJXZIso2LSS4ORu/QygxRNG+QC2WsFKRsni7g== X-Received: by 2002:a05:600c:1d97:: with SMTP id p23mr17811744wms.144.1637955828916; Fri, 26 Nov 2021 11:43:48 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id i15sm14218051wmq.18.2021.11.26.11.43.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Nov 2021 11:43:48 -0800 (PST) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] libitm: Fix bootstrap for targets without HAVE_ELF_STYLE_WEAKREF. Date: Fri, 26 Nov 2021 19:43:37 +0000 Message-Id: <20211126194337.37758-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-Spam-Status: No, score=-8.5 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Recent improvements to null address warnings notice that for targets that do not support HAVE_ELF_STYLE_WEAKREF the dummy stub implementation of __cxa_get_globals() means that the address can never be null. Fixed by removing the test for such targets. tested on i686, x86_64, powerpc-darwin and x86_64-linux. pushed to master as bootstrap/trivial fix, thanks Iain Signed-off-by: Iain Sandoe libitm/ChangeLog: * eh_cpp.cc (GTM::gtm_thread::init_cpp_exceptions): If the target does not support HAVE_ELF_STYLE_WEAKREF then do not try to test the __cxa_get_globals against NULL. --- libitm/eh_cpp.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libitm/eh_cpp.cc b/libitm/eh_cpp.cc index 4909427b405..57beb1a147f 100644 --- a/libitm/eh_cpp.cc +++ b/libitm/eh_cpp.cc @@ -178,7 +178,11 @@ GTM::gtm_thread::init_cpp_exceptions () { // Only save and restore the number of uncaught exceptions if this is // actually used in the program. - if (__cxa_get_globals != NULL && __cxa_get_globals () != 0) + if ( +#if HAVE_ELF_STYLE_WEAKREF + __cxa_get_globals != NULL && +#endif + __cxa_get_globals () != 0) cxa_uncaught_count_ptr = &__cxa_get_globals ()->uncaughtExceptions; else cxa_uncaught_count_ptr = 0;