[PATCH] D40014: [COFF] Don't crash when checking for autoexporting of symbols without a file

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 03:34:19 PST 2017


mstorsjo created this revision.

I ran into this when linking a third party library using lld/mingw with -opt:noref. I'm not completely sure where that symbol comes from (in order to understand the issue better, to make a test) since it doesn't indicate what file is the culprit...


https://reviews.llvm.org/D40014

Files:
  COFF/MinGW.cpp


Index: COFF/MinGW.cpp
===================================================================
--- COFF/MinGW.cpp
+++ COFF/MinGW.cpp
@@ -93,6 +93,8 @@
     return false;
   if (ExcludeSymbols.count(Sym->getName()))
     return false;
+  if (!Sym->getFile())
+    return false;
   StringRef LibName = sys::path::filename(Sym->getFile()->ParentName);
   // Drop the file extension.
   LibName = LibName.substr(0, LibName.rfind('.'));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40014.122813.patch
Type: text/x-patch
Size: 427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/de35bfbc/attachment.bin>


More information about the llvm-commits mailing list