Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CALqyXLj9kKBm+QvVNs8_DgH-8NvdBHfdPDN4ZDSFhjCTktxHMA@mail.gmail.com>
Date: Wed, 20 Nov 2024 20:26:23 -0600
From: Jesse DeGuire <jesse.a.deguire@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH] Add additional __ARM_FP checks to ARM FPU math functions

Hi everyone!

I found that I was getting compiler errors when I try to build Musl
for an ARMv8.1M Mainline target that does not have floating-point
support but does have the M-Profile Vector Extensions (MVE). The
errors were that Musl wanted to use unsupported floating-point
instructions for fabsf() and sqrtf().

I was able to correct this by adding checks for (__ARM_FP & 4) to the
ARM "fabsf.c" and "sqrtf.c" files, which is all this tiny patch does.

The relevant options I used with Clang were "-march=armv8.1m.main+mve
-mfpu=none -mfloat-abi=hard". MVE uses the FP register file, but
treats them as 8 128-bit registers instead of 16 64-bit registers, so
presumably that's why the hard float ABI is used even when
floating-point operations are not enabled. In this case, an
integer-only subset of MVE is used.

Here is a Godbolt link that shows that you can make this happen on GCC, too.
https://www.godbolt.org/z/Mf4h489s8

I'm not sure if this is totally necessary since I suspect this would
affect only ARM M-Profile devices, but maybe it at least wouldn't hurt
to have.

Thanks,
Jesse DeGuire

Download attachment "arm_fp_check.patch" of type "application/octet-stream" (664 bytes)

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.