Description
Hello! I'm filing an issue here after being redirected through Discord and Zulip. I'm trying to add support for a new target which requires an associated linker script. I can confirm it works locally with rust-lld
and a custom JSON target file. I can't seem to find a way to add this linker script to rustc, so I am asking for help.
For context, the platform is the Sony PSP. It's essentially a bare metal mips2
target which requires a custom linker script for special .rodata.xyz
sections which cannot be merged into .rodata
. These sections store module information such as the module entry point, and the platform uses these for linking to system libraries as well.
Here is an example of the linker script that the platform needs. Note the special handling of the .rodata.sceNid
section, for example.
The PSP homebrew community does not seem to care about adding LLVM support for C/C++, rather they are focused on a GCC-based toolchain, so there is no real demand to merge this upstream in LLVM. Besides this, LLVM can correctly compile object code for this target, it only needs this special linker script for the final executable section layout.
I am familiar enough with the codebase to add this target spec, but how can I embed this linker script along with it?