Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -1079,6 +1079,14 @@ return L.Symbol->symbol()->computeBinding() == STB_LOCAL && R.Symbol->symbol()->computeBinding() != STB_LOCAL; }); + // Last local symbol should account for Symbols with a computed Binding + // of STB_LOCAL as these will not be represented by NumLocals. + for(const SymbolTableEntry &S : Symbols) { + if (S.Symbol->symbol()->computeBinding() != STB_LOCAL) + return; + this->Info++; + this->OutSec->Info++; + } return; } if (In::GnuHashTab) 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 (