diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2023-01-06 20:54:09 +0000 |
---|---|---|
committer | Sami Tolvanen <samitolvanen@google.com> | 2023-01-11 22:53:22 +0000 |
commit | a78cfd5909024f9daa9a5175e9d411b0fac0e9a1 (patch) | |
tree | c00dadc6c7fd43f8683d415906f6468aa4fa0e93 /llvm/lib/Transforms/Utils/ModuleUtils.cpp | |
parent | 6a4a697e179986324342701adc9e1c47622c3ea9 (diff) | |
download | llvm-a78cfd5909024f9daa9a5175e9d411b0fac0e9a1.zip llvm-a78cfd5909024f9daa9a5175e9d411b0fac0e9a1.tar.gz llvm-a78cfd5909024f9daa9a5175e9d411b0fac0e9a1.tar.bz2 |
[GCOV] Set !kcfi_type metadata for indirectly called functions
With CONFIG_GCOV_KERNEL, the Linux kernel indirectly calls the
__llvm_gcov_* functions generated by LLVM. With -fsanitize=kcfi,
these calls are made from instrumented code and fail indirect
call checks as they don't have !kcfi_type metadata. Similarly
to D138945, set type metadata for these functions to allow GCOV
and KCFI to be both enabled.
Link: https://github.com/ClangBuiltLinux/linux/issues/1778
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D141444
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ModuleUtils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index 315258d..ee5e65f 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -150,7 +150,7 @@ void llvm::removeFromUsedLists(Module &M, removeFromUsedList(M, "llvm.compiler.used", ShouldRemove); } -static void setKCFIType(Module &M, Function &F, StringRef MangledType) { +void llvm::setKCFIType(Module &M, Function &F, StringRef MangledType) { if (!M.getModuleFlag("kcfi")) return; // Matches CodeGenModule::CreateKCFITypeId in Clang. |