[llvm] [PAC][CodeGen][ELF][AArch64] Support signed GOT (PR #96164)
Daniil Kovalev via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 00:30:52 PDT 2024
================
@@ -82,6 +83,25 @@ static bool ShouldSignWithBKey(const Function &F, const AArch64Subtarget &STI) {
return Key == "b_key";
}
+static bool hasELFSignedGOTHelper(const Function &F,
+ const AArch64Subtarget *STI) {
+ if (!Triple(STI->getTargetTriple()).isOSBinFormatELF())
+ return false;
+ const Module *M = F.getParent();
+ uint64_t PAuthABIPlatform = -1;
+ if (const auto *PAP = mdconst::extract_or_null<ConstantInt>(
+ M->getModuleFlag("aarch64-elf-pauthabi-platform")))
+ PAuthABIPlatform = PAP->getZExtValue();
+ if (PAuthABIPlatform != ELF::AARCH64_PAUTH_PLATFORM_LLVM_LINUX)
+ return false;
+ uint64_t PAuthABIVersion = -1;
+ if (const auto *PAV = mdconst::extract_or_null<ConstantInt>(
+ M->getModuleFlag("aarch64-elf-pauthabi-version")))
+ PAuthABIVersion = PAV->getZExtValue();
+ return (PAuthABIVersion &
+ (1 << ELF::AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_GOT)) != 0;
----------------
kovdan01 wrote:
You are right, that's not correct, thanks for pointing this out. This magic with -1 was OK in AsmPrinter (probably should be changes to `std::optional` or smth there as well though), but here it's not applicable. Applied your suggestion in 4c85d6c31cfc89e8543d4f8d78c9cd82dd33ca37
https://github.com/llvm/llvm-project/pull/96164
More information about the llvm-commits
mailing list