mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Cortex-M support
Date: Wed, 12 Sep 2018 21:24:10 -0400	[thread overview]
Message-ID: <20180913012410.GD1878@brightrain.aerifal.cx> (raw)
In-Reply-To: <97041122-710c-0b4c-d4de-d89d87a9ee83@phoenixsoftware.it>

On Thu, Sep 13, 2018 at 03:06:52AM +0200, Pierluigi Passaro wrote:
> This looks a good starting point: I'm targeting Cortex-M4 / M7 and
> maybe Cortex-R.
> I'm inspecting the code and trying to get a build.
> I have a few questions:
> 
> 1) NOMMU support looks disabled
> I'm wondering if in the file arch/arm/reloc.h, some code should be
> added (or not).
> Somthing like
>    #if (__ARM_ARCH_PROFILE == 'M') || (__ARM_ARCH_PROFILE == 'R')
>    #define DL_NOMMU_SUPPORT 1
>    #endif

This is only going to matter if you want to do dynamic linking, which
is *really* bad without fdpic/shared-text. You'll have a whole copy of
each shared lib for each process. Once fdpic support is added and
dynamic linking makes sense, it should probably be fixed, but I'd like
to rethink some of this and make it so the dynamic linker doesn't need
to be aware of whether it's nommu-compatible.

> 2) trying to enable hardfp support, the build fails
> - fabs try calling vabs.f64 assembly instruction
> - sqrt try calling vsqrt.f64 assembly instruction
> As far as I understood, vXXX.f64 instructions are only available
> with single/double precision FPU, not with half precision.
> I'm wondering if the assembly optimization should be wrapped by
> something like
>    #if ... && (__ARM_FP > 7)
> 
> I'm still trying to setup a reasonable build/test environment, but I
> suppose I need some suggestions on how to proceed.
> Any hints?

Configurations where float and double are anything other than IEEE
single and double with IEEE-conforming semantics, or where long double
does not have IEEE-conforming semantics, are not supported/supportable
by musl, by intent. I would assume there's some way to configure the
compiler to offer a separate half-precision hardfloat type on an
otherwise soft-float EABI target with conforming float/double, but if
not this is a compiler deficiency that makes it impossible to use at
this time.

There were some SH4 models that also had this limitation (only
single-precision FPU) and since GCC's only profile for them redefines
double as single, rather than doing hard-single and soft-double, we
just don't support hardfloat at all on them.

In principle you could build musl as soft-float (with a softfloat
toolchain) but use a separate toolchain with half-precision hardfloat
for your applications. There would be no way to call stdlib interfaces
that take floating point arguments without a glue layer though. Use of
setjmp/longjmp might also be problematic (failure to restore float
regs) but this could possibly be mitigated.

Rich


  reply	other threads:[~2018-09-13  1:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13  0:39 Pierluigi Passaro
2018-09-13  0:41 ` Christopher Friedt
2018-09-13  0:52   ` Rich Felker
2018-09-13  1:06     ` Pierluigi Passaro
2018-09-13  1:24       ` Rich Felker [this message]
2018-09-13  9:43         ` Szabolcs Nagy

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=20180913012410.GD1878@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.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.
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).