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 ...
Differential D45325
[ELF] - Reorder local symbols. grimar on Apr 5 2018, 8:10 AM. Authored by
Details 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 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. Comment Actions We could just stop passing the file when we create them in addSectionSymbols probably. |
How does this guarantee that a local symbol group for some file always starts with a STT_FILE symbol?