public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>,
	Stafford Horne <shorne@gmail.com>,
	GLIBC patches <libc-alpha@sourceware.org>
Cc: Linux OpenRISC <linux-openrisc@vger.kernel.org>
Subject: Re: [PATCH 1/2] or1k: Add hard float support
Date: Tue, 16 Apr 2024 13:20:01 -0300	[thread overview]
Message-ID: <9870848e-0b2e-423f-8dd1-4bed6968aeda@linaro.org> (raw)
In-Reply-To: <b3bf9676-ddc2-48eb-9c94-7512281155a3@linaro.org>



On 16/04/24 11:53, Richard Henderson wrote:
> On 4/16/24 07:04, Adhemerval Zanella Netto wrote:
>> If I understond correctly the OpenRISC hard-float ABIs uses the same
>> parameter passing ABI from soft-fp, similar of what ARM does with
>> -mfloat-abi=softfp.  So the the shared objects built with/without
>> -mhard-float should be interoperable, assuming hardware has hard-fp
>> support.
>>
>> However it does solve the potential problem a binary built with softfp
>> loading a hardfp built shared object, or even trying to link with a
>> static object with different ABI (and assuming a hardware without
>> hard-fp support)..  It means that loader and ldconfig won't recognize
>> shared objects with different floating-point objects if they are installed
>> on the same system.
>>
>> I don't think we have a strong policy regarding this, and historical
>> there were ABI variants that followed this (like powerpc soft and hard),
>> but most ABIs that support soft/hard floating-point usually advertise it
>> through ElfXX_Ehdr::e_flags.
>>
>> For instance, with arm:
>>
>> $ cat << EOF > lib.c
>> float foo_float (float x, float y)
>> {
>>    return x + y;
>> }
>>
>> double foo_double (double x, double y)
>> {
>>    return x + y;
>> }
>> EOF
>> $ arm-glibc-linux-gnueabi-gcc -shared -o lib.so lib.c
>> $ readelf -h lib.so | grep Flags
>>    Flags:                             0x5000200, Version5 EABI, soft-float ABI
>> $ arm-glibc-linux-gnueabihf-gcc -shared -o lib.so lib.c
>> $ readelf -h lib.so | grep Flags
>>    Flags:                             0x5000400, Version5 EABI, hard-float ABI
> 
> The typical reason for wanting an e_flags bit is because those architectures want the parameter passing to change when floating-point registers are available.
> 
> But for OpenRISC there is no separate floating-point register set.  All floating-point operations use the same general-purpose registers as for all integer operations.  So there is no point in a new parameter passing ABI.

Right, it was not clear from patch without dig into the ABI documen
itself.  So the only thing I am not sure is the mcontext_t change.  
Other ABIs added a symbol version to proper handle it, so maybe 
OpenRISC would need something similar.

  reply	other threads:[~2024-04-16 16:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  7:40 [PATCH 0/2] OpenRISC glibc " Stafford Horne
2024-03-29  7:40 ` [PATCH 1/2] or1k: Add " Stafford Horne
2024-04-16 14:04   ` Adhemerval Zanella Netto
2024-04-16 14:53     ` Richard Henderson
2024-04-16 16:20       ` Adhemerval Zanella Netto [this message]
2024-04-16 19:56         ` Richard Henderson
2024-04-16 20:37           ` Stafford Horne
2024-03-29  7:40 ` [PATCH 2/2] build-many-glibcs.py: Add openrisc hard float glibc variant Stafford Horne

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=9870848e-0b2e-423f-8dd1-4bed6968aeda@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=richard.henderson@linaro.org \
    --cc=shorne@gmail.com \
    /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).