Skip to content

Commit f804e2b

Browse files
committed
[ELF] .eh_frame: use errorOrWarn for "PC offset is too large"
errorOrWarn is more conventional for recoverable errors. This error message does not have to use `fatal`, and we try to remove such uses in parallel code paths.
1 parent ed4bdb8 commit f804e2b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,11 @@ SmallVector<EhFrameSection::FdeData, 0> EhFrameSection::getFdeData() const {
537537
for (EhSectionPiece *fde : rec->fdes) {
538538
uint64_t pc = getFdePc(buf, fde->outputOff, enc);
539539
uint64_t fdeVA = getParent()->addr + fde->outputOff;
540-
if (!isInt<32>(pc - va))
541-
fatal(toString(fde->sec) + ": PC offset is too large: 0x" +
542-
Twine::utohexstr(pc - va));
540+
if (!isInt<32>(pc - va)) {
541+
errorOrWarn(toString(fde->sec) + ": PC offset is too large: 0x" +
542+
Twine::utohexstr(pc - va));
543+
continue;
544+
}
543545
ret.push_back({uint32_t(pc - va), uint32_t(fdeVA - va)});
544546
}
545547
}

lld/test/ELF/eh-frame-pcrel-overflow.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/eh-frame-pcrel-overflow.s -o %t1.o
55
# RUN: ld.lld --eh-frame-hdr -Ttext=0x90000000 %t.o -o /dev/null
66
# RUN: not ld.lld --eh-frame-hdr %t.o %t1.o -o /dev/null 2>&1 | FileCheck %s
7+
# RUN: ld.lld --eh-frame-hdr %t.o %t1.o -o /dev/null --noinhibit-exec 2>&1 | FileCheck %s --check-prefix=WARN
78
# CHECK: error: {{.*}}.o:(.eh_frame): PC offset is too large: 0x90001054
9+
# WARN: warning: {{.*}}.o:(.eh_frame): PC offset is too large: 0x90001054
810

911
.text
1012
.global _start

0 commit comments

Comments
 (0)