Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 19 Sep 2019 15:10:18 -0400
From: Rich Felker <>
Subject: Re: [PATCH] mips: add single-instruction math functions

On Thu, Sep 19, 2019 at 09:26:18PM +0300, wrote:
> >> 2) -mabs=2008 application will work correctly with -mabs=legacy musl
> >> on a -mabs=2008 system.
> R> Are you sure? This seems to disagree with what you're saying below
> Yes, assuming they all were built with the same -mnan= option.
> The -mabs=2008 option has no ABI tag, it is just a compiler flag
> that controls how many instructions are used for |x| and -x.
> I think there is some optimisation flag in gcc that does exactly the
> same without declaring __mips_abs2008.
> Only -mnan=xxx consistency is enforced by the kernel basing on the
> corresponding bits in the ELF header and FCSR.
> But yes, IIUC kernel assumes nan2008 binary is abs2008 too though
> this has no deep (or whatever) meaning on cores with hard-wired
> feature bits in FCSR.

I guess I was assuming that if the two generally (always?) match in
the hardware, you'd necessarily be using nan2008 when using abs2008.

> R> musl supports multiple ecosystems in the same filesystem regardless of
> R> whether a cpu does; that's the whole point of supporting even multiple
> R> unrelated archs like mips and arm or x86 and riscv and why they all
> R> have differing ldso names. For example you can be running the foreign
> R> ISA via qemu-user with binfmt_misc or explicitly.
> OK. Though qemu-user has -L option for things like this.

Indeed you can use -L in the qemu-user case, but there are plenty of
other situations like shared rootfs across network or with qemu-system
guests. In any case, ability for different archs and subarchs (ABIs)
to coexist in the same filesystem regardless of any relationship or
non-relationship between them has always been part of musl.

> R> In that case, it seems like the kernel would refuse to load
> R> -mabs=legacy binaries on nan2008 hardware, gratuitously due to
> No, no. The kernel only knows -mnan=xxx status for binary.
> All this mess is because architecture spec defines these features as
> distinct, compilers have independent options for them (gcc even has
> --with-nan= in ./configure but no --with-abs=), kernel code is
> written like it can change FCSR bits etc.
> It reality these bits are always either both zero (non-existant on
> <= R3) or both set in hardware and only NAN2008 FCSR bit has
> reflection in the ELF header flags.

In that case it seems like using abs2008 as you've proposed does not
make the situation any worse than it might already be.


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.