From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 6D74A3853809 for ; Wed, 11 May 2022 18:57:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D74A3853809 Received: by mail-pj1-x102d.google.com with SMTP id fv2so3055962pjb.4 for ; Wed, 11 May 2022 11:57:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wI2xv6Xpa37lkhJsD6ZHiHr0Le82suacxKlmZCSqU4Y=; b=3b72fkSIrG3KdNCrcmpOUP6CTYvfwoExJvlSeO4NC42kdUtffU9qw33dBSgrQE4iSI wmCMrcHdGKUptuaO0tbSsyhteegl/xP7dSgeYPAzsWiNyQFKdwrv0FFoVIg47g8pDJmV ivSNvnwBWBhWKYI9iLc1smL9AUIFHEFVz5MJ7oVmJPwvvFGrHPwPV0HTFkuglMVBOwuP 4IePkcoZXHyxhSFGOSaC2Tq+FvSJBr0MZp+y+dIdZL7ao3pGf+dT014lTlAuSsPhwRiQ LB1bxpLGO4ZnQl/BZo/4juaIMEUCHm32YkM8CwYF371StX8GaHiJ998HIFG05MJtMUd/ wFpQ== X-Gm-Message-State: AOAM5316sbl+HmvDElODc/Rs0sLLmGCpKbyXnwrj2XMsYvplvkP23NGN jAC0hGO80zHnwkOIn7OeQb7gdp9C7e/y2Q== X-Google-Smtp-Source: ABdhPJzaegitkMn5CuVowv+sjRhe0L2uCNIP6usC5ey//tIAMObA9vIMiXP7tehdc6DWxVPa1ZQ79A== X-Received: by 2002:a17:902:eccd:b0:15e:a0a6:79cd with SMTP id a13-20020a170902eccd00b0015ea0a679cdmr26816749plh.19.1652295473255; Wed, 11 May 2022 11:57:53 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:3228:6d2d:ebc8:7bc1]) by smtp.gmail.com with ESMTPSA id c6-20020a170902c2c600b0015e8d4eb267sm2220321pla.177.2022.05.11.11.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 11:57:52 -0700 (PDT) Date: Wed, 11 May 2022 11:57:49 -0700 From: Fangrui Song To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Change fno-unit-at-a-time to fno-toplevel-reorder Message-ID: <20220511185749.72rb7zgrn4p2mnrg@google.com> References: <20220416183628.3522663-1-maskray@google.com> <4f7a5107-837b-7518-f8d3-15a6c7777322@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <4f7a5107-837b-7518-f8d3-15a6c7777322@linaro.org> X-Spam-Status: No, score=-26.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 18:58:00 -0000 On 2022-05-04, Adhemerval Zanella wrote: > > >On 16/04/2022 15:36, Fangrui Song wrote: >> -fno-toplevel-reorder is a rough replacement for the legacy option >> -fno-unit-at-a-time >> (https://sourceware.org/pipermail/gcc-patches/2006-January/186801.html). >> glibc currently requires GCC>=6.2 which assuredly has >> -fno-toplevel-reorder -fno-section-anchors. Clang will use the else >> branch as it does not implement -fno-toplevel-reorder. > >I don't see much improvement here, it just trades one option by another. >Maybe a better approach would to reorganize the code to avoid requiring >special compiler options. The patch ensures the legacy -fno-unit-at-a-time option is no longer used. With the GNU as patch https://sourceware.org/pipermail/binutils/2022-April/120311.html (gas: copy st_size only if unset) and the LLVM integrated assembler patch https://reviews.llvm.org/D123283 ([MC][ELF] Improve st_size propagation rule), the glibc code as is is robust enough. Removing -fno-toplevel-reorder needs the unreleased binutils 2.39, so fno-toplevel-reorder can be kept for now. >I did it for the gcc clang work [1], so check-abi is clean. > >[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/fno-unit-at-fime-removal This will be fine, too. >> --- >> config.make.in | 2 +- >> configure | 6 +++--- >> configure.ac | 6 +++--- >> stdio-common/Makefile | 4 ++-- >> 4 files changed, 9 insertions(+), 9 deletions(-) >> >> diff --git a/config.make.in b/config.make.in >> index bf728c71c0..65e1f46da4 100644 >> --- a/config.make.in >> +++ b/config.make.in >> @@ -68,7 +68,7 @@ have-selinux = @have_selinux@ >> have-libaudit = @have_libaudit@ >> have-libcap = @have_libcap@ >> have-cc-with-libunwind = @libc_cv_cc_with_libunwind@ >> -fno-unit-at-a-time = @fno_unit_at_a_time@ >> +fno-toplevel-reorder = @fno_toplevel_reorder@ >> bind-now = @bindnow@ >> have-hash-style = @libc_cv_hashstyle@ >> use-default-link = @use_default_link@ >> diff --git a/configure b/configure >> index d2f413d05d..4c7b159b13 100755 >> --- a/configure >> +++ b/configure >> @@ -620,7 +620,7 @@ libc_cv_cc_loop_to_function >> libc_cv_cc_submachine >> libc_cv_cc_nofma >> libc_cv_mtls_dialect_gnu2 >> -fno_unit_at_a_time >> +fno_toplevel_reorder >> libc_cv_has_glob_dat >> libc_cv_hashstyle >> libc_cv_fpie >> @@ -6305,9 +6305,9 @@ fi >> { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_fno_toplevel_reorder" >&5 >> $as_echo "$libc_cv_fno_toplevel_reorder" >&6; } >> if test $libc_cv_fno_toplevel_reorder = yes; then >> - fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors" >> + fno_toplevel_reorder="-fno-toplevel-reorder -fno-section-anchors" >> else >> - fno_unit_at_a_time=-fno-unit-at-a-time >> + fno_toplevel_reorder= >> fi >> >> >> diff --git a/configure.ac b/configure.ac >> index b6a747dece..bdff5981c1 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -1460,11 +1460,11 @@ else >> fi >> rm -f conftest*]) >> if test $libc_cv_fno_toplevel_reorder = yes; then >> - fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors" >> + fno_toplevel_reorder="-fno-toplevel-reorder -fno-section-anchors" >> else >> - fno_unit_at_a_time=-fno-unit-at-a-time >> + fno_toplevel_reorder= >> fi >> -AC_SUBST(fno_unit_at_a_time) >> +AC_SUBST(fno_toplevel_reorder) >> >> AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2, >> [dnl >> diff --git a/stdio-common/Makefile b/stdio-common/Makefile >> index 435cd8904f..6de2dd84ce 100644 >> --- a/stdio-common/Makefile >> +++ b/stdio-common/Makefile >> @@ -333,8 +333,8 @@ CFLAGS-isoc99_vfscanf.c += -fexceptions >> CFLAGS-isoc99_vscanf.c += -fexceptions >> CFLAGS-isoc99_fscanf.c += -fexceptions >> CFLAGS-isoc99_scanf.c += -fexceptions >> -CFLAGS-errlist.c += $(fno-unit-at-a-time) >> -CFLAGS-siglist.c += $(fno-unit-at-a-time) >> +CFLAGS-errlist.c += $(fno-toplevel-reorder) >> +CFLAGS-siglist.c += $(fno-toplevel-reorder) >> >> # scanf14a.c and scanf16a.c test a deprecated extension which is no >> # longer visible under most conformance levels; see the source files