This is an archive of the discontinued LLVM Phabricator instance.

Remove DefinedSynthetic
ClosedPublic

Authored by rafael on Mar 1 2017, 11:40 AM.

Details

Reviewers
ruiu
Summary

With this we have a single section hierarchy. It is a bit less code, but the main advantage will be being able to handle

foo = symbol_in_obj;

in a linker script. Currently that fails since we try to find the output section of symbol_in_obj. With this we should be able to just return an InputSection from the expression.

Diff Detail

Event Timeline

rafael created this revision.Mar 1 2017, 11:40 AM
ruiu edited edge metadata.Mar 1 2017, 12:35 PM

This is interesting. It seems almost neutral to me as it removes one class and instead introduces one class hierarchy. I wonder if this opens up other opportunities to simplify things. E.g. we have a bunch of lambdas in LinkerScript.cpp to compute addresses lazily. If you land this patch, can you simplify that, for example?

ELF/InputSection.h
38

It actually uses 64 bits, no? I don't think we need to use a bit field.

ELF/Symbols.cpp
48

Ah, okay, this.

262–267

Is this what clang-format formatted?

ELF/Symbols.h
178

->Repl is for ICF. Does ICF still work without that?

grimar added a subscriber: grimar.Mar 2 2017, 1:38 AM
grimar added inline comments.
ELF/InputSection.cpp
226

Seems we going to have only one output section type.
May be then

bool InputSectionBase::classof(const SectionBase *S) {
 return S->kind() != Output;
}
rafael updated this revision to Diff 91024.Mar 8 2017, 8:41 AM
ruiu accepted this revision.Mar 8 2017, 10:05 AM

Let's try this one. LGTM. Please submit after addressing these minor comments.

ELF/InputSection.cpp
107

Nice to add a comment saying that -1 indicates the end of the section.

135–136

I would add this at the beginning of this function because this is the most common case.

ELF/InputSection.h
37

Please add a comment -- this class represents an ELF section, either it is an input section or an output section.

39

I think Output has a risk of name conflict. Maybe it should be OutputKind, though adding "Kind" to all five enums should be done in another patch.

79

Maybe we should initialize Live and Assigned bits too so that even if there's a bug we get a consistent behavior.

This revision is now accepted and ready to land.Mar 8 2017, 10:05 AM
espindola closed this revision.Mar 14 2018, 4:16 PM
espindola added a subscriber: espindola.

297313