aboutsummaryrefslogtreecommitdiff
path: root/libcc1/context.cc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-09-12 16:05:10 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-09-12 16:05:10 +0100
commit1785b8077cc03214ebd1db953c870172fcf15966 (patch)
tree31f53be2802eb229ff42b5fb25fbc049e3398d27 /libcc1/context.cc
parentee5466ff4faca2076cc61f1f120d0b5062c8111c (diff)
downloadgcc-1785b8077cc03214ebd1db953c870172fcf15966.zip
gcc-1785b8077cc03214ebd1db953c870172fcf15966.tar.gz
gcc-1785b8077cc03214ebd1db953c870172fcf15966.tar.bz2
aarch64: Tweak stack clash boundary condition
The AArch64 ABI says that, when stack clash protection is used, there can be a maximum of 1KiB of unprobed space at sp on entry to a function. Therefore, we need to probe when allocating >= guard_size - 1KiB of data (>= rather than >). This is what GCC does. If an allocation is exactly guard_size bytes, it is enough to allocate those bytes and probe once at offset 1024. It isn't possible to use a single probe at any other offset: higher would conmplicate later code, by leaving more unprobed space than usual, while lower would risk leaving an entire page unprobed. For simplicity, the code probes all allocations at offset 1024. Some register saves also act as probes. If we need to allocate more space below the last such register save probe, we need to probe the allocation if it is > 1KiB. Again, this allocation is then sometimes (but not always) probed at offset 1024. This sort of allocation is currently only used for outgoing arguments, which are rarely this big. However, the code also probed if this final outgoing-arguments allocation was == 1KiB, rather than just > 1KiB. This isn't necessary, since the register save then probes at offset 1024 as required. Continuing to probe allocations of exactly 1KiB would complicate later patches. gcc/ * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): Don't probe final allocations that are exactly 1KiB in size (after unprobed space above the final allocation has been deducted). gcc/testsuite/ * gcc.target/aarch64/stack-check-prologue-17.c: New test.
Diffstat (limited to 'libcc1/context.cc')
0 files changed, 0 insertions, 0 deletions