Accidentally found while debugging an unrelated lto issue.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
To be more precise, before this code was crashing because getFile() returned a nullptr on which lld was trying to call getName().
C->getFile() == nullptr true F->getName() "LLD-INTERNAL-combined-lto-object" [Raw View]: {Data=0x0000000144483f18 "LLD-INTERNAL-combined-lto-object" Length=32 }
It comes from the combined LTO object.
The input section name is empty anyway so I'm not entirely sure what buys us in this particular circumstance.
In general, anyway, yes, I think <internal> is a better diagnostic if we don't have the filename available. Do you agree?
How can a section from combined LTO object have no backing file? I guessed its getFile() should return a combined LTO object file.
I analyzed this a little bit further.
I think this happen only when we try to print the "special" section &InputSection<ELFT>::Discarded (the debugger confirms).
This has no name associated, and I don't think it's backed by a file. I think it's not entirely unreasonable to skip it while reporting sections which have been gc'ed. What do you think?