public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Navin P <navinp0304@gmail.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] define SHT_LLVM_ADDRSIG section rather than error out
Date: Wed, 18 Nov 2020 11:04:03 +0530	[thread overview]
Message-ID: <CALO2Tq+Jz5=oVjNpe+ur5W6vdLn1o8h96Dk+Cf5yO1shOgjALw@mail.gmail.com> (raw)
In-Reply-To: <c86ec075491019d7a505cdbc3a4fb578a6373836.camel@klomp.org>

On Tue, Nov 17, 2020 at 7:49 PM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi Navin,
>
> On Fri, 2020-11-13 at 20:45 +0530, Navin P via Elfutils-devel wrote:
> >  make elflint ignore it rather error as unsupported type. Other tools
> > like
> >  readelf , objdump understand this section.
>
> Is there a specification of this section type?
>
> diff --git a/libelf/elf.h b/libelf/elf.h
> > index 6439c1a4..26420b45 100644
> > --- a/libelf/elf.h
> > +++ b/libelf/elf.h
> > @@ -444,6 +444,7 @@ typedef struct
> >  #define SHT_SYMTAB_SHNDX  18 /* Extended section indeces */
> >  #define SHT_NUM   19 /* Number of defined types.  */
> >  #define SHT_LOOS   0x60000000 /* Start OS-specific.  */
> > +#define SHT_LLVM_ADDRSIG  0x6FFF4C03    /* llvm address sig */
> >  #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes.  */
> >  #define SHT_GNU_HASH   0x6ffffff6 /* GNU-style hash table.  */
> >  #define SHT_GNU_LIBLIST   0x6ffffff7 /* Prelink library list */
>
> elf.h comes from the glibc project.
> We should first try to upstream new constants there
> (glibc-alpha@sourceware.org)
>
> > diff --git a/src/elflint.c b/src/elflint.c
> > index ef3e3732..62663800 100644
> > --- a/src/elflint.c
> > +++ b/src/elflint.c
> > @@ -3905,6 +3905,7 @@ section [%2zu] '%s': size not multiple of entry
> > size\n"),
> >     && shdr->sh_type != SHT_GNU_ATTRIBUTES
> >     && shdr->sh_type != SHT_GNU_LIBLIST
> >     && shdr->sh_type != SHT_CHECKSUM
> > +   && shdr->sh_type != SHT_LLVM_ADDRSIG
> >     && shdr->sh_type != SHT_GNU_verdef
> >     && shdr->sh_type != SHT_GNU_verneed
> >     && shdr->sh_type != SHT_GNU_versym
>
> Note that for various of these SHT_GNU extensions we actually do have
> some extra checks. Do we need to check anything for a section marked
> SHT_LLVM_ADDRSIG?
>
We can do two things here
a) Recognize the section exists but ignore its contents which is what i
do. This needn't be the correct approach.
You may need to check the contents to sht_llvm_addrsig but that is
lot of work after the format has been frozen.
https://www.mail-archive.com/netdev@vger.kernel.org/msg348254.html
readelf output
[22] .llvm_addrsig     LOOS+0xfff4c03  0000000000000000 ...

b) If we don't want to recognize SHT_LLVM_ADDRSIG
you can strip section from object file by objcopy -R .llvm_addrsig size.o
conditionally  based on clang compiler.

  reply	other threads:[~2020-11-18  5:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 15:15 Navin P
2020-11-17 14:19 ` Mark Wielaard
2020-11-18  5:34   ` Navin P [this message]
2021-03-04 13:44     ` Timm Bäder
2021-03-04 13:59       ` Mark Wielaard
2021-03-09  7:40         ` Timm Bäder
2021-03-04 14:00       ` Navin P

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='CALO2Tq+Jz5=oVjNpe+ur5W6vdLn1o8h96Dk+Cf5yO1shOgjALw@mail.gmail.com' \
    --to=navinp0304@gmail.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.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).