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

x32 port #1366

Merged
merged 7 commits into from Feb 20, 2021
Merged

x32 port #1366

merged 7 commits into from Feb 20, 2021

Conversation

nabijaczleweli
Copy link
Contributor

I played pretty loose with the statfs bit, hoping for CI to tell me if I broke something.

@nabijaczleweli
Copy link
Contributor Author

Should be g2g, will wait for review to squash.

Oddly, the test_fcntl::linux_android::test_vmsplice test that failed passes on amd64 for me?

@asomers
Copy link
Member

asomers commented Dec 29, 2020

Interesting. Are you actually using x32 with Rust? Last I heard, Linux was talking about dropping it.

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Dec 29, 2020

Well, I am running a full Debian x32 userland, with the only foreign packages being the kernel.

"With Rust"? Well, I only recently found the target in rustup, did a bare-bones port of nix, and hit a codegen bug almost immediately; LLVM (and, well, Rust: rust-lang/rust#59220) is still very much baby mode on x32, but I would love to be able to just™ target Rust there. It's currently not really viable, but I also see no reason why it wouldn't become viable in future.

As for Linux dropping it, I neither know nor care; it's a (low priority, but still) supported target of the Rust platform as it stands.

@nabijaczleweli
Copy link
Contributor Author

Rebased, squashed, includes @hvdijk's test fixes from #1384 (comment).

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Feb 8, 2021

pogue, it even builds on CI. @hvdijk mind testing on your set-up again?

@hvdijk
Copy link

hvdijk commented Feb 8, 2021

pogue, it even builds on CI. @hvdijk mind testing on your set-up again?

It passes testing here, except for unrelated issues, nice.

For completeness, the unrelated issues are:

  • test_vsock fails here because SockAddr::new_vsock(libc::VMADDR_CID_LOCAL, port) succeeds, just as it does on x86_64-linux-gnu.
  • test_af_alg_aead hangs here during read(). After attaching gdb and immediately detaching, the test passes. I do not know what is happening here, but it also happens here for x86_64-unknown-linux-gnu.
  • unistd::Group::from_gid fails because my system has no group named root.

@asomers
Copy link
Member

asomers commented Feb 13, 2021

@nabijaczleweli why don't you go ahead and add x32 to .cirrus-ci.yml and to the Tier 3 target list in the README?

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Feb 13, 2021

The tests fail typecheck at CAPGET and CAPSET, which are fixed in caps HEAD (lucab/caps-rs@f6178d0). I've bugged the caps maintainer to push out a new version, but besides that, this should be good to go.

@hvdijk
Copy link

hvdijk commented Feb 13, 2021

Just a heads up, tests are going to fail for x32 even with the updated caps-rs unless you have also patched rust's LLVM to include the x32 codegen fixes that are going to be in LLVM 12.

@nabijaczleweli
Copy link
Contributor Author

Hence why I only marked it for typecheck

@asomers
Copy link
Member

asomers commented Feb 13, 2021

Ouch. Well, we can't merge it like that. You can remove the CHECK_TESTS line from .cirrus-ci.yml, which will fix the caps failure. But what's this about a toolchain problem? At what point will that cause a failure?

@hvdijk
Copy link

hvdijk commented Feb 14, 2021

But what's this about a toolchain problem? At what point will that cause a failure?

LLVM has x32 codegen bugs that are only fixed in LLVM 12, but Rust, even nightly, is currently still based on LLVM 11. These codegen bugs affect Rust code badly. If you stick with what you get from rustup, then (after fixing the other problems) cargo test --target=x86_64-unknown-linux-gnux32 fails with:

error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/home/harald/rust-nix/target/x86_64-unknown-linux-gnux32/debug/deps/nix-0354ce9290eb8626` (signal: 11, SIGSEGV: invalid memory reference)

LLVM 12 already has its first release candidate out, so I do not expect it to take too long till we have an official version of Rust that generates correct x32 code. Until then, for actually running Rust code on x32, a built-from-source version of Rust is needed with LLVM 12's fixes applied.

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Feb 14, 2021

At the point where you run it and it fails to properly relocate and segfaults in a Funny Way™, at least that's what happened that time I built one of my programs.

Got rid of CHECK_TESTS, should I post another small PR adding it back when caps gets updated later, then?

@asomers
Copy link
Member

asomers commented Feb 15, 2021

Yes, please add a PR for that when it's ready. In the meantime, how about a CHANGELOG entry?

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Feb 15, 2021

Added CHANGELOG entry and re-added the tests typecheck with the bumped caps.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

asomers added a commit that referenced this pull request Aug 18, 2021
* I never removed 32-bit OSX and iOS targets that were removed from
  Cirrus in PR #1492 .
* I never added Fuchsia (PR #1285) .
* I never added illumos (PR #1394) .
* never added Linux x32 (PR #1366) .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants