[all-commits] [llvm/llvm-project] 5dc8aa: [llvm][IR] Add no_cfi constant
Sami Tolvanen via All-commits
all-commits at lists.llvm.org
Mon Dec 20 13:11:23 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5dc8aaac39c53c8e91842a9233921759544759bc
https://github.com/llvm/llvm-project/commit/5dc8aaac39c53c8e91842a9233921759544759bc
Author: Sami Tolvanen <samitolvanen at google.com>
Date: 2021-12-20 (Mon, 20 Dec 2021)
Changed paths:
M llvm/docs/LangRef.rst
M llvm/include/llvm/AsmParser/LLParser.h
M llvm/include/llvm/AsmParser/LLToken.h
M llvm/include/llvm/Bitcode/LLVMBitCodes.h
M llvm/include/llvm/IR/Constants.h
M llvm/include/llvm/IR/Value.def
M llvm/lib/AsmParser/LLLexer.cpp
M llvm/lib/AsmParser/LLParser.cpp
M llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M llvm/lib/IR/AsmWriter.cpp
M llvm/lib/IR/Constants.cpp
M llvm/lib/IR/LLVMContextImpl.h
M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
M llvm/lib/Transforms/Utils/ValueMapper.cpp
A llvm/test/Bitcode/nocfivalue.ll
A llvm/test/CodeGen/X86/nocfivalue.ll
A llvm/test/Transforms/LowerTypeTests/nocfivalue.ll
M llvm/utils/emacs/llvm-mode.el
M llvm/utils/vim/syntax/llvm.vim
Log Message:
-----------
[llvm][IR] Add no_cfi constant
With Control-Flow Integrity (CFI), the LowerTypeTests pass replaces
function references with CFI jump table references, which is a problem
for low-level code that needs the address of the actual function body.
For example, in the Linux kernel, the code that sets up interrupt
handlers needs to take the address of the interrupt handler function
instead of the CFI jump table, as the jump table may not even be mapped
into memory when an interrupt is triggered.
This change adds the no_cfi constant type, which wraps function
references in a value that LowerTypeTestsModule::replaceCfiUses does not
replace.
Link: https://github.com/ClangBuiltLinux/linux/issues/1353
Reviewed By: nickdesaulniers, pcc
Differential Revision: https://reviews.llvm.org/D108478
Commit: ec2e26eaf63558934f5b73a6e530edc453cf9508
https://github.com/llvm/llvm-project/commit/ec2e26eaf63558934f5b73a6e530edc453cf9508
Author: Sami Tolvanen <samitolvanen at google.com>
Date: 2021-12-20 (Mon, 20 Dec 2021)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/include/clang/AST/Expr.h
M clang/include/clang/Basic/Builtins.def
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/AST/Expr.cpp
M clang/lib/AST/ExprConstant.cpp
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/CodeGen/CGExprConstant.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/lib/CodeGen/CodeGenModule.h
M clang/lib/Sema/SemaChecking.cpp
M clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
A clang/test/CodeGen/builtin-function-start.cpp
M clang/test/SemaCXX/builtins.cpp
Log Message:
-----------
[Clang] Add __builtin_function_start
Control-Flow Integrity (CFI) replaces references to address-taken
functions with pointers to the CFI jump table. This is a problem
for low-level code, such as operating system kernels, which may
need the address of an actual function body without the jump table
indirection.
This change adds the __builtin_function_start() builtin, which
accepts an argument that can be constant-evaluated to a function,
and returns the address of the function body.
Link: https://github.com/ClangBuiltLinux/linux/issues/1353
Depends on D108478
Reviewed By: pcc, rjmccall
Differential Revision: https://reviews.llvm.org/D108479
Compare: https://github.com/llvm/llvm-project/compare/02b6fb218e44...ec2e26eaf635
More information about the All-commits
mailing list