From c121401ca5288cca302195d941ee23762e92cf51 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 22 Nov 2017 09:06:27 +0000 Subject: [PATCH] Add more blank lines to separate code chunks. llvm-svn: 318825 --- lld/COFF/MinGW.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lld/COFF/MinGW.cpp b/lld/COFF/MinGW.cpp index 12143c6..162a8cb 100644 --- a/lld/COFF/MinGW.cpp +++ b/lld/COFF/MinGW.cpp @@ -19,7 +19,7 @@ using namespace llvm; using namespace llvm::COFF; AutoExporter::AutoExporter() { - if (Config->Machine == I386) + if (Config->Machine == I386) { ExcludeSymbols = { "__NULL_IMPORT_DESCRIPTOR", "__pei386_runtime_relocator", @@ -35,7 +35,7 @@ AutoExporter::AutoExporter() { "_DllEntryPoint@12", "_DllMainCRTStartup@12", }; - else + } else { ExcludeSymbols = { "_NULL_IMPORT_DESCRIPTOR", "_pei386_runtime_relocator", @@ -51,6 +51,7 @@ AutoExporter::AutoExporter() { "DllEntryPoint", "DllMainCRTStartup", }; + } ExcludeLibs = { "libgcc", @@ -91,21 +92,27 @@ AutoExporter::AutoExporter() { bool AutoExporter::shouldExport(Defined *Sym) const { if (!Sym || !Sym->isLive() || !Sym->getChunk()) return false; + // Only allow the symbol kinds that make sense to export; in particular, // disallow import symbols. if (!isa(Sym) && !isa(Sym)) return false; if (ExcludeSymbols.count(Sym->getName())) return false; + // Check that file is non-null before dereferencing it, symbols not // originating in regular object files probably shouldn't be exported. if (!Sym->getFile()) return false; + StringRef LibName = sys::path::filename(Sym->getFile()->ParentName); + // Drop the file extension. LibName = LibName.substr(0, LibName.rfind('.')); + if (ExcludeLibs.count(LibName)) return false; + StringRef FileName = sys::path::filename(Sym->getFile()->getName()); if (LibName.empty() && ExcludeObjects.count(FileName)) return false; -- 2.7.4