[PATCH] D28950: [LLD][ELF] Correct sh_info for static symbol table
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 08:28:04 PST 2017
peter.smith updated this revision to Diff 85402.
peter.smith added a comment.
Thank you for the comments. Updated to use std::stable_partition and rebased on top of https://reviews.llvm.org/D29021.
https://reviews.llvm.org/D28950
Files:
ELF/SyntheticSections.cpp
test/ELF/basic-mips.s
test/ELF/basic-ppc.s
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 (
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: 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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28950.85402.patch
Type: text/x-patch
Size: 1772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170123/0c6a8966/attachment.bin>
More information about the llvm-commits
mailing list