Skip to content

Commit

Permalink
[COFF] Skip exporting artificial symbols when exporting all symbols
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D51457

llvm-svn: 341017
  • Loading branch information
mstorsjo committed Aug 30, 2018
1 parent e5120a3 commit fcd5529
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lld/COFF/MinGW.cpp
Expand Up @@ -102,8 +102,9 @@ bool AutoExporter::shouldExport(Defined *Sym) const {
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.
Expand Down
3 changes: 3 additions & 0 deletions lld/test/COFF/export-all.s
Expand Up @@ -21,6 +21,7 @@
.global _dataSym
.global _unexported
.global __imp__unexported
.global .refptr._foobar
.text
_DllMainCRTStartup@12:
ret
Expand All @@ -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.
Expand Down

0 comments on commit fcd5529

Please sign in to comment.