Checking is unexpected when cross compiling libstdc++ for RISCV

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jun 12 06:46:29 GMT 2023


On Mon, 12 Jun 2023 at 04:19, Jerry Lin wrote:
>
> Hi, there,
>
> I am using https://github.com/riscv-collab/riscv-gnu-toolchain to build a RISCV toolchain. I redirected the newlib link in riscv-gnu-toolchain repo to a local customized version by `--with-newlib-src` configure option.
> However, when checking `getentropy` in build-gcc-newlib-stage2 step, the checking command is not expected.
> In config.log we can see the checking command is:
> ######################
> configure:75532: checking for getentropy
> configure:75551:  /local/jerry/llvm-test-suite/Phoenix/working/riscvgnutoolchain/build/build-gcc-newlib-stage2/./gcc/xgcc -shared-libgcc -B/local/jerry/llvm-test-suite/Phoenix/working/riscvgnutoolchain/build/build-gcc-newlib-stage2/./gcc -nostdinc++ -L/local/jerry/llvm-test-suite/Phoenix/working/riscvgnutoolchain/build/build-gcc-newlib-stage2/riscv64-unknown-elf/libstdc++-v3/src -L/local/jerry/llvm-test-suite/Phoenix/working/riscvgnutoolchain/build/build-gcc-newlib-stage2/riscv64-unknown-elf/libstdc++-v3/src/.libs -L/local/jerry/llvm-test-suite/Phoenix/working/riscvgnutoolchain/build/build-gcc-newlib-stage2/riscv64-unknown-elf/libstdc++-v3/libsupc++/.libs -B/local/jerry/llvm-test-suite/Phoenix/lt-release/riscv64-unknown-elf/bin/ -B/local/jerry/llvm-test-suite/Phoenix/lt-release/riscv64-unknown-elf/lib/ -isystem /local/jerry/llvm-test-suite/Phoenix/lt-release/riscv64-unknown-elf/include -isystem /local/jerry/llvm-test-suite/Phoenix/lt-release/riscv64-unknown-elf/sys-include    -c -Os   -mcmodel=medlow  conftest.cpp >&5
> configure:75551: $? = 0
> configure:75583: result: yes
> #######################
> In fact, I expect the right command is without `-c` option. And the right compile command without `-c` option should fails with message `undefined reference to `getentropy'`. The expected checking result is `no`.
>
> I wanna ask how can I remove the `-c` option and which option controls it.


Is this a cross-compiler? We do not do link tests for cross-compilers,
so I think it's expected that if the function is declared in the
header then configure detects it as present.

I think it's been suggested that for some cross-compilers with a
linker that is known to work we could do link tests, but that would
require changes to how libstdc++ is confiured.


More information about the Libstdc++ mailing list