[lld] [LLD][AARCH64] lld incorrectly handles .eh_frame when it has a non-zero offset within its output section. (PR #65966)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 09:16:26 PDT 2023
================
@@ -583,9 +583,14 @@ static uint64_t readFdeAddr(uint8_t *buf, int size) {
uint64_t EhFrameSection::getFdePc(uint8_t *buf, size_t fdeOff,
uint8_t enc) const {
// The starting address to which this FDE applies is
- // stored at FDE + 8 byte.
+ // stored at FDE + 8 byte. And this offset is within
+ // the .eh_frame section.
size_t off = fdeOff + 8;
uint64_t addr = readFdeAddr(buf + off, enc & 0xf);
+ // Adding outSecOff as finalizeAddressDependentContent()
+ // may have altered the corresponding outSecOff. This is
+ // required to get the correct PC relative offset.
+ off = off + outSecOff;
----------------
simpal01 wrote:
on a second thought, adding outSecOff inside the condition might be more sensible.
if ((enc & 0x70) == DW_EH_PE_pcrel)
return addr + getParent()->addr + off;
https://github.com/llvm/llvm-project/pull/65966
More information about the llvm-commits
mailing list