[lld] r341408 - When a relocation to an undefined symbol is an R_X86_64_PC32, an input
Sterling Augustine via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 4 14:06:59 PDT 2018
Author: saugustine
Date: Tue Sep 4 14:06:59 2018
New Revision: 341408
URL: http://llvm.org/viewvc/llvm-project?rev=341408&view=rev
Log:
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.
Modified:
lld/trunk/ELF/InputSection.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=341408&r1=341407&r2=341408&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Sep 4 14:06:59 2018
@@ -947,7 +947,7 @@ void InputSectionBase::adjustSplitStackF
// 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))
More information about the llvm-commits
mailing list