* Resolving ARM asm issues
@ 2015-11-05 22:03 Rich Felker
0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2015-11-05 22:03 UTC (permalink / raw)
To: musl
I've been working some more on resolving the issues with ARM asm. The
constraints I'm trying to simultaneously satisfy are:
1. Compatibility with all relevant binutils/gas and clang
internal-assembler versions.
2. Ability to produce arm or thumb code for the same asm source.
3. Avoiding tagging of object files as requiring a particular ISA
level or hard float above the level the user intended to build for.
The main places these are difficult are when we're conditionally
(based on hwcap) using instructions that may not be available in the
baseline ISA we're building for -- most notably, for setjmp/longjmp
handling of call-saved floating point registers and TLS and atomics.
Right now we are using .word to encode some instructions, which solves
1 and 3 but breaks 2.
Based on my testing so far, the "right" solution seems to be setting
and resetting .fpu/.arch _and_ using .eabi_attribute to clear unwanted
attributes that may result. My findings are:
- Clang does not output any unwanted attribute tags based on .arch or
.fpu; it requires them to be specified manually.
- Modern gas sets unwanted attributes automatically and does not clear
the FPU-related ones when using .fpu softvfp after the relevant
instructions, so manual clearing is necessary.
- The last GPLv2 gas (2.17+) fails to properly drop the unwanted
attributes even with expicit setting. I think we can either just
ignore them being wrong or patch it.
For setjmp, I have tested that all three accept the mnemonic:
vstmia ip!, {d8-d15}
once .fpu vfp is set.
For atomics, using .arch armv7-a is needed in order to allow
assembling them as thumb2. Both .arch armv4t and explicit reset of the
unwanted attributes are needed to avoid wrong ISA-level tags.
I still haven't done full testing on the fenv stuff, but since it only
affects armhf, I'm not as concerned about having it work well with
ancient toolchains, and it doesn't have to suppress vfp taging anyway.
So I think we can just switch to the vfp/ual mnemonics there and have
it work everywhere but on gas 2.17.
Even after resolving all these issues, there's still a good bit of
work to be done to make sure all the asm actually _can_ be built as
thumb2. But I think we can resolve the blocking issues.
Rich
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-05 22:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 22:03 Resolving ARM asm issues Rich Felker
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).