[ELF][MIPS] Fix predicate used for sorting MIPS dynamic symbol tables

Now it conforms requirement for std::stable_sort predicates. That
resolves build-bot failures on Windows hosts.

llvm-svn: 273151
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 040657a6..4b71874 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -1277,8 +1277,10 @@
                             const std::pair<SymbolBody *, unsigned> &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.first->IsInGlobalMipsGot || !R.first->IsInGlobalMipsGot)
-    return !L.first->IsInGlobalMipsGot;
+  bool LIsInLocalGot = !L.first->IsInGlobalMipsGot;
+  bool RIsInLocalGot = !R.first->IsInGlobalMipsGot;
+  if (LIsInLocalGot || RIsInLocalGot)
+    return !RIsInLocalGot;
   return L.first->GotIndex < R.first->GotIndex;
 }
 
diff --git a/lld/test/ELF/mips-dynamic.s b/lld/test/ELF/mips-dynamic.s
index 797628b..cceaf6d 100644
--- a/lld/test/ELF/mips-dynamic.s
+++ b/lld/test/ELF/mips-dynamic.s
@@ -71,8 +71,8 @@
 # DSO:      ]
 # DSO:      DynamicSymbols [
 # DSO:          Name: @
-# DSO:          Name: _foo@
 # DSO:          Name: __start@
+# DSO:          Name: _foo@
 # DSO:      ]
 # DSO:      DynamicSection [
 # DSO-NEXT:   Tag        Type                 Name/Value
diff --git a/lld/test/ELF/mips-plt-copy.s b/lld/test/ELF/mips-plt-copy.s
index bdbb1d7..58883d8 100644
--- a/lld/test/ELF/mips-plt-copy.s
+++ b/lld/test/ELF/mips-plt-copy.s
@@ -12,8 +12,8 @@
 
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section ({{.*}}) .rel.dyn {
-# CHECK-NEXT:     0x{{[0-9A-F]+}} R_MIPS_COPY data1 0x0
 # CHECK-NEXT:     0x{{[0-9A-F]+}} R_MIPS_COPY data0 0x0
+# CHECK-NEXT:     0x{{[0-9A-F]+}} R_MIPS_COPY data1 0x0
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section ({{.*}}) .rel.plt {
 # CHECK-NEXT:     0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo0 0x0
diff --git a/lld/test/ELF/mips-sto-plt.s b/lld/test/ELF/mips-sto-plt.s
index 18964e9..bd8de41 100644
--- a/lld/test/ELF/mips-sto-plt.s
+++ b/lld/test/ELF/mips-sto-plt.s
@@ -10,6 +10,15 @@
 # REQUIRES: mips
 
 # CHECK:      Symbol {
+# CHECK:        Name: foo0@
+# CHECK-NEXT:   Value: 0x0
+# CHECK-NEXT:   Size: 0
+# CHECK-NEXT:   Binding: Global
+# CHECK-NEXT:   Type: Function
+# CHECK-NEXT:   Other: 0
+# CHECK-NEXT:   Section: Undefined
+# CHECK-NEXT: }
+# CHECK:      Symbol {
 # CHECK:        Name: foo1@
 # CHECK-NEXT:   Value: 0x20050
 # CHECK-NEXT:   Size: 0
@@ -20,15 +29,6 @@
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Section: Undefined
 # CHECK-NEXT: }
-# CHECK:      Symbol {
-# CHECK:        Name: foo0@
-# CHECK-NEXT:   Value: 0x0
-# CHECK-NEXT:   Size: 0
-# CHECK-NEXT:   Binding: Global
-# CHECK-NEXT:   Type: Function
-# CHECK-NEXT:   Other: 0
-# CHECK-NEXT:   Section: Undefined
-# CHECK-NEXT: }
 
 # CHECK:      Primary GOT {
 # CHECK:        Local entries [