summaryrefslogtreecommitdiff
path: root/lld/ELF/InputSection.cpp
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2018-09-04 21:06:59 +0000
committerSterling Augustine <saugustine@google.com>2018-09-04 21:06:59 +0000
commitddbd98de04a4a63e34a8e2438c709571bdbbf693 (patch)
tree0431a41ec207d49d5c4a93b6f9d81fc4a0c1e83d /lld/ELF/InputSection.cpp
parent2d72e02ccbe2fd5c914f85846a48b9832c7b4711 (diff)
When a relocation to an undefined symbol is an R_X86_64_PC32, an input
section will not have an input file. Don't crash under those circumstances. Neither clang nor llvm-mc generates R_X86_64_PC32 relocations due to https://reviews.llvm.org/D43383, which makes it hard to write a test case. However, gcc does generate such relocations. I want to get a fix in now, but will figure out a way to actually exercise this code path as soon as I can.
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r--lld/ELF/InputSection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 9c41097acd1..a6b45e2217f 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -947,7 +947,7 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *Buf,
// conservative.
if (Defined *D = dyn_cast<Defined>(Rel.Sym))
if (InputSection *IS = cast_or_null<InputSection>(D->Section))
- if (!IS || IS->getFile<ELFT>()->SplitStack)
+ if (!IS || !IS->getFile<ELFT>() || IS->getFile<ELFT>()->SplitStack)
continue;
if (enclosingPrologueAttempted(Rel.Offset, Prologues))