This fixes PR36716 (https://bugs.llvm.org/show_bug.cgi?id=36716),
Patch sorts local symbols to match the
following order: file1, local1, hidden1, file2, local2, hidden2 ...
Paths
| Differential D45325
[ELF] - Reorder local symbols. ClosedPublic Authored by grimar on Apr 5 2018, 8:10 AM.
Details Summary This fixes PR36716 (https://bugs.llvm.org/show_bug.cgi?id=36716), Patch sorts local symbols to match the
Diff Detail Event Timeline
Comment Actions
I thought the same thing, but I guess separating partition and sort is faster than merging them into one sort function call. Partition is O(n) and sort is O(n log n). So, IIUC, partitioning into local and global symbols first and then sorting only the local part should be faster than sorting the entire vector. Comment Actions
Sounds good. Lets keep both for now. Comment Actions
And it also makes final code simpler IMO. We need to set Info to the number of locals and it is simple to do with partitioning. Comment Actions
Comment Actions LGTM I think this is fine. It is a bit funny that we count the section symbols as being part of the first file that had that section, but that is unlikely to be a problem. This revision is now accepted and ready to land.Apr 10 2018, 2:29 PM Comment Actions
We could just stop passing the file when we create them in addSectionSymbols probably. Closed by commit rL329787: [ELF] - Reorder local symbols. (authored by grimar). · Explain WhyApr 11 2018, 2:27 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 141160 ELF/SyntheticSections.cpp
ELF/Writer.cpp
test/ELF/file-sym.s
test/ELF/local-symbol-order.s
test/ELF/lto/data-ordering-lto.s
test/ELF/lto/parallel-internalize.ll
test/ELF/lto/relocatable.ll
test/ELF/lto/symbol-ordering-lto.s
test/ELF/relocatable-comdat-multiple.s
|
How does this guarantee that a local symbol group for some file always starts with a STT_FILE symbol?