[PATCH] D70606: LLD: CET shadow stack support on Windows

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 22:21:15 PST 2020


ruiu accepted this revision.
ruiu added a comment.

LGTM with this change.

As to how to test this, I'm fine with checking in a binary file until you extend yaml2obj so that the tool can produce an ExtendedDLLCharacterstics section. It isn't ideal but we already have a few binary files in our test suite.



================
Comment at: lld/COFF/Writer.cpp:180
+  void writeTo(uint8_t *buf) const override {
+    memcpy(buf, &characteristics, 4);
+  }
----------------
You should use write32le to guarantee that you are writing the four bytes in the little-endian order. Windows machines are all little-endian, but if you by any chance cross-build a Windows binary on a big-endian machine (e.g. creating an UEFI or Windows binary on PPC32BE using lld), this code would write a word in a wrong order. I believe there's a PPC big-endian bot, so this code would fail on the bot if you check this in as-is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70606





More information about the llvm-commits mailing list