public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Change fno-unit-at-a-time to fno-toplevel-reorder
Date: Wed, 11 May 2022 11:57:49 -0700	[thread overview]
Message-ID: <20220511185749.72rb7zgrn4p2mnrg@google.com> (raw)
In-Reply-To: <4f7a5107-837b-7518-f8d3-15a6c7777322@linaro.org>

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

      reply	other threads:[~2022-05-11 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 18:36 Fangrui Song
2022-05-01  7:10 ` Fāng-ruì Sòng
2022-05-04 18:34 ` Adhemerval Zanella
2022-05-11 18:57   ` Fangrui Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511185749.72rb7zgrn4p2mnrg@google.com \
    --to=maskray@google.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).