aboutsummaryrefslogtreecommitdiff
path: root/packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2023-09-13 17:10:20 +1200
committerChris Packham <judge.packham@gmail.com>2023-09-17 15:41:50 +1200
commitc175b21ce470a07875a5db86f21439f02f93df0e (patch)
treefb9e2da6156e247142f9c67fe21edd5a5978f66a /packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch
parent977ed69427889a09f8e77ff9b60a6d50a18d8417 (diff)
downloadcrosstool-ng-c175b21ce470a07875a5db86f21439f02f93df0e.tar.gz
crosstool-ng-c175b21ce470a07875a5db86f21439f02f93df0e.tar.bz2
crosstool-ng-c175b21ce470a07875a5db86f21439f02f93df0e.zip
gcc: Bring in upstream fixes for CVE-2023-4039
Bring in the fixes for GCC 7 through 13. https://rtx.meta.security/mitigation/2023/09/12/CVE-2023-4039.html https://developer.arm.com/Arm%20Security%20Center/GCC%20Stack%20Protector%20Vulnerability%20AArch64 Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch')
-rw-r--r--packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch b/packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch
new file mode 100644
index 00000000..b2c9005e
--- /dev/null
+++ b/packages/gcc/7.5.0/0024-aarch64-Explicitly-handle-frames-with-no-saved-regis.patch
@@ -0,0 +1,41 @@
+From 04553281f42e5c4340d554a93d1a73006365d8fb Mon Sep 17 00:00:00 2001
+From: Richard Sandiford <richard.sandiford@arm.com>
+Date: Fri, 16 Jun 2023 17:00:51 +0100
+Subject: [PATCH 24/30] aarch64: Explicitly handle frames with no saved
+ registers
+
+If a frame has no saved registers, it can be allocated in one go.
+There is no need to treat the areas below and above the saved
+registers as separate.
+
+This is a no-op as thing stand, since a leaf function will have
+no outgoing arguments, and so all the frame will be above where
+the saved registers normally go.
+
+gcc/
+ * config/aarch64/aarch64.c (aarch64_layout_frame): Explicitly
+ allocate the frame in one go if there are no saved registers.
+---
+ gcc/config/aarch64/aarch64.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
+index 4e94be3b0b4d..bb4f6020e5df 100644
+--- a/gcc/config/aarch64/aarch64.c
++++ b/gcc/config/aarch64/aarch64.c
+@@ -2901,8 +2901,10 @@ aarch64_layout_frame (void)
+ else if (cfun->machine->frame.wb_candidate1 != INVALID_REGNUM)
+ max_push_offset = 256;
+
+- if (cfun->machine->frame.frame_size < max_push_offset
+- && crtl->outgoing_args_size == 0)
++ if (cfun->machine->frame.saved_regs_size == 0)
++ cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
++ else if (cfun->machine->frame.frame_size < max_push_offset
++ && crtl->outgoing_args_size == 0)
+ {
+ /* Simple, small frame with no outgoing arguments:
+ stp reg1, reg2, [sp, -frame_size]!
+--
+2.42.0
+