summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-09-21 10:28:33 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-09-21 10:28:33 +0000
commit2b029e830f6a4b6bcca815cd64d94e7ab9788f3a (patch)
tree97bbbc951bb61da1ec6ebb09b3860f0231478e08 /llvm/tools
parentc14b5f210fdeca8dccf98287184304940cdb4c1e (diff)
downloadbcm5719-llvm-2b029e830f6a4b6bcca815cd64d94e7ab9788f3a.tar.gz
bcm5719-llvm-2b029e830f6a4b6bcca815cd64d94e7ab9788f3a.zip
[dsymutil] Don't resolve DIE reference to NULL DIE.
This patch prevents dsymutil from resolving a reference to a NULL DIE when a bogus reference happens to be coincidentally referencing a NULL DIE. Now this is detected as an invalid reference and a warning is printed. Fixes: https://bugs.llvm.org/show_bug.cgi?id=33873 Differential revision: https://reviews.llvm.org/D38078 llvm-svn: 313872
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/dsymutil/DwarfLinker.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp
index 3ab3c7f5720..69adf379ca0 100644
--- a/llvm/tools/dsymutil/DwarfLinker.cpp
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp
@@ -1495,8 +1495,12 @@ static DWARFDie resolveDIEReference(
uint64_t RefOffset = *RefValue.getAsReference();
if ((RefCU = getUnitForOffset(Units, RefOffset)))
- if (const auto RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset))
- return RefDie;
+ if (const auto RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset)) {
+ // In a file with broken references, an attribute might point to a NULL
+ // DIE.
+ if(!RefDie.isNULL())
+ return RefDie;
+ }
Linker.reportWarning("could not find referenced DIE", &DIE);
return DWARFDie();
OpenPOWER on IntegriCloud