On 11/15/24 8:31 AM, Dimitar Dimitrov wrote:
When configuring GCC for RV32EC with: ./configure \ --target=riscv32-none-elf \ --with-multilib-generator="rv32ec-ilp32e--" \ --with-abi=ilp32e \ --with-arch=rv32ec Then the build fails because division is erroneously left enabled: cc1: error: '-mdiv' requires '-march' to subsume the 'M' extension -fself-test: 8412281 pass(es) in 0.647173 seconds Fix by disabling MASK_DIV if multiplication is not available and -mdiv option has not been explicitly passed. Tested the above RV32EC-only toolchain using the GNU simulator: === gcc Summary === # of expected passes 211635 # of unexpected failures 3004 # of expected failures 1061 # of unresolved testcases 5651 # of unsupported tests 18958 The high number of failures is due to unrelated testsuite issue PR117603. Ok for trunk once CI is green? gcc/ChangeLog: * config/riscv/riscv.cc (riscv_override_options_internal): Set division option's default to disabled if multiplication is not available. Signed-off-by: Dimitar Dimitrov <dimi...@dinux.eu> --- Changes in v2: - Do not forcefully tie MUL and DIV in riscv_ext_flag_table. That causes the gcc.target/riscv/predef-7.c case to fail when M extension is available but -mno-div option is explicitly set: ... -march=rv32em -mabi=ilp32e -mno-div ...
OK jeff