This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Hide LinkerScript::removeEmptyCommands().
AbandonedPublic

Authored by grimar on Oct 18 2017, 5:02 AM.

Details

Reviewers
ruiu
rafael
Summary

With little code reordering it is possible to make
removeEmptyCommands to be private. Does not seem
it worth to allow it leak to public interface and also
simplifies code a bit.

Diff Detail

Event Timeline

grimar created this revision.Oct 18 2017, 5:02 AM
ruiu edited edge metadata.Oct 25 2017, 4:39 PM

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

In 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.

ruiu accepted this revision.Oct 26 2017, 2:02 PM

LGTM

This revision is now accepted and ready to land.Oct 26 2017, 2:02 PM
grimar planned changes to this revision.EditedOct 27 2017, 4:26 AM

Not sure what exactly changed, but this one breaks 276 tests now. Will revisit it later.

grimar abandoned this revision.Dec 1 2017, 4:19 AM