[PATCH] D59780: Support Intel Control-flow Enforcement Technology

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 00:19:58 PDT 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:631
+      uint32_t Type = *reinterpret_cast<const uint32_t *>(Desc.data());
+      uint32_t Size = *reinterpret_cast<const uint32_t *>(Desc.data() + 4) * 4;
+      if (Size == 0)
----------------
xiangzhangllvm wrote:
> The Size calculation here seems strange.  Why *4 ?
> *(Desc.data()+4) is datasz, it is the feature size. 
> I think it should be
> uint32_t Size = *reinterpret_cast<const uint32_t *>(Desc.data() + 4) + 8 +Pading;
> (for 32-bit the Pading is always 0, and 64-bit is 4, due to their alignments)
Use `read32le`. `*reinterpret_cast<const uint32_t *>(Desc.data())` doesn't work when cross linking x86 modules on a big-endian architecture.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59780/new/

https://reviews.llvm.org/D59780





More information about the llvm-commits mailing list