From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28528 invoked from network); 8 Jan 2022 13:09:20 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 8 Jan 2022 13:09:20 -0000 Received: (qmail 11525 invoked by uid 550); 8 Jan 2022 13:09:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7241 invoked from network); 8 Jan 2022 07:46:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=4TLjPH+21/DmuZqGwsmTrYL94i24vyZ3/ApvRJaOY3U=; b=T7Bvb9Am3nLDxRiSmJTqQLqhwEHjhNZPptmH+9bKjTzuixUlLTTyovbwa8AhjLmMP2 vBZIPTV4ASCSSRoGVEs3U1canlKtouiY2/9F2AayNJ29hhhcjuDsMKkb4QnZq1m+f5I5 Ej4tzcY9xMG9hOrX/25CBmPt/Vc7vTgWCmcXw5+7o1Ua6U+v72BBpHYNkvYbKFfI85Vc OwzEtadW2CcCpCHZ6kE53U1WxRW8X83gLtEdEvmyLVWy2Cn8PRIPe2TWMqpTenLbSzRC g/AxdUqoVNhko8FYaDW2NQJFBGQSRvGO74HGInjdTQuJboXAZISjAkf9z6Mcgdj146Bm wzLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4TLjPH+21/DmuZqGwsmTrYL94i24vyZ3/ApvRJaOY3U=; b=f+bUEYUOzjmHU3QnYvKhmJ9W/ndgy4YUBFTDGfVT3o5m0lIk2WPXMz+vV+1t+d9Lkk lr2EieNxjN8D8Kc2a7aVvRZVL0SYQuAwJTtUMOLkxG2f6an60+ichbfwtudfU7BpZt8N 9vMcFyixYL+xvm+w2xr8Mb5K1wimb0AizjHd2OynUL0e7S9qnUiH71wuhHAuGIsiPQn+ AL+bxbikH4oaCguWBHRT+vdIGkfitpGuAwFOHLt+rRtw76PW8up3/2Fu4I8Ylxf0b+GG xClo7hK9UHBVt4x12VogA8v2mHyNcxmDPvMS949IXJvlmFmxKz4S9A4mtnDCgfpl3j3B EJ1Q== X-Gm-Message-State: AOAM533GYE852xBGzC50+cezg+QJR97gTTY2++GlDU8fcn5A5cChJUSQ fIcHpzUI4VWYqoM0WUzNdY/nChNtB58CvREUIZlzy7E1KP8= X-Google-Smtp-Source: ABdhPJxlQmCaWJ7lo/FfuZJ/iRzGYle4dbat/DKte8qiO4kR3JxITQ6Sc5fafJNz5K/l7XrLEV36eXPjsHDgvefRXUo= X-Received: by 2002:a2e:8887:: with SMTP id k7mr25264302lji.407.1641627962431; Fri, 07 Jan 2022 23:46:02 -0800 (PST) MIME-Version: 1.0 From: Rui Ueyama Date: Sat, 8 Jan 2022 16:45:51 +0900 Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Subject: [musl] [PATCH] Explicitly pass the -fno-common flag Common symbol is a special type of symbol that allows a linker to merge multiple common symbols into one and turn it into a defined symbol. This feature was used in C to allow tentative definitions. That is, you can write `int foo;` instead of `extern int foo;` in a header file. Common symbols are discouraged these days because they can easily hide unintentional duplicate symbol errors. For that reason, GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678) and Clang (https://github.com/llvm/llvm-project/commit/0a9fc9233e172601e26381810d093e02ef410f65) now default to `-fno-common`. That means, musl libc's global variables are compiled to common symbols or regular defined symbols depending on the compiler. That's not an issue per se, but it's unnecessary churn. This patch always passes the `-fno-common` flag to the compiler. --- configure | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure b/configure index e1aefed7..73ec966d 100755 --- a/configure +++ b/configure @@ -492,6 +492,14 @@ tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables tryflag CFLAGS_AUTO -ffunction-sections tryflag CFLAGS_AUTO -fdata-sections +# +# The use of common symbol is discouraged recently because it can +# easily hide unintentional duplicate symbol errors. Recent versions +# of GCC and Clang default to -fno-common. To get a consistent output +# with older versions of compilers, explicitly pass that flag. +# +tryflag CFLAGS_AUTO -fno-common + # # On x86, make sure we don't have incompatible instruction set # extensions enabled by default. This is bad for making static binaries. -- 2.33.0.610.gcefe983a32