Skip to content

Including a linker script with a built in target #72034

Closed
@overdrivenpotato

Description

@overdrivenpotato

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-target-specsArea: Compile-target specificationsO-MIPSTarget: MIPS processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions