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

Update to the latest c-gull and Rust nightly. #245

Merged
merged 2 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/install-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ inputs:
default: 'stable'

runs:
using: node16
using: node20
main: 'main.js'
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
include:
- build: ubuntu
os: ubuntu-latest
rust: nightly-2024-08-19
rust: nightly-2024-10-01
host_target: x86_64-unknown-linux-gnu
mustang_target: x86_64-mustang-linux-gnu
- build: i686-linux
os: ubuntu-latest
rust: nightly-2024-08-19
rust: nightly-2024-10-01
target: i686-unknown-linux-gnu
gcc_package: gcc-i686-linux-gnu
gcc: i686-linux-gnu-gcc
Expand All @@ -44,7 +44,7 @@ jobs:
mustang_target: i686-mustang-linux-gnu
- build: aarch64-linux
os: ubuntu-latest
rust: nightly-2024-08-19
rust: nightly-2024-10-01
target: aarch64-unknown-linux-gnu
gcc_package: gcc-aarch64-linux-gnu
gcc: aarch64-linux-gnu-gcc
Expand All @@ -54,7 +54,7 @@ jobs:
mustang_target: aarch64-mustang-linux-gnu
- build: riscv64-linux
os: ubuntu-latest
rust: nightly-2024-08-19
rust: nightly-2024-10-01
target: riscv64gc-unknown-linux-gnu
gcc_package: gcc-riscv64-linux-gnu
gcc: riscv64-linux-gnu-gcc
Expand Down Expand Up @@ -138,22 +138,22 @@ jobs:

- name: Install rust-src
run: |
rustup component add rust-src --toolchain nightly-2024-08-19-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2024-10-01-x86_64-unknown-linux-gnu

- name: cargo check non-mustang
run: |
# Check that the code compiles on non-mustang targets.
cargo +nightly-2024-08-19 check --all --target=${{ matrix.host_target }}
cargo +nightly-2024-10-01 check --all --target=${{ matrix.host_target }}

- name: cargo test
run: |
cargo +nightly-2024-08-19 test --verbose -Z build-std --target=target-specs/${{ matrix.mustang_target }}.json -- ${{ matrix.test_args }} -- --nocapture
cargo +nightly-2024-10-01 test --verbose -Z build-std --target=target-specs/${{ matrix.mustang_target }}.json -- ${{ matrix.test_args }} -- --nocapture
env:
RUST_BACKTRACE: 1

- name: cargo test --release
run: |
cargo +nightly-2024-08-19 test --verbose --release -Z build-std --target=target-specs/${{ matrix.mustang_target }}.json -- ${{ matrix.test_args }}
cargo +nightly-2024-10-01 test --verbose --release -Z build-std --target=target-specs/${{ matrix.mustang_target }}.json -- ${{ matrix.test_args }}
env:
RUST_BACKTRACE: 1

Expand Down Expand Up @@ -181,20 +181,20 @@ jobs:
- name: test mustang-nostd as program
working-directory: example-crates/mustang-nostd
run: |
cargo +nightly-2024-08-19 run -Zbuild-std=core,alloc --target=../../target-specs/${{ matrix.mustang_target }}.json
cargo +nightly-2024-10-01 run -Zbuild-std=core,alloc --target=../../target-specs/${{ matrix.mustang_target }}.json
env:
RUST_BACKTRACE: 1

- name: test mustang-nostd as tests
working-directory: example-crates/mustang-nostd
run: |
cargo +nightly-2024-08-19 test -Zbuild-std=core,alloc,test,std --target=../../target-specs/${{ matrix.mustang_target }}.json
cargo +nightly-2024-10-01 test -Zbuild-std=core,alloc,test,std --target=../../target-specs/${{ matrix.mustang_target }}.json
env:
RUST_BACKTRACE: 1

- name: test mustang-custom-allocator as tests
working-directory: example-crates/mustang-custom-allocator
run: |
cargo +nightly-2024-08-19 run -Zbuild-std --target=../../target-specs/${{ matrix.mustang_target }}.json
cargo +nightly-2024-10-01 run -Zbuild-std --target=../../target-specs/${{ matrix.mustang_target }}.json
env:
RUST_BACKTRACE: 1
12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ["/.github", "ci"]
keywords = ["linux"]

[target.'cfg(target_vendor = "mustang")'.dependencies]
c-gull = { version = "0.17.0", default-features = false, features = ["take-charge", "call-main", "malloc-via-crates", "define-mem-functions"] }
c-gull = { version = "0.18.1", default-features = false, features = ["take-charge", "call-main", "malloc-via-crates", "define-mem-functions"] }

[dev-dependencies]
similar-asserts = "1.1.0"
Expand All @@ -29,7 +29,9 @@ ctor = "0.2.0"
which = "6.0.0"

# Test that the core_simd crate works under mustang.
core_simd = { git = "https://github.com/rust-lang/portable-simd" }
# TODO: Reenable this when the crate compiles on nightly. Currently it gets:
# - error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `[u32; 4]`
#core_simd = { git = "https://github.com/rust-lang/portable-simd" }

[features]
default = ["thread", "std"]
Expand All @@ -43,9 +45,3 @@ std = ["c-gull/std"]
# Enable highly experimental support for performing startup-time relocations,
# needed to support statically-linked PIE executables.
experimental-relocate = ["c-gull/experimental-relocate"]

# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ builds arranges for `mustang`'s libraries to be linked in.
mustang::can_run_this!();
```

And, to work around an LLVM bug, add the following to Cargo.toml:
```toml
# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
```

Then, compile with Rust nightly, using `-Z build-std` and
`--target=<mustang-target>`. For example:

Expand Down
6 changes: 0 additions & 6 deletions example-crates/mustang-custom-allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ mustang = { path = "../.." }
rustix-dlmalloc = { version = "0.1.0", features = ["global"] }

[workspace]

# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
6 changes: 0 additions & 6 deletions example-crates/mustang-example-lto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,3 @@ lto = true

# This is just an example crate, and not part of the mustang workspace.
[workspace]

# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
6 changes: 0 additions & 6 deletions example-crates/mustang-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,3 @@ mustang = { path = "../.." }

# This is just an example crate, and not part of the mustang workspace.
[workspace]

# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
6 changes: 0 additions & 6 deletions example-crates/mustang-nostd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ mustang = { path = "../..", default-features = false, features = ["thread"] }
rustix-dlmalloc = { version = "0.1.0", features = ["global"] }

[workspace]

# TODO: Remove this workaround when
# https://github.com/llvm/llvm-project/pull/105513
# makes it into the Rust compiler.
[profile.dev.package.unwinding]
debug = false
5 changes: 4 additions & 1 deletion examples/test-simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

mustang::can_run_this!();

use core::arch::asm;
//use core::arch::asm;

fn main() {
// TODO: Reenable this when the crate compiles on nightly.
/*
use core_simd::simd::*;
let mut a = f32x4::splat(2.0);
unsafe { asm!("# {}", in(reg) &mut a) };
assert_eq!(a, f32x4::splat(2.0));
assert_eq!(&a as *const _ as usize & 0xf, 0);
*/
}
2 changes: 1 addition & 1 deletion tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_example(name: &str, features: &str, stdout: &str, stderr: &str) {

let mut command = Command::new("cargo");
if which::which("rustup").is_ok() {
command.arg("+nightly-2024-08-19");
command.arg("+nightly-2024-10-01");
}
command.arg("run").arg("--quiet");
if !features.is_empty() {
Expand Down