From de5deb7b07db39810c4b07870c75ccc8dccc5fe9 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Mon, 19 Aug 2024 12:53:43 +0300 Subject: [PAC][ELF][AArch64] Encode several ptrauth features in PAuth core info (#102508) For llvm_linux platform, define the following meaning for bits 9, 10, 11: - bit 9: set if indirect gotos signing is enabled; - bit 10: set if type info vtable pointer discrimination is enabled; - bit 11: set if function pointer type discrimination is enabled. --- clang/lib/CodeGen/CodeGenModule.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 6d11bd17d0a5..0b61ef0f8998 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1220,8 +1220,14 @@ void CodeGenModule::Release() { (LangOpts.PointerAuthInitFiniAddressDiscrimination << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_INITFINIADDRDISC) | (LangOpts.PointerAuthELFGOT - << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_GOT); - static_assert(AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_GOT == + << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_GOT) | + (LangOpts.PointerAuthIndirectGotos + << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_GOTOS) | + (LangOpts.PointerAuthTypeInfoVTPtrDiscrimination + << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_TYPEINFOVPTRDISCR) | + (LangOpts.PointerAuthFunctionTypeDiscrimination + << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_FPTRTYPEDISCR); + static_assert(AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_FPTRTYPEDISCR == AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_LAST, "Update when new enum items are defined"); if (PAuthABIVersion != 0) { -- cgit v1.2.3