[PATCH] D39047: [ELF] - Hide LinkerScript::removeEmptyCommands().

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 05:05:17 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D39047#907279, @ruiu wrote:

> Basically this seems like a good change, but why did you move the existing code?


It's for case from orphan-phdrs.s test:

  PHDRS {
    exec PT_LOAD FLAGS(0x4 | 0x1);
    rw   PT_LOAD FLAGS(0x4 | 0x2);
  }
  SECTIONS {
   .text : { *(.text) } :exec
   .empty : { *(.empty) } :rw
   .rw : { *(.rw) }
  }

if we have no `.empty` input sections, this command will be removed from output,
though we still want to assign output section `.rw` to `rw` PT_LOAD.
So we want to remove empty commands after sections are assigned to headers and not before.


https://reviews.llvm.org/D39047





More information about the llvm-commits mailing list