[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 12:44:20 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:511
+      uint64_t FdeVA = getParent()->Addr + Fde->OutputOff;
+      if (Pc - VA != (uint64_t)signExtend(Pc - VA, 32))
+        fatal(toString(Fde->Sec) + ": PC offset is too large: 0x" +
----------------
I think you can use `isInt<32>(Pc - VA)`.


================
Comment at: ELF/SyntheticSections.cpp:521-527
+  std::stable_sort(
+      Ret.begin(), Ret.end(),
+      [](const FdeData &A, const FdeData &B) { return A.PcRel < B.PcRel; });
+  auto Eq = [](const FdeData &A, const FdeData &B) {
+    return A.PcRel == B.PcRel;
+  };
+  Ret.erase(std::unique(Ret.begin(), Ret.end(), Eq), Ret.end());
----------------
Why did you inline only one and not the two? Maybe you should keep the original code.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D49607





More information about the llvm-commits mailing list