diff options
| -rw-r--r-- | lld/ELF/SyntheticSections.cpp | 12 | ||||
| -rw-r--r-- | lld/test/ELF/basic-mips.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/basic-ppc.s | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index c048886c98f..9021f8001af 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1073,11 +1073,13 @@ template <class ELFT> void SymbolTableSection<ELFT>::finalize() { if (!StrTabSec.isDynamic()) { auto GlobBegin = Symbols.begin() + NumLocals; - std::stable_sort(GlobBegin, Symbols.end(), [](const SymbolTableEntry &L, - const SymbolTableEntry &R) { - return L.Symbol->symbol()->computeBinding() == STB_LOCAL && - R.Symbol->symbol()->computeBinding() != STB_LOCAL; - }); + auto It = std::stable_partition( + GlobBegin, Symbols.end(), [](const SymbolTableEntry &S) { + return S.Symbol->symbol()->computeBinding() == STB_LOCAL; + }); + // update sh_info with number of Global symbols output with computed + // binding of STB_LOCAL + this->OutSec->Info = this->Info = 1 + It - Symbols.begin(); return; } diff --git a/lld/test/ELF/basic-mips.s b/lld/test/ELF/basic-mips.s index d6073722944..b143697ce0f 100644 --- a/lld/test/ELF/basic-mips.s +++ b/lld/test/ELF/basic-mips.s @@ -176,7 +176,7 @@ __start: # CHECK-NEXT: Offset: 0x20010 # CHECK-NEXT: Size: 48 # CHECK-NEXT: Link: 10 -# CHECK-NEXT: Info: 1 +# CHECK-NEXT: Info: 2 # CHECK-NEXT: AddressAlignment: 4 # CHECK-NEXT: EntrySize: 16 # CHECK-NEXT: } diff --git a/lld/test/ELF/basic-ppc.s b/lld/test/ELF/basic-ppc.s index e08c7a32eb7..aae81fe2ac0 100644 --- a/lld/test/ELF/basic-ppc.s +++ b/lld/test/ELF/basic-ppc.s @@ -178,7 +178,7 @@ // CHECK-NEXT: Offset: 0x2038 // CHECK-NEXT: Size: 32 // CHECK-NEXT: Link: 9 -// CHECK-NEXT: Info: 1 +// CHECK-NEXT: Info: 2 // CHECK-NEXT: AddressAlignment: 4 // CHECK-NEXT: EntrySize: 16 // CHECK-NEXT: SectionData ( |

