[PATCH] D51457: [LLD] [COFF] Skip exporting artificial symbols when exporting all symbols

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 13:23:02 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, pcc.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D51457

Files:
  COFF/MinGW.cpp
  test/COFF/export-all.s


Index: test/COFF/export-all.s
===================================================================
--- test/COFF/export-all.s
+++ test/COFF/export-all.s
@@ -21,6 +21,7 @@
 .global _dataSym
 .global _unexported
 .global __imp__unexported
+.global .refptr._foobar
 .text
 _DllMainCRTStartup at 12:
   ret
@@ -33,6 +34,8 @@
   .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.
Index: COFF/MinGW.cpp
===================================================================
--- COFF/MinGW.cpp
+++ COFF/MinGW.cpp
@@ -102,8 +102,9 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51457.163172.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180829/6d017a1d/attachment.bin>


More information about the llvm-commits mailing list