diff --git a/lld/COFF/MinGW.cpp b/lld/COFF/MinGW.cpp index 2ca00587331f4..0584f60878919 100644 --- a/lld/COFF/MinGW.cpp +++ b/lld/COFF/MinGW.cpp @@ -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. diff --git a/lld/test/COFF/export-all.s b/lld/test/COFF/export-all.s index d591b9349ed2d..9ec5fd184bc0c 100644 --- a/lld/test/COFF/export-all.s +++ b/lld/test/COFF/export-all.s @@ -21,6 +21,7 @@ .global _dataSym .global _unexported .global __imp__unexported +.global .refptr._foobar .text _DllMainCRTStartup@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.