Closed Louisyoung056 closed 3 years ago
The compiler will accept any reasonable arch/abi combination, but the precompiled libraries will only be compiled for the default arch/abi specified at configure time. You can getting an error linking against the precompiled libraries as they were built with a different arch/abi then you specified on the command line.
You can use --enable-multilib at configure time which will build multiple arch/abi versions of the precompiled libraries, but it only builds a subset of them. There are far too many possibilities to be reasonable to build all of them. So this will help only if you are using one of the arch/abi combinations in the default set. rv32imc/ilp32 is not in the default set, but we have a re-use rule that tells gcc to link witih the rv32im/ilp32 precompiled library. If that is OK for you, then --enable-multilib will work for you.
Otherwise, you should specify --with-arch= and --with-abi= at configure time to get a toolchain that directly supports your arch/abi choice directly.
The compiler will accept any reasonable arch/abi combination, but the precompiled libraries will only be compiled for the default arch/abi specified at configure time. You can getting an error linking against the precompiled libraries as they were built with a different arch/abi then you specified on the command line.
You can use --enable-multilib at configure time which will build multiple arch/abi versions of the precompiled libraries, but it only builds a subset of them. There are far too many possibilities to be reasonable to build all of them. So this will help only if you are using one of the arch/abi combinations in the default set. rv32imc/ilp32 is not in the default set, but we have a re-use rule that tells gcc to link witih the rv32im/ilp32 precompiled library. If that is OK for you, then --enable-multilib will work for you.
Otherwise, you should specify --with-arch= and --with-abi= at configure time to get a toolchain that directly supports your arch/abi choice directly.
Thanks for the advice! Problem solved using --enable-multilib
.
Hi,
I followed instructions on https://github.com/riscv/riscv-gnu-toolchain, installed the newest riscv-gnu-toolchain on my CentOS7 virtual machine, and successfully built the Newlib cross-compiler. According to the README, I should then be able to use riscv64-unknown-elf-gcc and its cousins.
But it shows error message like this when I try to compile my C program(test.c) into machine code:
Commands:
riscv64-unknown-elf-gcc -mno-relax -march=rv32imc -mabi=ilp32 -nostartfiles -std=gnu11 -mstrict-align -mno-div -O0 crt.s test.c -T linker.s -o program.elf
Error message:
Is there something wrong with the arguments I added? Any help would be appreciated. Thanks!