mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Rob Landley <rob@landley.net>
Cc: musl@lists.openwall.com, libc-alpha@sourceware.org,
	linux-sh@vger.kernel.org
Subject: Re: SH sigcontext ABI is broken
Date: Wed, 24 Jun 2015 14:03:01 -0400	[thread overview]
Message-ID: <20150624180301.GT1173@brightrain.aerifal.cx> (raw)
In-Reply-To: <558A587A.2010400@landley.net>

On Wed, Jun 24, 2015 at 02:12:58AM -0500, Rob Landley wrote:
> I've lost the plot here, is what I"m saying.

OK, I'll try to get us back on it then.

To begin with, let's put aside musl, revival of SH, and anything new
and just look at the existing situation.

Right now, SH3 or SH4-nofpu binaries are ABI-incompatible with SH4
kernels. This incompatibility is in a place very few applications are
going to use or care about, but it's essential for musl and it's going
to be essential for glibc once they get around to fixing cancellation.

Likewise, SH2 binaries are incompatible with SH2A kernels and SH4
kernels.

I can't imagine this being intentional. While the original SH2 work
was not intended to produce binaries capable of running on later
models, SH3 and SH4 were treated like a normal MMU-ful Linux arch,
where it should aways be possible to run a binary built for cpu
revision M on an actual cpu revision N, where M<=N.

Since our new SH2 binaries (using ELF, musl, and possibly glibc if the
port is not dropped) are also going to be compatible with running on
later MMU-ful hardware (e.g. J4), I don't want this same issue to be a
point of breakage for them.

The userspace SH2 ABI is nofpu (no float registers for float args), so
there is already a separate userspace ABI for SH2 (and SH3) vs the
usual SH4 ABI with float. That's not a problem. Dynamic linked
binaries have their own separate shared library ecosystem, and for
static linked binaries, there's no userspace ABI boundary left once ld
runs. However kernel-user ABI breakage is a show-stopper. It means
that, even if you had the right ldso and libraries for nofpu SH2
binaries, you couldn't safely run them on SH4 because the kernel would
give you the wrong ucontext_t layout.

If we want the SH-nofpu ABI to use the old nofpu ucontext_t layout,
then the kernel (and qemu-user) is going to need a way to detect
nofpu-ABI binaries and generate the right ucontext_t for them.

If we switch to using the same ucontext_t layout everywhere, the
kernel does not have to be smart, and the kernel ABI looks the same
for all SH variants, but old binaries (if they depend on ucontext_t
layout, which is _rare_ anyway) could break.

My leaning at this point, especially since you say SH3 is irrelevant,
is to use the same ucontext_t layout for them all (with the float reg
space empty for nofpu chips). If any real-world old apps break and
people care about them, we could make a personality that you set
manually for old-nofpu ucontext_t layout. But I suspect the issue will
just go away.

Rich


  reply	other threads:[~2015-06-24 18:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  7:09 Rich Felker
2015-06-19  7:41 ` Andreas Schwab
2015-06-19 19:12   ` Rich Felker
2015-06-19 19:57     ` [musl] " Andreas Schwab
2015-06-19 20:32       ` Rich Felker
2015-06-20  8:10         ` [musl] " Geert Uytterhoeven
2015-06-20 19:59           ` Rob Landley
2015-07-02 19:23             ` Maciej W. Rozycki
2015-07-02 22:51               ` Rob Landley
2015-07-03  6:43                 ` Andreas Schwab
2015-06-20 18:06 ` Rich Felker
2015-06-24  4:25   ` [musl] " Rob Landley
2015-06-24  4:52     ` Rich Felker
2015-06-24  7:12       ` [musl] " Rob Landley
2015-06-24 18:03         ` Rich Felker [this message]
2015-06-24  8:40           ` Rob Landley
2015-06-24 21:34             ` Rich Felker
2015-06-24 22:32               ` Rob Landley
2015-06-24 23:26                 ` Bobby Bingham
2015-06-24 23:54                 ` Rich Felker
2015-06-25  6:24               ` [musl] " Geert Uytterhoeven
2015-06-24 14:10       ` Joseph Myers
2015-06-24  8:23         ` Rob Landley
2015-06-24 18:12         ` Rich Felker
2015-06-24  9:14           ` Rob Landley
2015-06-24 22:02             ` Rich Felker
2015-06-24 19:37           ` Joseph Myers
2015-06-24 20:08             ` Rich Felker

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=20150624180301.GT1173@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=musl@lists.openwall.com \
    --cc=rob@landley.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).