public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Fangrui Song <i@maskray.me>
Cc: Binutils <binutils@sourceware.org>,
	GNU gABI gnu-gabi <gnu-gabi@sourceware.org>
Subject: Re: [PATCH v2] Support for SHF_GNU_RETAIN ELF Section Flag
Date: Tue, 29 Sep 2020 12:54:52 -0700	[thread overview]
Message-ID: <CAMe9rOrkFHHjX5mZ6Jn=h4Rd3_BpQxZBozi--S5NKd60ftp70w@mail.gmail.com> (raw)
In-Reply-To: <20200929193806.m6u6ra6oijqkstfo@gmail.com>

On Tue, Sep 29, 2020 at 12:38 PM Fangrui Song <i@maskray.me> wrote:
>

> >>
> >>   // a.h
> >>   __attribute__((section("sec")))
> >>   inline void bar() { ... }
> >>   // a.c
> >>   #include "a.h"
> >>   __attribute__((section("sec"), retain))
> >>   void foo() {
> >>   }
> >>
> >> compiles to
> >>
> >>   .section sec,"a",@progbits
> >>   ...
> >>   .section sec,"aR",@progbits
> >>   ...
> >>
> >> You will get a gas error for changing section flags
> >> (https://sourceware.org/pipermail/binutils/2020-February/109945.html)
> >>
> >
> >There is no error in this case.
> >The original patch handled it, and it has been further improved in v2.
> >There's even a testcase testing exactly the functionality you say is
> >broken.
> >
> >  gas/testsuite/gas/elf/section22.s:
> >      .section .bss,"aw"
> >    ...
> >      .section .bss,"awR",%nobits
> >
> >I already gave a detailed response to your reloc proposal:
> >https://sourceware.org/pipermail/binutils/2020-September/113450.html
>
> Letting the following assembly creates two .bss sections adds an exception to
> "gas: error for section type, attr, or entsize change"
> (https://sourceware.org/pipermail/binutils/2020-February/109945.html)
> for which I have achieved consensus with Alan Modra and some LLVM
> toolchain folks. That is why I hope we could re-consider this design
> choice.
>
> .section        .bss,"aw"
> .section        .bss,"awR",%nobits
>

FWIW, GNU assembler has been able to create multiple sections with
the same section name for a while.  For SHF_GNU_RETAIN, we added

+/* Create unique input sections for sections with the same name, but different
+   values for the flags in this mask.  */
+#define SEC_ASSEMBLER_SHF_MASK SHF_GNU_RETAIN

to control when to create a new section with the same section name.
For other cases, no new section is created.

-- 
H.J.

  reply	other threads:[~2020-09-29 19:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200928132613.btkqaoomv4fdnupn@jozef-acer-manjaro>
     [not found] ` <20200929044353.vx26ypc2oioqbmfb@gmail.com>
     [not found]   ` <20200929100442.o3e66jbmqpv5cajh@jozef-acer-manjaro>
2020-09-29 19:38     ` Fangrui Song
2020-09-29 19:54       ` H.J. Lu [this message]
2020-09-29 21:37       ` Jozef Lawrynowicz
2020-09-30  0:10         ` Roland McGrath
2020-09-30 10:18           ` Jozef Lawrynowicz
2020-09-30 14:01             ` H.J. Lu
2020-10-01 19:22             ` Fangrui Song
2020-10-01 19:53               ` H.J. Lu
2020-10-02 12:44               ` Jozef Lawrynowicz
2020-09-30 14:13           ` Michael Matz

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='CAMe9rOrkFHHjX5mZ6Jn=h4Rd3_BpQxZBozi--S5NKd60ftp70w@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gnu-gabi@sourceware.org \
    --cc=i@maskray.me \
    /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).