[PATCH] D60189: [llvm-objcopy] Simplify SHT_NOBITS -> SHT_PROGBITS promotion

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 01:54:11 PDT 2019


MaskRay added a comment.

In D60189#1454587 <https://reviews.llvm.org/D60189#1454587>, @jhenderson wrote:

> In D60189#1454342 <https://reviews.llvm.org/D60189#1454342>, @MaskRay wrote:
>
> > Since llvm-objcopy contributors are adding more and more GNU objcopy options to llvm-objcopy, I feel people care about its compatibility with GNU objcopy. My preference is actually to keep just `SectionFlag::SecContents` and drop the other two, if I'm allowed to do so. This would certainly harm compatibility with GNU objcopy. What do people think?
>
>
> Do you mean removing for e.g. --set-section-flags=data or whatever? I'm against dropping support for any flags that were added to be compatible with GNU, as most of them have been added with good reason, or are being relied on by end users to do what is expected. Certainly, I've run into some users of these switches, though I don't remember exactly which values.


No. I mean

  if (Sec.Type == SHT_NOBITS && Flags & SectionFlag::SecContents)
    Sec.Type = SHT_PROGBITS;

The current patch uses

  (!(Sec.Flags & ELF::SHF_ALLOC) || Flags & (SectionFlag::SecContents | SectionFlag::SecLoad)))

which has better compatibility with GNU objcopy than the existing code.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60189/new/

https://reviews.llvm.org/D60189





More information about the llvm-commits mailing list