[PATCH] D72567: [ELF] Avoid false-positive assert in getErrPlace()
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 06:39:21 PST 2020
This revision was automatically updated to reflect the committed changes.
arichardson marked 4 inline comments as done.
Closed by commit rG441410be471d: [ELF] Avoid false-positive assert in getErrPlace() (authored by arichardson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72567/new/
https://reviews.llvm.org/D72567
Files:
lld/ELF/Target.cpp
lld/test/ELF/mips-jalr-non-functions.s
Index: lld/test/ELF/mips-jalr-non-functions.s
===================================================================
--- lld/test/ELF/mips-jalr-non-functions.s
+++ lld/test/ELF/mips-jalr-non-functions.s
@@ -6,7 +6,12 @@
## relocations to avoid generating binaries that crash when executed.
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
-# RUN: ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s -check-prefix WARNING-MESSAGE
+## Link in another object file with a .bss as a regression test:
+## Previously LLD asserted when skipping over .bss sections when determining the
+## location for a warning/error message. By adding another file with a .bss
+## section before the actual %t.o we can reproduce this case.
+# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %S/Inputs/common.s -o %t-common.o
+# RUN: ld.lld -shared %t-common.o %t.o -o %t.so 2>&1 | FileCheck %s -check-prefix WARNING-MESSAGE
# RUN: llvm-objdump --no-show-raw-insn --no-leading-addr -d %t.so | FileCheck %s
.set noreorder
Index: lld/ELF/Target.cpp
===================================================================
--- lld/ELF/Target.cpp
+++ lld/ELF/Target.cpp
@@ -95,7 +95,7 @@
assert(loc != nullptr);
for (InputSectionBase *d : inputSections) {
auto *isec = cast<InputSection>(d);
- if (!isec->getParent())
+ if (!isec->getParent() || (isec->type & SHT_NOBITS))
continue;
const uint8_t *isecLoc =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72567.238237.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200115/10a2744e/attachment.bin>
More information about the llvm-commits
mailing list