[llvm] [clang] [AArch64] Stack probing for function prologues (PR #66524)
Momchil Velikov via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 16:41:15 PST 2023
================
@@ -1076,6 +1076,16 @@ void CodeGenModule::Release() {
"sign-return-address-with-bkey", 1);
}
+ if (Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) {
+ auto *InlineAsm = llvm::MDString::get(TheModule.getContext(), "inline-asm");
+ if (CodeGenOpts.StackClashProtector)
+ getModule().addModuleFlag(llvm::Module::Override, "probe-stack",
+ InlineAsm);
----------------
momchil-velikov wrote:
We would like to use a module flag so the stack clash protection is effective for functions created by LLVM (e..g `asan.module_ctor`).
It is not AArch64 specific in principle, but other backends which implement SCP still rely on function attributes. When/if other backends adopt this approach the condition can be removed.
@serge-sans-paille
https://github.com/llvm/llvm-project/pull/66524
More information about the cfe-commits
mailing list