Skip to content
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
20 changes: 20 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,25 @@ jobs:
run: ./ci/update-musl.sh
- run: cargo clippy --workspace --all-targets

build-custom:
name: Build custom target
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup component add rust-src
- uses: Swatinem/rust-cache@v2
- run: |
# Ensure we can build with custom target.json files (these can interact
# poorly with build scripts)
cargo build -p compiler_builtins -p libm \
--target etc/thumbv7em-none-eabi-renamed.json \
-Zbuild-std=core

benchmarks:
name: Benchmarks
timeout-minutes: 20
Expand Down Expand Up @@ -331,6 +350,7 @@ jobs:
success:
needs:
- benchmarks
- build-custom
- clippy
- extensive
- miri
Expand Down
13 changes: 10 additions & 3 deletions compiler-builtins/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ impl Target {
let out = cmd
.output()
.unwrap_or_else(|e| panic!("failed to run `{cmd:?}`: {e}"));
assert!(out.status.success(), "failed to run `{cmd:?}`");
let rustc_cfg = str::from_utf8(&out.stdout).unwrap();

// If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe
// choice and leave `f16` and `f128` disabled.
let rustc_output_ok = out.status.success();
let reliable_f128 =
rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f128");
let reliable_f16 =
rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f16");

Self {
triple,
triple_split,
Expand All @@ -67,8 +74,8 @@ impl Target {
.split(",")
.map(ToOwned::to_owned)
.collect(),
reliable_f128: rustc_cfg.lines().any(|l| l == "target_has_reliable_f128"),
reliable_f16: rustc_cfg.lines().any(|l| l == "target_has_reliable_f16"),
reliable_f128,
reliable_f16,
}
}

Expand Down
23 changes: 23 additions & 0 deletions etc/thumbv7em-none-eabi-renamed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"abi": "eabi",
"arch": "arm",
"c-enum-min-bits": 8,
"crt-objects-fallback": "false",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"emit-debug-gdb-scripts": false,
"frame-pointer": "always",
"linker": "rust-lld",
"linker-flavor": "gnu-lld",
"llvm-floatabi": "soft",
"llvm-target": "thumbv7em-none-eabi",
"max-atomic-width": 32,
"metadata": {
"description": "Bare ARMv7E-M",
"host_tools": false,
"std": false,
"tier": 2
},
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "32"
}
13 changes: 10 additions & 3 deletions libm/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ impl Config {
let out = cmd
.output()
.unwrap_or_else(|e| panic!("failed to run `{cmd:?}`: {e}"));
assert!(out.status.success(), "failed to run `{cmd:?}`");
let rustc_cfg = str::from_utf8(&out.stdout).unwrap();

// If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe
// choice and leave `f16` and `f128` disabled.
let rustc_output_ok = out.status.success();
let reliable_f128 =
rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f128");
let reliable_f16 =
rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f16");

Self {
target_triple,
manifest_dir: PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()),
Expand All @@ -59,8 +66,8 @@ impl Config {
target_string: env::var("TARGET").unwrap(),
target_vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(),
target_features,
reliable_f128: rustc_cfg.lines().any(|l| l == "target_has_reliable_f128"),
reliable_f16: rustc_cfg.lines().any(|l| l == "target_has_reliable_f16"),
reliable_f128,
reliable_f16,
}
}
}
Expand Down
Loading