[lld] r341017 - [COFF] Skip exporting artificial symbols when exporting all symbols

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 22:44:41 PDT 2018


Author: mstorsjo
Date: Wed Aug 29 22:44:41 2018
New Revision: 341017

URL: http://llvm.org/viewvc/llvm-project?rev=341017&view=rev
Log:
[COFF] Skip exporting artificial symbols when exporting all symbols

Differential Revision: https://reviews.llvm.org/D51457

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

Modified: lld/trunk/COFF/MinGW.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/MinGW.cpp?rev=341017&r1=341016&r2=341017&view=diff
==============================================================================
--- lld/trunk/COFF/MinGW.cpp (original)
+++ lld/trunk/COFF/MinGW.cpp Wed Aug 29 22:44:41 2018
@@ -102,8 +102,9 @@ bool AutoExporter::shouldExport(Defined
     return false;
 
   // Don't export anything that looks like an import symbol (which also can be
-  // a manually defined data symbol with such a name).
-  if (Sym->getName().startswith("__imp_"))
+  // a manually defined data symbol with such a name); don't export artificial
+  // symbols like .refptr pointer stubs.
+  if (Sym->getName().startswith("__imp_") || Sym->getName().startswith("."))
     return false;
 
   // If a corresponding __imp_ symbol exists and is defined, don't export it.

Modified: lld/trunk/test/COFF/export-all.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/export-all.s?rev=341017&r1=341016&r2=341017&view=diff
==============================================================================
--- lld/trunk/test/COFF/export-all.s (original)
+++ lld/trunk/test/COFF/export-all.s Wed Aug 29 22:44:41 2018
@@ -21,6 +21,7 @@
 .global _dataSym
 .global _unexported
 .global __imp__unexported
+.global .refptr._foobar
 .text
 _DllMainCRTStartup at 12:
   ret
@@ -33,6 +34,8 @@ _dataSym:
   .int 4
 __imp__unexported:
   .int _unexported
+.refptr._foobar:
+  .int _foobar
 
 # Test specifying -export-all-symbols, on an object file that contains
 # dllexport directive for some of the symbols.




More information about the llvm-commits mailing list