aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDaniil Kovalev <dkovalev@accesssoftek.com>2024-11-19 10:20:15 +0300
committerGitHub <noreply@github.com>2024-11-19 10:20:15 +0300
commit3b162f73d8027dcd8261666a40e9bdfb40f4dacc (patch)
treeb231e8d1357cf02a01bd988112cd16922fe10c60 /clang/lib/CodeGen/CodeGenModule.cpp
parent0488d1774b197513cf91d973e103f4e7de293c00 (diff)
downloadllvm-3b162f73d8027dcd8261666a40e9bdfb40f4dacc.zip
llvm-3b162f73d8027dcd8261666a40e9bdfb40f4dacc.tar.gz
llvm-3b162f73d8027dcd8261666a40e9bdfb40f4dacc.tar.bz2
[PAC][clang] Add signed GOT cc1 flag (#96160)
Add `-fptrauth-elf-got` clang cc1 flag and set `ptrauth_elf_got` preprocessor feature and `PointerAuthELFGOT` LangOption correspondingly. No additional checks like ensuring OS binary format is ELF are performed: it should be done on clang driver level when a pauth-enabled environment implying signed GOT enabled is requested. If the cc1 flag is passed, "ptrauth-elf-got" IR module flag is set.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 508f534..4f45698 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1213,6 +1213,9 @@ void CodeGenModule::Release() {
getModule().addModuleFlag(llvm::Module::Min,
"sign-return-address-with-bkey", 1);
+ if (LangOpts.PointerAuthELFGOT)
+ getModule().addModuleFlag(llvm::Module::Min, "ptrauth-elf-got", 1);
+
if (getTriple().isOSLinux()) {
assert(getTriple().isOSBinFormatELF());
using namespace llvm::ELF;