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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 10:25:51 PDT 2018


ruiu 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));
----------------
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.


================
Comment at: ELF/SyntheticSections.cpp:513
+              Twine::utohexstr(Pc - VA));
       uint32_t FdeVA = getParent()->Addr + Fde->OutputOff;
+      Ret.push_back({Pc, FdeVA});
----------------
Can't FdeVA overflow?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D49607





More information about the llvm-commits mailing list