[llvm] [aarch64] XOR the frame pointer with the stack cookie when protecting the stack (PR #161114)
Pan Tao via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 22 00:46:09 PDT 2025
PanTao2 wrote:
Hi @omjavaid thanks for your comment. I think you prefer 'only matching semantics'. I think this is great.
My understanding of the difference between aarch64 and x86_64 on Windows MSVC, please correct me if there are any errors.
1. MSVC uses push pop helpers (calls __security_{push|pop}_cookie) on aarch64, while it inlines the checks on x86_64.
2. MSVC mixes the cookie using sub (sp - cookie) on aarch64, while it mixes the cookie using xor (cookie ^ rsp) on x86_64.
Regarding 1, based on recent optimizations (PR #[95904](https://github.com/llvm/llvm-project/pull/95904) and PR #[136290](https://github.com/llvm/llvm-project/pull/136290)), I think you prefer inline checks on aarch64. I think it's great.
Regarding 2, thanks for your reminding, I think this is great that using sub (sp - cookie) for fitting better with overall Arm’s stack arithmetic.
***What do you think of changing the implementation of this PR to inline sub (sp - cookie)?***
https://github.com/llvm/llvm-project/pull/161114
More information about the llvm-commits
mailing list