[lld] r334851 - [ELF][MIPS] Fix stable_sort predicate to satisfy strict-ordering requirement. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 15 11:15:27 PDT 2018
Author: atanasyan
Date: Fri Jun 15 11:15:26 2018
New Revision: 334851
URL: http://llvm.org/viewvc/llvm-project?rev=334851&view=rev
Log:
[ELF][MIPS] Fix stable_sort predicate to satisfy strict-ordering requirement. NFC
Fix for PR37785.
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/test/ELF/mips-dynamic.s
lld/trunk/test/ELF/mips-mgot.s
lld/trunk/test/ELF/mips-sto-plt.s
lld/trunk/test/ELF/mips-tls-64.s
lld/trunk/test/ELF/mips-tls.s
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Jun 15 11:15:26 2018
@@ -1703,10 +1703,12 @@ SymbolTableBaseSection::SymbolTableBaseS
static bool sortMipsSymbols(const SymbolTableEntry &L,
const SymbolTableEntry &R) {
// Sort entries related to non-local preemptible symbols by GOT indexes.
- // All other entries go to the first part of GOT in arbitrary order.
- if (!L.Sym->isInGot() || !R.Sym->isInGot())
- return !L.Sym->isInGot();
- return L.Sym->GotIndex < R.Sym->GotIndex;
+ // All other entries go to the beginning of a dynsym in arbitrary order.
+ if (L.Sym->isInGot() && R.Sym->isInGot())
+ return L.Sym->GotIndex < R.Sym->GotIndex;
+ if (!L.Sym->isInGot() && !R.Sym->isInGot())
+ return false;
+ return !L.Sym->isInGot();
}
void SymbolTableBaseSection::finalizeContents() {
Modified: lld/trunk/test/ELF/mips-dynamic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-dynamic.s?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-dynamic.s (original)
+++ lld/trunk/test/ELF/mips-dynamic.s Fri Jun 15 11:15:26 2018
@@ -99,8 +99,8 @@
# DSO: ]
# DSO: DynamicSymbols [
# DSO: Name: @
-# DSO: Name: _foo@
# DSO: Name: __start@
+# DSO: Name: _foo@
# DSO: ]
# DSO: DynamicSection [
# DSO-NEXT: Tag Type Name/Value
Modified: lld/trunk/test/ELF/mips-mgot.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-mgot.s?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-mgot.s (original)
+++ lld/trunk/test/ELF/mips-mgot.s Fri Jun 15 11:15:26 2018
@@ -47,13 +47,13 @@
# GOT-NEXT: 0x6005C R_MIPS_REL32 foo0 0x0
# GOT-NEXT: 0x60060 R_MIPS_REL32 foo2 0x0
# GOT-NEXT: 0x6003C R_MIPS_TLS_DTPMOD32 - 0x0
-# GOT-NEXT: 0x60030 R_MIPS_TLS_TPREL32 tls1 0x0
# GOT-NEXT: 0x6002C R_MIPS_TLS_TPREL32 tls0 0x0
# GOT-NEXT: 0x60034 R_MIPS_TLS_DTPMOD32 tls0 0x0
# GOT-NEXT: 0x60038 R_MIPS_TLS_DTPREL32 tls0 0x0
# GOT-NEXT: 0x60064 R_MIPS_TLS_TPREL32 tls0 0x0
# GOT-NEXT: 0x60068 R_MIPS_TLS_DTPMOD32 tls0 0x0
# GOT-NEXT: 0x6006C R_MIPS_TLS_DTPREL32 tls0 0x0
+# GOT-NEXT: 0x60030 R_MIPS_TLS_TPREL32 tls1 0x0
# GOT-NEXT: }
# GOT-NEXT: ]
Modified: lld/trunk/test/ELF/mips-sto-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-sto-plt.s?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-sto-plt.s (original)
+++ lld/trunk/test/ELF/mips-sto-plt.s Fri Jun 15 11:15:26 2018
@@ -10,23 +10,23 @@
# REQUIRES: mips
# CHECK: Symbol {
-# CHECK: Name: foo1@
-# CHECK-NEXT: Value: 0x[[FOO1:[0-9A-F]+]]
+# CHECK: Name: foo0@
+# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Function
-# CHECK-NEXT: Other [ (0x8)
-# CHECK-NEXT: STO_MIPS_PLT
-# CHECK-NEXT: ]
+# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
-# CHECK: Symbol {
-# CHECK: Name: foo0@
-# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: foo1@
+# CHECK-NEXT: Value: 0x[[FOO1:[0-9A-F]+]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Function
-# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Other [ (0x8)
+# CHECK-NEXT: STO_MIPS_PLT
+# CHECK-NEXT: ]
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
Modified: lld/trunk/test/ELF/mips-tls-64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-tls-64.s?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-tls-64.s (original)
+++ lld/trunk/test/ELF/mips-tls-64.s Fri Jun 15 11:15:26 2018
@@ -68,12 +68,12 @@
# SO: Relocations [
# SO-NEXT: Section (7) .rel.dyn {
# SO-NEXT: 0x20030 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE - 0x0
-# SO-NEXT: 0x20010 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
-# SO-NEXT: 0x20020 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
-# SO-NEXT: 0x20028 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20018 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20040 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20048 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
+# SO-NEXT: 0x20010 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
+# SO-NEXT: 0x20020 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
+# SO-NEXT: 0x20028 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: }
# SO-NEXT: ]
# SO-NEXT: Primary GOT {
Modified: lld/trunk/test/ELF/mips-tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-tls.s?rev=334851&r1=334850&r2=334851&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-tls.s (original)
+++ lld/trunk/test/ELF/mips-tls.s Fri Jun 15 11:15:26 2018
@@ -64,12 +64,12 @@
# SO: Relocations [
# SO-NEXT: Section (7) .rel.dyn {
# SO-NEXT: 0x20018 R_MIPS_TLS_DTPMOD32 - 0x0
-# SO-NEXT: 0x20008 R_MIPS_TLS_TPREL32 foo 0x0
-# SO-NEXT: 0x20010 R_MIPS_TLS_DTPMOD32 foo 0x0
-# SO-NEXT: 0x20014 R_MIPS_TLS_DTPREL32 foo 0x0
# SO-NEXT: 0x2000C R_MIPS_TLS_TPREL32 bar 0x0
# SO-NEXT: 0x20020 R_MIPS_TLS_DTPMOD32 bar 0x0
# SO-NEXT: 0x20024 R_MIPS_TLS_DTPREL32 bar 0x0
+# SO-NEXT: 0x20008 R_MIPS_TLS_TPREL32 foo 0x0
+# SO-NEXT: 0x20010 R_MIPS_TLS_DTPMOD32 foo 0x0
+# SO-NEXT: 0x20014 R_MIPS_TLS_DTPREL32 foo 0x0
# SO-NEXT: }
# SO-NEXT: ]
# SO-NEXT: Primary GOT {
More information about the llvm-commits
mailing list