Language C
Cross-compiling to riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32
Hi,
I’m using sonarqube to analyze a riscv elf build with -march=rv32i, -mabi=ilp32
Build-wrapper-win is working and in the compile_commands I see:
"arguments":[
"riscv64-unknown-elf-gcc",
"-march=rv32i",
"-mabi=ilp32",
"-msmall-data-limit=8",
"-mstrict-align",
"-mno-save-restore",
"-O2",
"-fmessage-length=0",
"-fsigned-char",
"-ffunction-sections",
"-fdata-sections",
"-Wall",
"-Werror",
"-g3",
...
Which is fine.
However, when I use sonar-scanner -X seems the march is correctly detected but not the mabi during probing the compiler.
11:24:47 08:24:47.239 DEBUG Java memory after lexical analysis (used, peak): 77, 169
11:24:47 08:24:47.263 INFO Compilation database was generated by build-wrapper 6.70.1
11:24:47 08:24:47.284 DEBUG Probing compiler: [riscv-unknown-elf-gcc\bin\riscv64-unknown-elf-gcc.exe, -x, c, --std, gnu11, -march=rv32i, -v, -dM, -E, -]
11:24:47 08:24:47.478 DEBUG stdout:
11:24:47
11:24:47 08:24:47.478 DEBUG stderr:
11:24:47 Using built-in specs.
11:24:47 COLLECT_GCC=riscv-unknown-elf-gcc\bin\riscv64-unknown-elf-gcc.exe
11:24:47 Target: riscv64-unknown-elf
11:24:47 Configured with: riscv64-unknown-elf-gcc-8.3.0-1.1/sources/riscv-gcc-8.3.0-1.1/configure --prefix=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc --infodir=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc/share/doc/info --mandir=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc/share/doc/man --htmldir=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc/share/doc/html --pdfdir=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc/share/doc/pdf --build=x86_64-unknown-linux-gnu --host=x86_64-w64-mingw32 --target=riscv64-unknown-elf --with-pkgversion='xPack GNU RISC-V Embedded GCC (Microsemi SoftConsole build)\x2C 64-bit' --with-bugurl=https://github.com/sifive/freedom-tools/issues --enable-languages=c,c++ --enable-mingw-wildcard --enable-plugins --enable-lto --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-threads --disable-tls --enable-checking=yes --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-riscv64-unknown-elf --with-sysroot=riscv64-unknown-elf-gcc-8.3.0-1.1/win32-x64/install/riscv64-unknown-elf-gcc/riscv64-unknown-elf --with-native-system-header-dir=/include --with-abi=lp64d --with-arch=rv64imafdc --disable-rpath --disable-build-format-warnings --with-system-zlib
11:24:47 Thread model: single
11:24:47 gcc version 8.3.0 (xPack GNU RISC-V Embedded GCC (Microsemi SoftConsole build), 64-bit)
11:24:47 COLLECT_GCC_OPTIONS='-std=gnu11' '-march=rv32i' '-v' '-dM' '-E' '-mabi=lp64d'
Is there any solution to pass the correct -mabi or fix probing?
Note, it seems to be a regression with 6.70, but before this, it was “working” because probing was not correctly detecting -march:
`‘-march=rv64imafdc’ ‘-mabi=lp64d’` instead of correct abi/arch