Re: [PATCH] VAX libstdc++ common runtime - register used but not saved

Rin Okuyama <[email protected]>
Newsgroups gmane.os.netbsd.ports.vax,gmane.os.netbsd.devel.toolchain
Message-ID <CAPSZb0Q+u2ByCsD1EX2cSe2Pa6h3goxpU71qvaD+M7h7E1boaA@mail.gmail.com>
Committed:

https://mail-index.netbsd.org/source-changes/2023/07/28/msg146283.html
https://mail-index.netbsd.org/source-changes/2023/07/28/msg146284.html

Kalvis, thanks for your report!

BTW, I think entry mask for __start() is also wrong:

https://nxr.netbsd.org/xref/src/lib/csu/arch/vax/crt0.S#38
> 38 _ENTRY(__start, 0x0101)

This 0x0101 seems like two NOPs copy-paste from pre-ELF code:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/vax/Attic/crt0.c.diff?r1=1.8&r2=1.9&hideattic=0&only_with_tag=MAIN&f=h

Can we replace 0x0101 to 0x0000 here?

Thanks,
rin

On Fri, Jul 28, 2023 at 3:23 PM Kalvis Duckmanton <[email protected]> wrote:
>
> Hello all,
>
> I believe that I've found a problem in libstdc++ for VAX where, in the
> __do_global_ctors_aux function, %r8 is used but not saved.  %r11, which
> is saved, is not used.
>
> I'd like to propose the following change against NetBSD 10.99.6 to
> correct it.
>
> Many thanks
> kalvis
>
>
> ---
>   lib/csu/arch/vax/crtbegin.S | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/csu/arch/vax/crtbegin.S b/lib/csu/arch/vax/crtbegin.S
> index 208c4658a973..207a9d03ec44 100644
> --- a/lib/csu/arch/vax/crtbegin.S
> +++ b/lib/csu/arch/vax/crtbegin.S
> @@ -132,7 +132,7 @@ END(__do_global_dtors_aux)
>
>         .hidden __do_global_ctors_aux
>
> -_ENTRY(__do_global_ctors_aux, 0x0800)
> +_ENTRY(__do_global_ctors_aux, 0x0100)   /* save r8 */
>         tstb    __initialized
>         bneq    4f
>         movb    $1, __initialized
> --
> 2.20.1
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.