public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: riscv: Make stack 16-byte aligned
@ 2024-04-15  8:21 Bernd Edlinger
  0 siblings, 0 replies; only message in thread
From: Bernd Edlinger @ 2024-04-15  8:21 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a73073dc7f23ab37ae33402fbb38c8314bcbea3e

commit a73073dc7f23ab37ae33402fbb38c8314bcbea3e
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Wed Apr 10 13:34:21 2024 +0200

    sim: riscv: Make stack 16-byte aligned
    
    Various gcc test cases fail due to the stack
    alignment of 16 bytes is expected by gcc,
    causing issues mostly with vararg functions,
    e.g.
    
    FAIL: gcc.c-torture/execute/nest-align-1.c   -O0  execution test
    FAIL: gcc.c-torture/execute/nest-stdar-1.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-12.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-15.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-16.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-17.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-20.c   -O0  execution test
    FAIL: gcc.c-torture/execute/va-arg-26.c   -O0  execution test
    ...
    
    Approved-By: Andrew Burgess <aburgess@redhat.com>

Diff:
---
 sim/riscv/sim-main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index ddc7e1d3e98..1ccae450ad4 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -1575,6 +1575,8 @@ initialize_env (SIM_DESC sd, const char * const *argv, const char * const *env)
   sp = sp_flat - ((argc + 1 + envc + 1) * sizeof (address_word));
   /* Then the argc.  */
   sp -= sizeof (unsigned_word);
+  /* Align to 16 bytes.  */
+  sp = align_down (sp, 16);
 
   /* Set up the regs the libgloss crt0 expects.  */
   riscv_cpu->a0 = argc;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-15  8:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15  8:21 [binutils-gdb] sim: riscv: Make stack 16-byte aligned Bernd Edlinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).