|
|
Message-ID: <CAFTrK=r-hVntu+efCEX-4CztnRMOxY3yGNtuhXU8MiYgz7HLwg@mail.gmail.com>
Date: Sat, 14 Nov 2026 21:14:37 +0000
From: Graeme Harker <graeme.harker@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] m68k: fix soft-float build of setjmp and longjmp
On Fri, 13 Nov 2026 at 18:40, Rich Felker <dalias@...c.org> wrote:
> Is there an ABI document that covers the softfloat ABI? In particular,
> when archs have softfloat ABIs it's important to check whether, when
> running them on a cpu that does have hard float, the floating point
> registers are all call-clobbered, or whether some are "call-saved if
> present" like on arm.
I don't know of an ABI document for it; the SVR4 m68k supplement
assumes a 68881. What there is, is GCC's behaviour, and there it is
the former: there is no equivalent of arm's softfp, where code built
for the soft-float calling convention may still use fpu registers.
- -msoft-float, -mhard-float and -m68881 all act on one mask bit
(HARD_FLOAT in m68k.opt), so a translation unit is one or the other.
- With hard float off, m68k_conditional_register_usage() in m68k.cc
marks every fpu register fixed, so the compiler never uses one.
gcc 15.2.0 rejects an explicit 'register double x asm("fp2")' under
-msoft-float.
- The two are already different ABIs, not one ABI with optional
registers: with -m68881 a float, double or long double is returned
in %fp0, with -msoft-float in %d0/%d1. The comment on
m68k_libcall_value() says so: "It also makes -msoft-float code
incompatible with hard-float code, so people have to be careful not
to mix the two."
So no soft-float caller can have a live value in fp2-fp7 across
setjmp, on any cpu, and __HAVE_68881__ is the same condition
arch/m68k/reloc.h uses to pick ld-musl-m68k-sf.so.1.
One caveat: nothing in the ELF file records which of the two an
object uses (e_flags is 0 for both, and ld links them together
without complaint), so a hard-float object linked against an -sf libc
is not caught at link time. It is broken in any case, for every
function that returns a floating-point value, not only for setjmp.
Graeme
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.