-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow RISC-V ABI to be configured by mabi #4322
Conversation
LGTM |
Co-authored-by: Johan Engelen <jbc.engelen@gmail.com>
It's OK like this, but you could merge all lit tests into one file, and then use --check-prefix to have different CHECKs per FileCheck invocation. |
This probably breaks building druntime. core/thread/osthread.d(1594):1:2: error: instruction requires the following: 'D' (Double-Precision Floating-Point) |
I think the builder should just be updated to compile with |
When configured for riscv64 the default should always be rv64gc. |
I think that would be reasonable if there were a way to specify the exact RISC-V extensions to use using a flag like Currently with LDC, if the default were changed to be |
This PR allows the RISC-V ABI to be configured by the user. RISC-V has the following ABIs:
lp64
,lp64f
,lp64d
(64-bit only), andilp32
,ilp32f
,ilp32d
(32-bit only). See here for a slightly more detailed description, and here for the GCC documentation on this.The latest LDC release changed the default 64-bit ABI from
lp64
tolp64d
. I think the default should continue to belp64
because it is the most basic, and additional features/extensions should be opt-in (this PR changes back tolp64
default). The latest release also enabled the D extension by default. This PR undoes that and leaves the D extension as opt-in (with-mattr=+d
), just like every other extension.The ABI is now configurable using
-mabi=...
instead of hard-coding tolp64d
. Themabi
option is also no longer hidden. The default ABI on riscv64 is nowlp64
and on riscv32 isilp32
. Also, the backend linker now gets passed the appropriatemabi
flags andmarch
flags. Instead of hard-coding tomabi=lp64d
andmarch=rv64gc
(only for 64-bit though), now the value passed viamabi
is used (or the default ABI), andmarch
is properly constructed from the enabled features (passed viamattr
). For example, to compile forrv64gc
(shorthand forrv64imacfdc_zicsr_zifencei
) withlp64d
one would now pass:The backend linker/gcc driver would be passed
-march=rv64gc -mabi=lp64d
. Here are some other examples:Since Phobos probably needs to be built with
rv64gc
andlp64d
the flags used to invoke the build should beI'm not sure if code in other repos needs to be changed as a result of this.
Fixes #4321.