This is an archive of the discontinued LLVM Phabricator instance.

Merge OutputSectionCommand and OutputSection
ClosedPublic

Authored by rafael on Jul 25 2017, 7:18 PM.

Details

Reviewers
ruiu
Summary

This is a bit of a hack, but it is *so* convenient.

The patch removes over 100 lines of code. It also balances the .cpp files a bit more. Now that we have synthetic linker scripts, LinkerScript.cpp had a bit too much in it IMHO.

This also removes the need to keep a map from OutputSection to OutputSectionCommand.

Diff Detail

Event Timeline

rafael created this revision.Jul 25 2017, 7:18 PM
grimar added a subscriber: grimar.Jul 26 2017, 1:39 AM
ruiu accepted this revision.Jul 26 2017, 5:43 PM

LGTM

It looks like this is the right thing to do. Please rename Cmd Sec if a variable is of OutputSection.

ELF/LinkerScript.cpp
609

Cmd -> Sec

631

Cmd -> Sec

651

Cmd -> Sec

ELF/MapFile.cpp
103

Rename Script.

ELF/MapFile.h
18

Remove Script.

ELF/OutputSections.h
42

I really don't want to use multiple inheritance, but BaseCommand is so small that it is probably okay.

93

Add a comment saying that the members below are for linker scripts.

ELF/Relocations.cpp
1009

Cmd -> Sec

ELF/Writer.cpp
486

Cmd -> Sec

1182

Sec

This revision is now accepted and ready to land.Jul 26 2017, 5:43 PM
espindola closed this revision.Mar 14 2018, 3:45 PM
espindola added a subscriber: espindola.

309311