[PATCH] D105071: [lld/mac] Make symbol table order deterministic

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 06:30:15 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGaed0a08c69cf: [lld/mac] Make symbol table order deterministic (authored by thakis).
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105071/new/

https://reviews.llvm.org/D105071

Files:
  lld/MachO/InputFiles.cpp
  lld/test/MachO/stabs.s


Index: lld/test/MachO/stabs.s
===================================================================
--- lld/test/MachO/stabs.s
+++ lld/test/MachO/stabs.s
@@ -191,14 +191,14 @@
   .long  Lset3
   .byte  0                       ## End Of Children Mark
 Ldebug_info_end0:
-.subsections_via_symbols
-.section  __DWARF,__debug_line,regular,debug
 
 .section OTHER,more_text,regular,pure_instructions
 .globl _fun
 _fun:
   ret
 
+.subsections_via_symbols
+
 #--- foo.s
 .text
 .globl  _foo
@@ -240,13 +240,13 @@
   .long  Lset3
   .byte  0                       ## End Of Children Mark
 Ldebug_info_end0:
-.subsections_via_symbols
-.section  __DWARF,__debug_line,regular,debug
 
 .section  __DWARF,__debug_aranges,regular,debug
 ltmp1:
   .byte 0
 
+.subsections_via_symbols
+
 #--- no-debug.s
 ## This file has no debug info.
 .text
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -601,7 +601,7 @@
       continue;
 
     std::vector<uint32_t> &symbolIndices = symbolsBySection[i];
-    llvm::sort(symbolIndices, [&](uint32_t lhs, uint32_t rhs) {
+    llvm::stable_sort(symbolIndices, [&](uint32_t lhs, uint32_t rhs) {
       return nList[lhs].n_value < nList[rhs].n_value;
     });
     uint64_t sectionAddr = sectionHeaders[i].addr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105071.355213.patch
Type: text/x-patch
Size: 1342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/b68dd872/attachment.bin>


More information about the llvm-commits mailing list