[lld] 3deb82c - [ELF] Adjust getOutputSectionName prefix order
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Dec 15 00:19:04 PST 2021
    
    
  
Author: Fangrui Song
Date: 2021-12-15T00:18:58-08:00
New Revision: 3deb82cd072bd4bb6172ece5e6d01ea6600dc3a8
URL: https://github.com/llvm/llvm-project/commit/3deb82cd072bd4bb6172ece5e6d01ea6600dc3a8
DIFF: https://github.com/llvm/llvm-project/commit/3deb82cd072bd4bb6172ece5e6d01ea6600dc3a8.diff
LOG: [ELF] Adjust getOutputSectionName prefix order
Sorting the prefixes by decreasing frequency can improve performance.
.gcc_except_table is relatively frequent, so move it ahead.
.ctors and .dtors mostly disappear and should be the last.
Added: 
    
Modified: 
    lld/ELF/LinkerScript.cpp
Removed: 
    
################################################################################
diff  --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 3a7228453f18..e8aad25c9b68 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -101,9 +101,9 @@ static StringRef getOutputSectionName(const InputSectionBase *s) {
         return v;
 
   for (StringRef v :
-       {".text", ".rodata", ".data.rel.ro", ".data", ".bss.rel.ro", ".bss",
-        ".init_array", ".fini_array", ".ctors", ".dtors", ".tbss",
-        ".gcc_except_table", ".tdata", ".ARM.exidx", ".ARM.extab"})
+       {".text", ".data.rel.ro", ".data", ".rodata", ".bss.rel.ro", ".bss",
+        ".gcc_except_table", ".init_array", ".fini_array", ".tbss", ".tdata",
+        ".ARM.exidx", ".ARM.extab", ".ctors", ".dtors"})
     if (isSectionPrefix(v, s->name))
       return v;
 
        
    
    
More information about the llvm-commits
mailing list