[llvm] [PAC][CodeGen][ELF][AArch64] Support signed GOT (PR #96164)
Tomas Matheson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 5 10:49:39 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;
----------------
tmatheson-arm wrote:
```suggestion
const auto *PAP = mdconst::extract_or_null<ConstantInt>(
M->getModuleFlag("aarch64-elf-pauthabi-platform"));
if (!PAP || PAP->getZExtValue() != ELF::AARCH64_PAUTH_PLATFORM_LLVM_LINUX)
return false;
```
This avoids the magic -1 and makes the logic easier to follow, imho.
https://github.com/llvm/llvm-project/pull/96164
More information about the llvm-commits
mailing list