Bug 1410148 - Backport llvm r289565 to clang 3.9. r=gps

I was able to reproduce the failure to apply llvm-dsymutil on the last
mozilla-central revision before debug info was temporarily disabled for
rust, and validated that the problem was gone in clang 4.

After some bisection, r289565 was identified as having fixed the
problem, which, reading the commit message, makes sense.

It was however not possible to simply cherry-pick, because of multiple
code changes between 3.9 and 4. However, apart from the volume of
conflicting changes, it was more or less straightforward to backport.

Interestingly, the patch for r313872 was relying on changes from
r289565, which is why it required a variant specifically for 3.9, but
now we can use the same patch as for other versions. Well, except
there's a small difference in the context, and build-clang.py doesn't
allow fuzz, so we manually edit the patch to remove that line from the
context.

--HG--
extra : rebase_source : cda077132ee499a8ffdc4c88a1160cfa5fd86a97
This commit is contained in:
Mike Hommey 2017-12-28 14:54:51 +09:00
parent 67185715fd
commit 8a6ab5b9ab
4 changed files with 2472 additions and 20 deletions

View File

@ -18,6 +18,7 @@
"llvm-debug-frame.patch",
"r277806.patch",
"r285657.patch",
"r313872-for-3.9.patch"
"r289565-for-3.9.patch",
"r313872.patch"
]
}

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
--- a/llvm/tools/dsymutil/DwarfLinker.cpp
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp
@@ -1489,8 +1489,12 @@
uint64_t RefOffset = *RefValue.getAsReference(&Unit);
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", &Unit, &DIE);
return nullptr;

View File

@ -2,8 +2,7 @@ Index: tools/dsymutil/DwarfLinker.cpp
===================================================================
--- a/llvm/tools/dsymutil/DwarfLinker.cpp (revision 313871)
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp (revision 313872)
@@ -1495,8 +1495,12 @@
uint64_t RefOffset = *RefValue.getAsReference();
@@ -1496,7 +1496,11 @@
if ((RefCU = getUnitForOffset(Units, RefOffset)))
- if (const auto RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset))