[PATCH] D49607: [ELF] Check eh_frame_hdr overflow with PC offsets instead of PC absolute addresses

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 10:51:19 PDT 2018


MaskRay added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:510-512
+      if (Pc - VA != (uint64_t)signExtend(Pc - VA, 32))
+        fatal(toString(Fde->Sec) + ": PC offset is too large: 0x" +
+              Twine::utohexstr(Pc - VA));
----------------
ruiu wrote:
> I don't think this is a good place to check for this error. I'd move this to EhFrameHeader::writeTo(), so that getFdeData can just return FDE data without doing any extra work, as the name of that function implies.
Then we would not know which object file causes .eh_frame_hdr pcrel overflow. But if you think this information is minor, I can move the check to `EhFrameHeader::writeTo()`

FdeVA is the address of the `.eh_frame` FDE entry. I think it is very unlikely to overflow


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D49607





More information about the llvm-commits mailing list