Skip to content

rustc_target: Add support of Openembedded/Yocto Linux ppc64 and ppc64… - #164866

Open
jkrishnanjanappa wants to merge 1 commit into
rust-lang:mainfrom
jkrishnanjanappa:main
Open

jkrishnanjanappa wants to merge 1 commit into
rust-lang:mainfrom
jkrishnanjanappa:main

Conversation

@jkrishnanjanappa

Copy link
Copy Markdown

rustc_target: Add support of Openembedded/Yocto Linux ppc64 and ppc64le targets

While building Rust standard libraries in Yocto, these targets use Openembedded-specific target triplets which are absent in the supported target list. Due to which Rust standard libraries build fails in Yocto.

The Openembedded-specific target triplets of ppc64 and ppc64le use linker and other settings similar to existing ppc64 and ppc64le Linux GNU targets respectively. So, add Openembedded-specific target triplets for ppc64 and ppc64le to build Rust libraries in Yocto.

…le targets

While building Rust standard libraries in Yocto, these targets use
Openembedded-specific target triplets which are absent in the
supported target list. Due to which Rust standard libraries build fails in Yocto.

The Openembedded-specific target triplets of ppc64 and ppc64le use linker
and other settings similar to existing ppc64 and ppc64le
Linux GNU targets respectively. So, add Openembedded-specific target triplets
for ppc64 and ppc64le to build Rust libraries in Yocto.

Signed-off-by: Jagadeesh Krishnanjanappa <workjagadeesh@gmail.com>
@rustbot

rustbot commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 24, 2026
@rustbot

rustbot commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @oli-obk (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 17 candidates

@oli-obk

oli-obk commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

hmm... if you're building your own libstd anyway, can't you use the custom target scheme to add your targets?

Do you have some links to where you're using this?

@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 26, 2026
@jkrishnanjanappa

jkrishnanjanappa commented Oct 28, 2026 •

Copy link
Copy Markdown
Author

hmm... if you're building your own libstd anyway, can't you use the custom target scheme to add your targets?

I am building libstd-rs, which is a part of a distribution image using the Yocto project.
The recipe that builds libstd-rs is at
https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rust/libstd-rs_1.98.1.bb?id=4ded97c2905d1c4ec7911d904cad3a5fce98255f

The steps to build libstd-rs can be found at,
https://docs.yoctoproject.org/dev-manual/poky-manual-setup.html#use-git-to-clone-the-layers
https://docs.yoctoproject.org/dev-manual/poky-manual-setup.html#building-your-image

Do you have some links to where you're using this?

The libstd build failed without this change for ppc64 and ppc64le. On debugging, I found other OE (openembedded) supported targets
https://github.com/search?q=repo%3Arust-lang%2Frust+oe_linux&type=code already present in the code. So I thought of adding similar change for ppc64 and ppc64le.

Regards,
Jagadeesh

@jkrishnanjanappa

Copy link
Copy Markdown
Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 30, 2026
@oli-obk

oli-obk commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

r? @davidtwco who seems to actually understand what is happening here 😅

#157650 (comment)

@rustbot rustbot assigned davidtwco and unassigned oli-obk Oct 30, 2026
@jkrishnanjanappa

jkrishnanjanappa commented Oct 31, 2026 •

Copy link
Copy Markdown
Author

While building libstd-rs recipe ( https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rust/libstd-rs_1.98.1.bb?id=4ded97c2905d1c4ec7911d904cad3a5fce98255f ) for powerpc64 using Openembedded/Yocto project, the following error is observed as there are no powerpc64-oe-linux-gnu target.

  error: error loading target specification: invalid PowerPC64 big-endian ABI name and `cfg(target_abi)`    combination:
         ABI name: elfv1
         cfg(target_abi):
    |
    = help: run `rustc --print target-list` for a list of built-in targets
    = help: did you mean `powerpc64-unknown-linux-gnu`?

If we specify "--target powerpc64-unknown-linux-gnu" to workaround the missing target, the build again fails with the following error. The rust built-in powerpc64-unknown-linux-gnu target use "cc" as linker where as openembedded/Yocto cross-compilation toolchain use custom powerpc64-oe-linux-gcc as linker.

error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `std` (lib) due to 1 previous error

The same behavior is true for powerpc64le using openembedded/Yocto cross-compilation toolchain.

This PR solves both the errors.

The discussions at #157650 and https://rust-lang.zulipchat.com/#narrow/channel/557100-yocto/topic/custom.20targets/near/594790061 helped me to understand the linker selection between powerpc64-unknown-linux-gnu and powerpc64-oe-linux-gnu.

Thanks,
Jagadeesh

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants