Skip to content

Commit

Permalink
S390X CI Support (rust-lang#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
afonso360 committed Dec 3, 2022
1 parent f845eaf commit e12a882
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
- os: ubuntu-latest
env:
TARGET_TRIPLE: aarch64-unknown-linux-gnu
# s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
- os: ubuntu-latest
env:
TARGET_TRIPLE: s390x-unknown-linux-gnu

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -79,6 +83,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
- name: Install s390x toolchain and qemu
if: matrix.env.TARGET_TRIPLE == 's390x-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
- name: Prepare dependencies
run: |
git config --global user.email "user@example.com"
Expand Down
8 changes: 4 additions & 4 deletions build_system/build_sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ pub(crate) fn build_sysroot(

if host_triple != target_triple {
// When cross-compiling it is often necessary to manually pick the right linker
let linker = if target_triple == "aarch64-unknown-linux-gnu" {
Some("aarch64-linux-gnu-gcc")
} else {
None
let linker = match target_triple {
"aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu-gcc"),
"s390x-unknown-linux-gnu" => Some("s390x-linux-gnu-gcc"),
_ => None,
};
build_clif_sysroot_for_triple(
dirs,
Expand Down
9 changes: 9 additions & 0 deletions build_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ impl TestRunner {
"/usr/aarch64-linux-gnu".to_owned(),
];
}
"s390x-unknown-linux-gnu" => {
// We are cross-compiling for s390x. Use the correct linker and run tests in qemu.
rustflags = format!("-Clinker=s390x-linux-gnu-gcc{}", rustflags);
runner = vec![
"qemu-s390x".to_owned(),
"-L".to_owned(),
"/usr/s390x-linux-gnu".to_owned(),
];
}
"x86_64-pc-windows-gnu" => {
// We are cross-compiling for Windows. Run tests in wine.
runner = vec!["wine".to_owned()];
Expand Down

0 comments on commit e12a882

Please sign in to comment.