Porting rust on AIX

Hi,
I am working on porting rust on AIX (powerpc64 big endian). I use a nightly version of LLVM because AIX support is not yet on the stable version. I have rebuilt rust 1.49.0 on a PPC64 Linux (Fedora) using x.py. I have added a new triplet powerpc64-ibm-aix (according LLVM triplet), and the newly built rustc prints it when I type rustc --print target-list. I follow this way.

So, I am now trying to compile:

  • a minimal file on Linux, for AIX, using this rustc;
  • rustc and stdlib on Linux for AIX.

For the first point, rustc says he needs the standard library I have not built yet. I can reduce the work using no-std in order to use the core library only. However, the core library is not yet built for AIX. Do you have a way to bypass also the core library to compile a minimal file?

For AIX rustc and standard / core library, I face issues related to the not full port of LLVM on AIX:

Building stage1 std artifacts (powerpc64le-unknown-linux-gnu -> powerpc64-ibm-aix)
running: "/root/.rustup/toolchains/stable-powerpc64le-unknown-linux-gnu/bin/cargo" "build" "--target" "powerpc64-ibm-aix" "-j" "32" "--release" "--frozen" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/root/rpmbuild/BUILD/rust/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
   Compiling core v0.0.0 (/root/rpmbuild/BUILD/rust/library/core)
   Compiling rustc-std-workspace-core v1.99.0 (/root/rpmbuild/BUILD/rust/library/rustc-std-workspace-core)
   Compiling compiler_builtins v0.1.36
   Compiling libc v0.2.79
LLVM ERROR: XCOFF explicit sections not yet implemented.
error: unknown directive
  |
note: instantiated into assembly here
 --> <inline asm>:2:13
  |
2 |             .section .llvmbc,"e"
  |             ^

error: unknown directive
  |
note: instantiated into assembly here
 --> <inline asm>:3:13
  |
3 |             .section .llvmcmd,"e"
  |             ^
Did not run successfully: exit code: 101

We know XCOFF is not completely implemented. Do you have a way to workaround this?

Moreover, it is hard to find the minimal command to reproduce the bug: the commandline given after "running" has a different output if I run it directly. After set of the relevant variable, I have typically

error[E0554]: `#![feature]` may not be used on the stable release channel

I want the exact command and environment set by x.py for my report to the LLVM team. Moreover, with the right command, I will be able to add flags in order to check the assembler generated.

Regards.

You should ask thus question on zulip of compiler team.
On phone right now so I can't provide the link.

Several people have already been looking at this, see Is Rust available on AIX?

I have some notes, including on explicit sections, at GitHub - jethrogb/rust-aix

Also you can join this Slack instance to get connected with the people working on this.

You can disable LTO by adding the following to Cargo.toml:

[profile.release]
lto = no

This should suppress the generation of the .llvmbc and .llvmcmd sections that are necessary for LTO.

I will contact the compiler team on Zulip.

About previous message in the forum, treix is my colleague. We will have a look on your notes, @jethrogb.

lto=no is not enough, I still have the "XCOFF not implemented" error.

About the error 0554, an environnement variable was missing: with export RUSTC_BOOTSTRAP=0, I have the same behavior in a script running only the exact command and with the full x.py.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.