From: Cherry Mui <cherryyz@google.com>
To: Ian Lance Taylor <iant@golang.org>
Cc: "Andreas Schwab" <schwab@linux-m68k.org>,
"Ian Lance Taylor via Gcc-patches" <gcc-patches@gcc.gnu.org>,
gofrontend-dev <gofrontend-dev@googlegroups.com>,
"Sören Tempel" <soeren@soeren-tempel.net>
Subject: Re: [gofrontend-dev] Re: libgo patch committed: Use a C function to call mmap
Date: Tue, 20 Jun 2023 23:33:47 -0400 [thread overview]
Message-ID: <CAHpjNSJE3iVW+6yrKj7WP0pfxSaQ9ngd9cnuujDOkkBXJ0D+fA@mail.gmail.com> (raw)
In-Reply-To: <CAKOQZ8xwkvVe7CoK9EVKZvjDgRfOdDH0eBWximW2x6R0SVrneA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]
On Tue, Jun 20, 2023 at 3:37 PM Ian Lance Taylor <iant@golang.org> wrote:
> On Tue, Jun 20, 2023 at 11:35 AM Andreas Schwab <schwab@linux-m68k.org>
> wrote:
> >
> > On Jun 20 2023, Ian Lance Taylor via Gcc-patches wrote:
> >
> > > This libgo patches changes the runtime pacakge to use a C function to
> call mmap.
> > >
> > > The final argument to mmap, of type off_t, varies. In
> > > https://go.dev/cl/445375
> > > (https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604158.html)
> > > we changed it to always use the C off_t type, but that broke 32-bit
> > > big-endian Linux systems.
> >
> > This has nothing to do with big-endian, armv7 isn't big-endian.
>
> OK, but I think that it does have something to do with big-endian.
> The bug was that on some 32-bit systems it was passing a 64-bit value
> to a function that expected a 32-bit value. The problem didn't show
> up on 32-bit x86 because it is little-endian, and did show up on
> 32-bit PPC because it is big-endian. I guess the armv7 case was
> failing for a different reason.
I think there is a calling convention issue. On 32-bit ARM, for the case of
mmap, if the last argument is 32-bit, it is passed 4 bytes at sp+4. If it
is 64-bit, the offset is aligned and it is stored as 8 bytes at sp+8. So if
the callee tries to read at sp+4, it gets the wrong value, even for little
endian. On 32-bit x86 it doesn't seem to have that alignment padding.
prev parent reply other threads:[~2023-06-21 3:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 16:57 Ian Lance Taylor
2023-06-20 18:35 ` Andreas Schwab
2023-06-20 19:37 ` Ian Lance Taylor
2023-06-20 21:21 ` Andreas Schwab
2023-06-21 3:33 ` Cherry Mui [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=CAHpjNSJE3iVW+6yrKj7WP0pfxSaQ9ngd9cnuujDOkkBXJ0D+fA@mail.gmail.com \
--to=cherryyz@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
--cc=iant@golang.org \
--cc=schwab@linux-m68k.org \
--cc=soeren@soeren-tempel.net \
/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).