The new mechanism is less code, and fixes the case where all inputs
are archives.
Details
Diff Detail
Event Timeline
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. |
COFF/SymbolTable.cpp | ||
---|---|---|
174–184 | Config->MachineType overrides the detected value, doesn't it? That's what the existing logic seems to implement. |
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.