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

Multilib compiler triple does not match documentation #296

Closed
asb opened this issue Nov 16, 2017 · 6 comments
Closed

Multilib compiler triple does not match documentation #296

asb opened this issue Nov 16, 2017 · 6 comments

Comments

@asb
Copy link

asb commented Nov 16, 2017

The README states "The multilib compiler will have the prefix riscv-unknown-linux-gnu-, rather than the usual prefix (riscv32-... or riscv64-...)." After ./configure --prefix=/path/to/install --enable-multilib; make linux I'm seeing tools built with the riscv64-unknown-linux-gnu prefix.

@jim-wilson
Copy link
Collaborator

It looks like this changed 2 years ago. With these two patches
df81277
d36be56
I will have to do a little more research to verify.

It would be possible to fix this by changing the name of the installed compiler, which doesn't have to exactly match the configure tuple. However, given that we have apparently been doing it this way for 2 years, it is probably just better to fix the docs to match the code.

@palmer-dabbelt
Copy link
Contributor

I think it's better to fix the docs.

palmer-dabbelt added a commit that referenced this issue Nov 16, 2017
@asb
Copy link
Author

asb commented Nov 16, 2017

It's the easier fix, but I'm not sure it's the best one. Isn't riscv64-unknown-linux-gnu a fundamentally confusing triple for an rv32/rv64 multilib toolchain?

@palmer-dabbelt
Copy link
Contributor

I think the problem is that based on the existing conventions, there's going to be some confusion somewhere. Since most architectures don't support 64-bit output from their 32-bit targets, if we called it "riscv-" then people would say "where's your 64-bit compiler". The only target that doesn't support 32-bit output from their 64-bit toolchain is ARMv8, and I'd argue that's just because there is no aarch32 compiler ("arm-" is a v7 compiler).

Since all the RISC-V tuples do the same thing, people can just call them whatever they want. We should probably go add a "riscv-* -> riscv32-*" alias in gnuconfig so distros can ship whatever they want, but I don't want to change what we're building here because it'll cause a bunch of headaches for no real gain.

@asb
Copy link
Author

asb commented Nov 16, 2017

I suppose it depends on whether you mentally expand "riscv" to "riscv32" or "riscv??", and whether it really does seem logical to invoke a riscv64 toolchain to build for a strictly riscv32 target. I think Mips ended up with a mips-img-linux-gnu triple for their very multi-libbed toolchain.

Anyway, I was just writing the Clang driver code for pulling multilibs out of an existing gcc install or sysroot and thought I'd double check the intention here.

@jim-wilson
Copy link
Collaborator

It is possible to build a multilib riscv32 toolchain. The riscv-gnu-toolchain project does not currently support that, but it would be easy to add. It should be a simple change to the toplevel configure file to add 32-bit multilib lists for 32-bit configure tuples.

The arm-* compilers can emit v8 aarch32 code, which is very similar to v7 code.

The mips-img-linux-gnu target is an interesting example. I hadn't realized that they had changed their naming scheme to drop the 32/64. If wanted to do the same for riscv though, we would need patches for binutils, gdb, gcc, etc. It is simpler to just document how the sources actually work.

If someone wants to name their toolchain riscv-* they are certainly able to do that. The riscv-embed project does this for instance.

palmer-dabbelt added a commit that referenced this issue Nov 16, 2017
Cooper-Qu pushed a commit to T-head-Semi/xuantie-gnu-toolchain that referenced this issue Dec 19, 2023
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