From: Corinna Vinschen <vinschen@redhat.com>
To: Bernd Edlinger <bernd@edlinger-online.de>
Cc: newlib@sourceware.org
Subject: Re: [PATCH] libgloss: riscv: Fix envp parameter for main
Date: Fri, 12 Apr 2024 11:45:07 +0200 [thread overview]
Message-ID: <ZhkCo-gPuPy2s7V-@calimero.vinschen.de> (raw)
In-Reply-To: <fe866abd-d637-4b2b-b7f2-54e3a56a990b@edlinger-online.de>
On Apr 11 14:57, Bernd Edlinger wrote:
> The envp paramter is currently NULL when crt0.S calls main.
> With this patch the envp parameter should now be set correctly.
> Tested with riscv32 and riscv64: both gdb/sim and qemu do work.
> ---
> libgloss/riscv/crt0.S | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libgloss/riscv/crt0.S b/libgloss/riscv/crt0.S
> index f1c5419a5..54443e412 100644
> --- a/libgloss/riscv/crt0.S
> +++ b/libgloss/riscv/crt0.S
> @@ -61,7 +61,9 @@ _start:
>
> lw a0, 0(sp) # a0 = argc
> addi a1, sp, __SIZEOF_POINTER__ # a1 = argv
> - li a2, 0 # a2 = envp = NULL
> + slli a2, a0, 1 + __SIZEOF_POINTER__ >> 2
> + addi a2, a2, __SIZEOF_POINTER__
> + add a2, a2, a1 # a2 = envp
> call main
> tail exit
> .size _start, .-_start
> --
> 2.25.1
Pushed.
Thanks,
Corinna
prev parent reply other threads:[~2024-04-12 9:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 12:57 Bernd Edlinger
2024-04-12 9:45 ` Corinna Vinschen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZhkCo-gPuPy2s7V-@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=bernd@edlinger-online.de \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).