[PATCH] D24692: Mark ELF sections whose name start with .note as note

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 17:20:47 PDT 2016


On Sun, Sep 18, 2016 at 9:23 PM, Davide Italiano <dccitaliano at gmail.com>
wrote:

> davide added a subscriber: davide.
> davide added a comment.
>
> Side note, I almost always dislike relying on section name specific logic
> (in the assembler and in the linker), but this is the way things are. LGTM,
> modulo one comment.


Yeah, in ELF, names are in spirit just hints for human and don't mean
anything semantically. It is unfortunate that we have a lot of exceptions
to that rule.


>
> ================
> Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:154
> @@ -153,1 +153,3 @@
>  static unsigned getELFSectionType(StringRef Name, SectionKind K) {
> +  if (Name.startswith(".note"))
> +    return ELF::SHT_NOTE;
> ----------------
> phosek wrote:
> > ruiu wrote:
> > > phosek wrote:
> > > > ruiu wrote:
> > > > > Shouldn't this be `Name == ".note" || Name.startswith(".note.")`?
> > > > That's definitely more strict so it's probably a better solution.
> The logic in `lib/MC/MCParser/ELFAsmParser.cpp` uses
> `Name.startswith(".note")`, shall I update that as well?
> > > I don't know the answer, but I *think* that's the right thing to do.
> > I checked the behavior of GNU assembler and it's equivalent to the
> current implementation, i.e. even `.notefoo` would end up with `SHT_NOTE`
> type.
> Please add a comment here to explain what's going on (maybe add the link
> to the gcc bug, if you feel it's OK).
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D24692
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160919/c9a4c815/attachment.html>


More information about the llvm-commits mailing list