[PATCH] D76900: Enable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 20:07:55 PDT 2020


xiangzhangllvm marked 2 inline comments as done.
xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86TargetMachine.cpp:217
           OL),
-      TLOF(createTLOF(getTargetTriple())) {
+      TLOF(createTLOF(getTargetTriple())), IsJIT(JIT) {
   // On PS4, the "return address" of a 'noreturn' call must still be within
----------------
LuoYuanke wrote:
> Can you add an test for it? Where to pass the JIT information to compiler?
There is already JIT tests in llvm unit test at /llvm/unittests/ExecutionEngine/, and some examples at llvm/example.

This patch base on the build of llvm and libllvm.
To test this patch, we need to build llvm self source code with CET enabled(-fcf-protection).
JIT test mainly test runtime status (running fail/correct), not like lit test.
So current is enough to test it.  


================
Comment at: llvm/lib/Target/X86/X86TargetMachine.h:34
+  // True if this is used in JIT.
+  bool IsJIT;
 
----------------
LuoYuanke wrote:
> What's the default value for IsJIT?
In the LVM code the default is false (X86TargetMachine.h), but actually There is no meaning of "default value" for IsJIT.
The value for IsJIT is decided by the if JIT is built/called in the program. 
for example, if you use clang/llc to build your code, the value is false, otherwise if you use lli or directly call JIT with JIT API (e.g. MCJIT, ORCJIT) in your program the value is true.

JITBuilder will create the target for it, it will pass true for IsJIT to create X86TargetMachine object.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76900





More information about the llvm-commits mailing list