Page 1 of 1

GNU ld for RISCV bare metal targets without -shared/-pie support

Posted: Sat Jan 25, 2025 7:35 pm
by Krotti83
Hi!

Does somebody know, why the GNU ld developers disabled shared library and PIE support on RISCV bare metal targets (riscv64-none-elf)? I'm wondering why PIE is enabled on ARM bare metal targets, but not on RISCV.

I have enabled it in the sources from GNU ld, but currently not tested. The reason was I had big troubles with building Newlib with GCC with the riscv64-linux-gnu configuration. Doesn't worked, because the compilation from libgcc always failed (missing sys/ucontext.h header in libgcc/unwind-dw2.c). Tried also different configuration switches link --disable-libunwind and --disable-libunwind-exceptions, but no success. So I modified GNU ld...

Re: GNU ld for RISCV bare metal targets without -shared/-pie support

Posted: Sun Jan 26, 2025 1:12 am
by Octocontrabass
Why are those enabled for ARM? Bare metal targets can't support shared libraries or position-independent executables, those things depend on the C standard library and the C standard library depends on the OS.

Why are you trying to build Newlib? It'll be easier to figure out the "correct" way to do things if we know what you're trying to do.