Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -1070,11 +1070,13 @@ 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; } Index: test/ELF/basic-mips.s =================================================================== --- test/ELF/basic-mips.s +++ test/ELF/basic-mips.s @@ -176,7 +176,7 @@ # 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: } Index: test/ELF/basic-ppc.s =================================================================== --- test/ELF/basic-ppc.s +++ 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 (