[llvm] [PAC][CodeGen][ELF][AArch64] Support signed GOT (PR #105798)
Anton Korobeynikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 12:55:14 PDT 2024
================
@@ -923,6 +928,22 @@ void AArch64AsmPrinter::emitEndOfAsmFile(Module &M) {
OutStreamer->addBlankLine();
}
+
+ // With signed ELF GOT enabled, the linker looks at the symbol type to
+ // choose between keys IA (for STT_FUNC) and DA (for other types). Symbols
+ // for functions not defined in the module have STT_NOTYPE type by default.
+ // This makes linker to emit signing schema with DA key (instead of IA) for
+ // corresponding R_AARCH64_AUTH_GLOB_DAT dynamic reloc. To avoid that, force
+ // all function symbols used in the module to have STT_FUNC type. See
+ // https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#default-signing-schema
+ const auto *PtrAuthELFGOTFlag = mdconst::extract_or_null<ConstantInt>(
+ M.getModuleFlag("ptrauth-elf-got"));
+ if (PtrAuthELFGOTFlag && PtrAuthELFGOTFlag->getZExtValue() == 1)
+ for (const GlobalValue &GV : M.global_values())
+ if (!GV.use_empty() && GV.getValueType()->isFunctionTy() &&
----------------
asl wrote:
Can it be simplified down to `isa<Function>(GV)`? Also, what happens with aliases?
https://github.com/llvm/llvm-project/pull/105798
More information about the llvm-commits
mailing list