Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including a linker script with a built in target #72034

Closed
overdrivenpotato opened this issue May 9, 2020 · 1 comment
Closed

Including a linker script with a built in target #72034

overdrivenpotato opened this issue May 9, 2020 · 1 comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-target-specs Area: Compile-target specifications O-MIPS Target: MIPS processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@overdrivenpotato
Copy link
Contributor

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?

@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries A-target-specs Area: Compile-target specifications T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-MIPS Target: MIPS processors labels May 9, 2020
@overdrivenpotato
Copy link
Contributor Author

Closing for now, opted to use a temporary file in #72062.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-target-specs Area: Compile-target specifications O-MIPS Target: MIPS processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants