Skip to content
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

How can user find out what extensions supported when use riscv-gnu-toolchain without a source code sight? #1101

Closed
pz9115 opened this issue Jul 15, 2022 · 5 comments

Comments

@pz9115
Copy link
Contributor

pz9115 commented Jul 15, 2022

When user use riscv-gnu-toolchain, a common problem is that they don't know what extensions was supported for their toolchain.

Should we add some features for toolchain that make user use more convenient.

@pz9115 pz9115 changed the title How can user find out which extension supported when use riscv-gnu-toolchain without a source code sight? How can user find out what extensions supported when use riscv-gnu-toolchain without a source code sight? Jul 15, 2022
@cmuellner
Copy link
Collaborator

For me the output of gcc -v is enough to find the corresponding sources.
However, I agree that this is not a user-friendly way.

What helps with ABIs and code models is gcc --target-help, but this does not list all acceptable march substrings.

BTW, AArch64 supports this:

echo | aarch64-linux-gnu-gcc -march=armv8.42-a -dM -E -
cc1: error: unknown value ‘armv8.42-a’ for ‘-march’
cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8-r; did you mean ‘armv8.2-a’?

And on x86 it is possible to get a list of supported march strings using gcc -v --help.

However, given the fact, that users can compose the march string on RISC-V, someone would have to write a patch, that collects all supported extensions and prints them (preferably as part of --target-help).

@kito-cheng
Copy link
Collaborator

A potential proposal is adding -mtune=?, -mcpu=? and -march=? to list all supported option for those options, clang already supported first 2 option, so I think it would be great create some issue on https://github.com/riscv-non-isa/riscv-toolchain-conventions

@kito-cheng
Copy link
Collaborator

Issue created riscv-non-isa/riscv-toolchain-conventions#24

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Oct 2, 2022

Maybe I'm looking at this too simplistically, but doesn't the following provide the required info?

riscv64-unknown-elf-gcc -dumpspecs | grep arch
--traditional-format %(subtarget_asm_debugging_spec) %{fpie|fPIE|fpic|fPIC:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig-endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
-melf%{march=rv32*:32}%{march=rv64*:64}lriscv %{mno-relax:--no-relax} %{mbig-endian:-EB} %{mlittle-endian:-EL} %{shared}
march=rv64imafdv_zve32f_zve32x_zve64d_zve64f_zve64x_zvl128b_zvl32b_zvl64b mabi=lp64d

riscv64-unknown-elf-gcc -print-multi-lib
...

That provides the default arch/abi for the toolchain (last line of the grepped -dumpspecs ouput) and the set of other arch/abi pairs supported by the available multilibs.

Edit: I just noticed that the output from -v does not correctly correspond to the output from -dumpspecs (rv64gc versus rv64imafdv_zve32f_zve32x_zve64d_zve64f_zve64x_zvl128b_zvl32b_zvl64b respectively):

riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=./riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/home/tommy/Downloads/riscv-tools/rvv64/installed-tools/libexec/gcc/riscv64-unknown-elf/12.0.1/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /home/tommy/Downloads/riscv-tools/rvv64/riscv-gcc/configure --target=riscv64-unknown-elf --prefix=/home/tommy/Downloads/riscv-tools/rvv64/installed-tools --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion= --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/tommy/Downloads/riscv-tools/rvv64/installed-tools/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=.././riscv-gcc --disable-multilib --with-abi=lp64d --with-arch=rv64gv --with-tune=rocket --with-isa-spec=2.2 'CFLAGS_FOR_TARGET=-Os   -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os   -mcmodel=medlow'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220505 (prerelease) () 

This may be a separate issue relating to the inference of some extensions over and above those specific in the --with-arch= configuration option?

@TommyMurphyTM1234
Copy link
Collaborator

No update in over a year and it seems to me that earlier posts explain how to obtain the relevant info so I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants