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

Add powerpc-unknown-linux-musl target #45422

Closed
wants to merge 4 commits into from

Conversation

ArcaneNibble
Copy link

This is 100% untested, but this is essentially a copy-paste of #44779 now that there is actually an up-to-date non-bitrotten example of how to add a new target. Should close #42520.

Again, this is super untested because I don't even know how to build rust.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2017
@nikomatsakis
Copy link
Contributor

r? @alexcrichton -- I know nothing of this.

@alexcrichton
Copy link
Member

Thanks! Do you want to test this out before landing perhaps?

I think you can uncomment the if: branch = auto in the Travis config for the cross builder and that should run it as part of this PR. We'll back out those changes before landing though.

Also, would you be willing to help fix liblibc after this patch lands? Once this gets into nightlies we can start adding automation to the libc repo to assert that the bindings are all correct there.

@ArcaneNibble
Copy link
Author

Hmm, good call. It turns out that this is indeed broken thanks to PPC's silly double-double floating point. AFAICT Rust cannot use f128/f80/long-double at all, so I believe passing -mlong-double-64 to the musl build should be safe?

@ArcaneNibble
Copy link
Author

Er, apparently gcc also doesn't define __ppc__, but clang apparently does?

Apparently clang will define both __ppc__ and __powerpc__, but gcc only
defines __powerpc__. However, libunwind only looks for __ppc__.
As suggested by alexcrichton
@ArcaneNibble
Copy link
Author

Uh oh. It looks like libunwind's assembly isn't compatible with binutils (presumably only with llvm's assembler). How should we proceed from here?

@alexcrichton
Copy link
Member

Unsure! I don't know much about powerpc

@kennytm kennytm added E-help-wanted Call for participation: Help is requested to fix this issue. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. O-PowerPC Target: PowerPC processors and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 25, 2017
@shepmaster
Copy link
Member

Heya @rqou — have you had any time to make progress on this PR? Do you have any avenues on where to find information / help?

@ArcaneNibble
Copy link
Author

Since you asked, I tried to get libunwind to compile with clang and its integrated assembler, but that still does not work. I don't know how this was ever supposed to work, and I have no idea where to look next since nothing here seems to be documented. If you have any ideas, I will go and try them.

@ArcaneNibble
Copy link
Author

Of course, there's a brute force solution of replacing the assembly files with something gcc/binutils does accept, but I want to avoid doing that if possible.

@carols10cents
Copy link
Member

(please disregard the comment I just made on the wrong issue)

@rqou I'm asking around to try and find help for you on this, but I'm not sure who has powerpc knowledge :-/

@hlandau
Copy link

hlandau commented Nov 18, 2017

There are people who would be interested in powerpc64 and powerpc64le support for musl too. If it's just a copy/paste job which would introduce no additional issues (besides the pending ones above), maybe consider adding it to this PR?

@awilfox
Copy link
Contributor

awilfox commented Nov 18, 2017

  • I'm not exactly sure how you're building these thingies, but a musl gcc should never need explicit -mlong-double-64 and if it does there is a bug in the GCC build. --enable-decimal-float=no passed to GCC's ./configure should help.
  • Why is this being done in a file called build-arm-musl.sh? I would think build-ppc-musl.sh would be better, with possibly a common "library" shell file for the common code if you desire.
  • GCC and clang both seem to define __PPC__ here; the uncapital ones typically vary between version and compiler.
  • Why is libunwind being built with -gnu-gcc instead of -musl-gcc? I don't see how this could ever work.
  • The libunwind code at https://github.com/llvm-mirror/libunwind/blob/master/src/UnwindRegistersSave.S makes many assumptions about the layout of the registers. This probably won't work on ELFv2 at all, which is what musl uses for PowerPC 64-bit big endian (and what all libcs uses for PowerPC 64-bit little endian). That is probably okay, though, because it seems to assume registers are 4 bytes so it won't work on 64-bit PowerPC CPUs anyway.

If Rust truly requires LLVM libunwind to work, then it will require work upstream in LLVM to ever have working PowerPC musl targets.

@carols10cents
Copy link
Member

@rqou does @awilfox's comment make sense and help at all with how to move this forward?

@ArcaneNibble
Copy link
Author

ArcaneNibble commented Nov 27, 2017

Sorry, finals/projects weeks. Feel free to take this over if you really really want it done.

@bors
Copy link
Contributor

bors commented Dec 5, 2017

☔ The latest upstream changes (presumably #46499) made this pull request unmergeable. Please resolve the merge conflicts.

@shepmaster
Copy link
Member

As @rqou has said they are working on finals, let's let this ignore triage until 2018-01-01.

@aidanhs aidanhs 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 14, 2017
@kennytm kennytm 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 20, 2017
@alexcrichton
Copy link
Member

ping @rqou, just wanted to bring this back on radar!

@shepmaster
Copy link
Member

I hope finals went well, @rqou! Since we haven't heard from you in a few weeks, we are going to go ahead and close this for now to keep things tidy. If you have time to work on this again, we hope you will reopen this PR!

@shepmaster shepmaster closed this Jan 13, 2018
@shepmaster shepmaster added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 13, 2018
@halvors
Copy link

halvors commented Jan 17, 2023

@rqou What happened to this, seems this is still not supported, only as a Tier 3 target so practical unusable for development on powerpc. Could we please reopen this PR? Also see #106932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-help-wanted Call for participation: Help is requested to fix this issue. O-PowerPC Target: PowerPC processors S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: aarch64-unknown-linux-musl and powerpc-unknown-linux-musl binaries