This is an archive of the discontinued LLVM Phabricator instance.

Move machine type auto-detection to SymbolTable.
ClosedPublic

Authored by pcc on May 29 2015, 11:34 AM.

Diff Detail

Event Timeline

pcc updated this revision to Diff 26805.May 29 2015, 11:34 AM
pcc retitled this revision from to Move machine type auto-detection to SymbolTable..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: ruiu.
pcc added a subscriber: Unknown Object (MLST).
ruiu accepted this revision.May 29 2015, 12:17 PM
ruiu edited edge metadata.

LGTM with following change.

I first thought that it's invalid if all files are archive, but then realized that that's valid.
An object file defining an entry point function can be in an archive.

COFF/SymbolTable.cpp
174–184

I'd make this a non-member function in Writer.cpp which takes vector<unique_ptr<ObjectFile>>& as a parameter, as this function is not that related to symbol resolution. It feels that it belongs Writer. Maybe you need to expose ObjectFiles, but that's fine.

And in the Writer, you can return Config->MachineType as a default value instead of UNKNOWN.

This revision is now accepted and ready to land.May 29 2015, 12:17 PM
pcc added inline comments.May 29 2015, 1:49 PM
COFF/SymbolTable.cpp
174–184

Config->MachineType overrides the detected value, doesn't it? That's what the existing logic seems to implement.

This revision was automatically updated to reflect the committed changes.