public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH v2 3/6] objcopy: Remove SHT_LLVM_ADDRSIG sections by default.
Date: Fri, 24 Jun 2022 14:28:57 +0900	[thread overview]
Message-ID: <CANqewP2t1dKWVPhHRfBSPLSBCVRtKjpDAfjzffOzb8ifQWsB5A@mail.gmail.com> (raw)
In-Reply-To: <48fc0f61-7c17-cd94-be02-31b83dd386ff@suse.com>

Hi Jan, thanks again for your review.

> > --- a/binutils/objcopy.c
> > +++ b/binutils/objcopy.c
> > @@ -1316,10 +1316,20 @@ is_mergeable_note_section (bfd * abfd, asection * sec)
> >    return false;
> >  }
> >
> > +static bool
> > +is_addrsig_section (bfd *abfd, asection *sec)
> > +{
> > +  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
> > +      && elf_section_data (sec)->this_hdr.sh_type == SHT_LLVM_ADDRSIG)
> > +    return true;
> > +
> > +  return false;
> > +}
>
> Not sure if this would conflict with unwritten style expectations,
> but when I see such I always wonder: Why not a simple return
> statement, without explicit use of true/false (or 1/0)?

I just blindly copied the style of is_mergeable_note_section above,
but I think your suggestion also makes sense. If there's no objections
I will turn that into a direct return in the next revision.

> > @@ -1348,6 +1358,20 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
> >       return true;
> >      }
> >
> > +  /* addrsig needs to be updated if the symtab is altered, but we don't know
> > +     how to read nor write it, so just throw it away to not confuse
> > +     downstream tools.  */
> > +  if (is_addrsig_section (abfd, sec))
> > +    {
> > +      non_fatal (_ ("warning: removing section %s to prevent corrupt addrsig "
> > +                    "information"),
> > +                 bfd_section_name (sec));
> > +      non_fatal (_ ("pass --remove-section=%1$s to suppress warning, or "
> > +                    "--keep-section=%1$s to override"),
> > +                 bfd_section_name (sec));
> > +      return true;
> > +    }
>
> Isn't this too aggressive? The comment says "if the symtab is altered",
> but the code looks to request stripping unconditionally.

Sorry, the way the comment is written is indeed quite confusing, so I
can update that. But there's probably not too much value in checking
whether symtab is altered here, since it has been thrown away
(unconditionally) by LLD from the sh_link heuristic in prior versions
of binutils anyway.

Tatsuyuki

  reply	other threads:[~2022-06-24  5:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 15:13 [PATCH v2 0/6] gas: Add support for LLVM addrsig and addrsig_sym Tatsuyuki Ishi
2022-06-23 15:13 ` [PATCH v2 1/6] elf: Add definition for SHT_LLVM_ADDRSIG Tatsuyuki Ishi
2022-06-23 15:13 ` [PATCH v2 2/6] bfd: Output SH_LINK to .symtab " Tatsuyuki Ishi
2022-06-23 15:13 ` [PATCH v2 3/6] objcopy: Remove SHT_LLVM_ADDRSIG sections by default Tatsuyuki Ishi
2022-06-23 15:40   ` Jan Beulich
2022-06-24  5:28     ` Tatsuyuki Ishi [this message]
2022-06-23 15:13 ` [PATCH v2 4/6] ld: Discard LLVM_ADDRSIG sections Tatsuyuki Ishi
2022-06-23 15:13 ` [PATCH v2 5/6] gas: Add support for LLVM addrsig and addrsig_sym directives on ELF Tatsuyuki Ishi
2022-06-23 15:13 ` [PATCH v2 6/6] gas: Add basic test for addrsig Tatsuyuki Ishi
2022-06-28  9:20 ` [PATCH v2 0/6] gas: Add support for LLVM addrsig and addrsig_sym Alan Modra
2022-06-29  1:27   ` Tatsuyuki Ishi
2022-06-29  2:56     ` Alan Modra
2022-06-30 20:59       ` Fangrui Song

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=CANqewP2t1dKWVPhHRfBSPLSBCVRtKjpDAfjzffOzb8ifQWsB5A@mail.gmail.com \
    --to=ishitatsuyuki@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    /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).