From 2c52aebf90f28121a3e46a9305304406023b9747 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 27 Jun 2023 09:47:01 +0200 Subject: [PATCH 33/37] pc-bios/s390-ccw: Provide space for initial stack frame in start.S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Thomas Huth RH-MergeRequest: 180: Fix misaligned symbol error in the s390-ccw image during qemu-kvm build with binutils 2.40 RH-Bugzilla: 2220866 RH-Acked-by: Cédric Le Goater RH-Acked-by: Miroslav Rezanina RH-Commit: [3/4] c2f69ce5998861fe20b799bf0113def8cf0cd128 (thuth/qemu-kvm-cs9) Providing the space of a stack frame is the duty of the caller, so we should reserve 160 bytes before jumping into the main function. Otherwise the main() function might write past the stack array. While we're at it, add a proper STACK_SIZE macro for the stack size instead of using magic numbers (this is also required for the following patch). Reviewed-by: Christian Borntraeger Reviewed-by: Cédric Le Goater Message-Id: <20230627074703.99608-3-thuth@redhat.com> Reviewed-by: Eric Farman Reviewed-by: Claudio Imbrenda Reviewed-by: Marc Hartmayer Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth (cherry picked from commit 74fe98ee7fb3344dbd085d1fa32c0dc2fc2c831f) --- pc-bios/s390-ccw/start.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S index d29de09cc6..abd6fe6639 100644 --- a/pc-bios/s390-ccw/start.S +++ b/pc-bios/s390-ccw/start.S @@ -10,10 +10,13 @@ * directory. */ +#define STACK_SIZE 0x8000 +#define STACK_FRAME_SIZE 160 + .globl _start _start: - larl %r15,stack + 0x8000 /* Set up stack */ + larl %r15,stack + STACK_SIZE - STACK_FRAME_SIZE /* Set up stack */ /* clear bss */ larl %r2,__bss_start -- 2.39.3