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

Programming, for all ages and all languages.
Post Reply
Krotti83
Posts: 2
Joined: Mon Jan 06, 2025 8:30 am

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

Post 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...
Octocontrabass
Member
Member
Posts: 5655
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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.
Post Reply