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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 19:40:25 PDT 2019


MaskRay added a comment.

> This changes seems pretty reasonable to me, but this gets into the ugly area of how close to GNU compatibility do we need to get.

That was exactly why I asked in a previous comment about your preference :)

Current patch:

  if (Sec.Type == SHT_NOBITS &&
      (!(Sec.Flags & ELF::SHF_ALLOC) ||
       Flags & (SectionFlag::SecContents | SectionFlag::SecLoad)))
    Sec.Type = SHT_PROGBITS;

Alternative:

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

I thought about the rationale of the GNU objcopy behavior and put that in https://reviews.llvm.org/D60189#1454342


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