From 15d4a84e7977725dc0661995963a12ff8605b03c Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 6 Aug 2024 18:24:01 +0300 Subject: [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core info (#96159) Treat 8th bit of version value for llvm_linux platform as signed GOT flag. - clang: define `PointerAuthELFGOT` LangOption and set 8th bit of `aarch64-elf-pauthabi-version` LLVM module flag correspondingly; - llvm-readobj: print `PointerAuthELFGOT` or `!PointerAuthELFGOT` in version description of llvm_linux platform depending on whether the flag is set. --- clang/lib/CodeGen/CodeGenModule.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 50484a0..9aaf90c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1218,11 +1218,12 @@ void CodeGenModule::Release() { (LangOpts.PointerAuthInitFini << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_INITFINI) | (LangOpts.PointerAuthInitFiniAddressDiscrimination - << AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_INITFINIADDRDISC); - static_assert( - AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_INITFINIADDRDISC == - AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_LAST, - "Update when new enum items are defined"); + << 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_LAST, + "Update when new enum items are defined"); if (PAuthABIVersion != 0) { getModule().addModuleFlag(llvm::Module::Error, "aarch64-elf-pauthabi-platform", -- cgit v1.1