[lld] abd31b4 - [LLD][MinGW] Exclude load config symbols from auto-export (#126134)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 06:52:43 PST 2025


Author: Jacek Caban
Date: 2025-02-07T15:52:39+01:00
New Revision: abd31b48e3a8b1fe3cb01d37e35c80aa7cab9fc0

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

LOG: [LLD][MinGW] Exclude load config symbols from auto-export (#126134)

Added: 
    

Modified: 
    lld/COFF/MinGW.cpp
    lld/test/COFF/arm64x-export-all.s

Removed: 
    


################################################################################
diff  --git a/lld/COFF/MinGW.cpp b/lld/COFF/MinGW.cpp
index 8f1c1ebcc3f1313..0786353b06432a0 100644
--- a/lld/COFF/MinGW.cpp
+++ b/lld/COFF/MinGW.cpp
@@ -92,6 +92,7 @@ AutoExporter::AutoExporter(
         "__fmode",
         "_environ",
         "___dso_handle",
+        "__load_config_used",
         // These are the MinGW names that 
diff er from the standard
         // ones (lacking an extra underscore).
         "_DllMain at 12",
@@ -109,6 +110,7 @@ AutoExporter::AutoExporter(
         "_fmode",
         "environ",
         "__dso_handle",
+        "_load_config_used",
         // These are the MinGW names that 
diff er from the standard
         // ones (lacking an extra underscore).
         "DllMain",
@@ -117,6 +119,10 @@ AutoExporter::AutoExporter(
     };
     excludeSymbolPrefixes.insert("_head_");
   }
+  if (symtab.isEC()) {
+    excludeSymbols.insert("__chpe_metadata");
+    excludeSymbolPrefixes.insert("__os_arm64x_");
+  }
 }
 
 void AutoExporter::addWholeArchive(StringRef path) {

diff  --git a/lld/test/COFF/arm64x-export-all.s b/lld/test/COFF/arm64x-export-all.s
index 831edfe0b6f88b3..06ea9ec50259e58 100644
--- a/lld/test/COFF/arm64x-export-all.s
+++ b/lld/test/COFF/arm64x-export-all.s
@@ -15,16 +15,11 @@
 // EXP-NEXT: AddressSize: 64bit
 // EXP-NEXT: Export {
 // EXP-NEXT:   Ordinal: 1
-// EXP-NEXT:   Name: _load_config_used
-// EXP-NEXT:   RVA:
-// EXP-NEXT: }
-// EXP-NEXT: Export {
-// EXP-NEXT:   Ordinal: 2
 // EXP-NEXT:   Name: sym
 // EXP-NEXT:   RVA: 0x2000
 // EXP-NEXT: }
 // EXP-NEXT: Export {
-// EXP-NEXT:   Ordinal: 3
+// EXP-NEXT:   Ordinal: 2
 // EXP-NEXT:   Name: sym2
 // EXP-NEXT:   RVA: 0x2004
 // EXP-NEXT: }
@@ -34,31 +29,11 @@
 // EXP-NEXT:   AddressSize: 64bit
 // EXP-NEXT:   Export {
 // EXP-NEXT:     Ordinal: 1
-// EXP-NEXT:     Name: __chpe_metadata
-// EXP-NEXT:     RVA:
-// EXP-NEXT:   }
-// EXP-NEXT:   Export {
-// EXP-NEXT:     Ordinal: 2
-// EXP-NEXT:     Name: __os_arm64x_dispatch_icall
-// EXP-NEXT:     RVA: 0x12B0
-// EXP-NEXT:   }
-// EXP-NEXT:   Export {
-// EXP-NEXT:     Ordinal: 3
-// EXP-NEXT:     Name: __os_arm64x_dispatch_ret
-// EXP-NEXT:     RVA:
-// EXP-NEXT:   }
-// EXP-NEXT:   Export {
-// EXP-NEXT:     Ordinal: 4
-// EXP-NEXT:     Name: _load_config_used
-// EXP-NEXT:     RVA:
-// EXP-NEXT:   }
-// EXP-NEXT:   Export {
-// EXP-NEXT:     Ordinal: 5
 // EXP-NEXT:     Name: sym
 // EXP-NEXT:     RVA: 0x2008
 // EXP-NEXT:   }
 // EXP-NEXT:   Export {
-// EXP-NEXT:     Ordinal: 6
+// EXP-NEXT:     Ordinal: 2
 // EXP-NEXT:     Name: sym2
 // EXP-NEXT:     RVA: 0x200C
 // EXP-NEXT:   }


        


More information about the llvm-commits mailing list