g2gps opened a new issue, #8886: URL: https://github.com/apache/nuttx/issues/8886
I've been experimenting with building the some of the risc-v targets, primarily on `boards/risc-v/litex/arty-a7` and `boards/risc-v/qemu-rv` with newer versions of the [riscv-gnu-toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain). The intention being to enable some of the newer language features, and a more recent version of libcxx (#8244). I've noticed that some toolchain configurations, particularly when musl is used, generate elfs which contain relocations involving a global offset table (GOT). From what I can see in `binfmt/libelf`, there's currently no support for relocations through a GOT, either during loading or at the architecture level (`libs/libc/machine/*/arch_elf.c`). I've seen comments in `boards/sim/sim/sim/scripts/Make.defs` regarding using `-fno-pic` to avoid a GOT being generated, so possibly this is by design, and I'm overlooking something more fundamental here. Currently, it seems that building the toolchain with newlib avoids a GOT being generated at all for the applications I've tested. However, I'm not sure if this is the case in general. Perhaps someone has some insight on this? The toolchain configuration which currently works: ``` $ riscv32-unknown-elf-gcc -v Using built-in specs. COLLECT_GCC=riscv32-unknown-elf-gcc COLLECT_LTO_WRAPPER=/home/xx/projects/riscv-gnu-toolchain/bin/libexec/gcc/riscv32-unknown-elf/12.2.0/lto-wrapper Target: riscv32-unknown-elf Configured with: /home/xx/projects/riscv-gnu-toolchain/build/../gcc/configure --target=riscv32-unknown-elf --prefix=/home/xx/projects/riscv-gnu-toolchain/bin --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion=g2ee5e430018 --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/xx/projects/riscv-gnu-toolchain/bin/riscv32-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=/home/xx/projects/riscv-gnu-toolchain/gcc --disable-multilib --with-abi=ilp32 --with-arch=rv32imac --with-tune=rocket --with-isa-spec=2.2 'CFLAGS_FOR_TARGET=-Os -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medany' Thread model: single Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (g2ee5e430018) ``` The same configuration with musl generates a GOT and relocation relative to it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org