[llvm] r316678 - [dsymutil] Check AttrInfo.Name validity before using it

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 10:31:33 PDT 2017


Author: kfischer
Date: Thu Oct 26 10:31:33 2017
New Revision: 316678

URL: http://llvm.org/viewvc/llvm-project?rev=316678&view=rev
Log:
[dsymutil] Check AttrInfo.Name validity before using it

Summary:
This upstreams a patch from the osxcross [1] toolchain.
It appears that llvm-dsymutil crashes at this place during GCC
bootstrap. Adding the check here seems reasonable, since it operates
on arbitrary input DWARF, not necessarily generated by the LLVM
toolchain, and it seems the un-mangled name need not necessarily exist.

Patch by Thomas Pöchtrager

[1] https://github.com/tpoechtrager/osxcross

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D39336

Modified:
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp

Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=316678&r1=316677&r2=316678&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Thu Oct 26 10:31:33 2017
@@ -2878,7 +2878,8 @@ DIE *DwarfLinker::DIECloner::cloneDIE(
                               Tag == dwarf::DW_TAG_inlined_subroutine);
   } else if (isTypeTag(Tag) && !AttrInfo.IsDeclaration &&
              getDIENames(InputDIE, AttrInfo)) {
-    Unit.addTypeAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset);
+    if (AttrInfo.Name)
+      Unit.addTypeAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset);
   }
 
   // Determine whether there are any children that we want to keep.




More information about the llvm-commits mailing list