From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id B31F5393BA54; Fri, 25 Nov 2022 05:13:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B31F5393BA54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669353226; bh=1qVG2UBTCJGEJZQx2PohPOeJ7iajsdWi30JhvZ9mVM0=; h=From:To:Subject:Date:From; b=RG4kKCvVfU9PSix85KHlYPm4ZtS0Eh6oQWC/kZJzkT1TIAavgrEWTmM60/o6SPeHl z49ysoqqzQfRpZ8f1tg5osiJd+LI4jjO6D3xekoYJOIrcmAVXLrg9uDmyF7CNbPWVU woxfE8vB2PYKOqtJQH9EfjExG4Ym7gC7Iyfxh+xw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] enable __GXX_WEAK__ when using weak for one-only X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 10e8743d60035323e4124afdf9e4fb64c46e86bf X-Git-Newrev: 79ccdb557f8207dfebc9a9fb541193deeec559f0 Message-Id: <20221125051346.B31F5393BA54@sourceware.org> Date: Fri, 25 Nov 2022 05:13:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:79ccdb557f8207dfebc9a9fb541193deeec559f0 commit 79ccdb557f8207dfebc9a9fb541193deeec559f0 Author: Alexandre Oliva Date: Fri Nov 25 02:06:46 2022 -0300 enable __GXX_WEAK__ when using weak for one-only Diff: --- gcc/c-family/c-cppbuiltin.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc index 333f3e138d6..15ef47c0c04 100644 --- a/gcc/c-family/c-cppbuiltin.cc +++ b/gcc/c-family/c-cppbuiltin.cc @@ -939,7 +939,15 @@ c_cpp_builtins (cpp_reader *pfile) if (c_dialect_cxx ()) { - if (flag_weak && SUPPORTS_ONE_ONLY) + /* __GXX_WEAK__'s name is misleading, the documentation says it + tests for one-only spuport, but SUPPORTS_ONE_ONLY is also + slightly misleading, because weak symbols can be used for + one-only support even if !SUPPORtS_ONE_ONLY. Here we + approximate the supprots_one_only() test that may clear + flag_weak, but we use the flag_weak result instead of + TARGET_SUPPORTS_WEAK, because the user may have disabled weak + symbols with -fno-weak. */ + if (flag_weak || SUPPORTS_ONE_ONLY) cpp_define (pfile, "__GXX_WEAK__=1"); else cpp_define (pfile, "__GXX_WEAK__=0");