[lld] 61312fd - [ELF] sortSections: delete unneeded outSecOff assignment

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 23 01:24:37 PST 2021


Author: Fangrui Song
Date: 2021-12-23T01:24:32-08:00
New Revision: 61312fd5aa1e193cfa41004ff0fe84e0a2061c6e

URL: https://github.com/llvm/llvm-project/commit/61312fd5aa1e193cfa41004ff0fe84e0a2061c6e
DIFF: https://github.com/llvm/llvm-project/commit/61312fd5aa1e193cfa41004ff0fe84e0a2061c6e.diff

LOG: [ELF] sortSections: delete unneeded outSecOff assignment

Related to D45368 but outSecOff is unneeded because resolveShfLinkOrder uses
stable_sort.

Added: 
    

Modified: 
    lld/ELF/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index b593a2950e53..221601d15c2f 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1469,13 +1469,6 @@ template <class ELFT> void Writer<ELFT>::sortSections() {
     if (!os)
       continue;
     os->sortRank = getSectionRank(os);
-
-    // We want to assign rude approximation values to outSecOff fields
-    // to know the relative order of the input sections. We use it for
-    // sorting SHF_LINK_ORDER sections. See resolveShfLinkOrder().
-    uint64_t i = 0;
-    for (InputSection *sec : getInputSections(os))
-      sec->outSecOff = i++;
   }
 
   if (!script->hasSectionsCommand) {


        


More information about the llvm-commits mailing list