[lld] LLD: Fix getFdePC with sdata2 or sdata4 (PR #92228)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 11:36:34 PDT 2024


================
@@ -612,10 +612,23 @@ uint64_t EhFrameSection::getFdePc(uint8_t *buf, size_t fdeOff,
   // the .eh_frame section.
   size_t off = fdeOff + 8;
   uint64_t addr = readFdeAddr(buf + off, enc & 0xf);
-  if ((enc & 0x70) == DW_EH_PE_absptr)
-    return addr;
-  if ((enc & 0x70) == DW_EH_PE_pcrel)
-    return addr + getParent()->addr + off + outSecOff;
+  if ((enc & 0x70) == DW_EH_PE_absptr) {
+    if ((enc & 0xf) == DW_EH_PE_sdata2)
----------------
MaskRay wrote:

This is probably not desired for ELFCLASS64.

See the alternative fix: https://github.com/llvm/llvm-project/pull/92438 , but thanks for investigation.

https://github.com/llvm/llvm-project/pull/92228


More information about the llvm-commits mailing list