Skip to content

Commit 38915e1

Browse files
bors[bot]Johnathan Van Why
and
Johnathan Van Why
authored
Merge tock#294
294: Improve `libtock_runtime`'s error handling if it can't find an assembly toolchain. r=jrvanwhy a=jrvanwhy Previously, if `libtock_runtime`'s build script was unable to find a toolchain to build its external assembly with, its build would succeed then the process binary would fail to link. This change makes `libtock_runtime`'s build script panic with a useful error message instead. Co-authored-by: Johnathan Van Why <[email protected]>
2 parents c0b1c0d + a35cd86 commit 38915e1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ jobs:
4242
# relocation.
4343
- name: Build and Test
4444
run: |
45-
sudo apt-get install binutils-riscv64-unknown-elf
45+
sudo apt-get install binutils-arm-none-eabi \
46+
binutils-riscv64-unknown-elf
4647
cd "${GITHUB_WORKSPACE}"
4748
echo "[target.'cfg(all())']" >> .cargo/config
4849
echo 'rustflags = ["-D", "warnings"]' >> .cargo/config

runtime/extern_asm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//! point) and linking it into the process binary. Requires out_dir to be added
33
//! to rustc's link search path.
44
5+
/// Compiles the external assembly and tells cargo/rustc to link the resulting
6+
/// library into the crate. Panics if it is unable to find a working assembly
7+
/// toolchain or if the assembly fails to compile.
58
pub(crate) fn build_and_link(out_dir: &str) {
69
use std::env::var;
710
let arch = var("CARGO_CFG_TARGET_ARCH").expect("Unable to read CARGO_CFG_TARGET_ARCH");
@@ -49,6 +52,8 @@ pub(crate) fn build_and_link(out_dir: &str) {
4952
return;
5053
}
5154
}
55+
56+
panic!("Unable to find a toolchain for architecture {}", arch);
5257
}
5358

5459
#[derive(Clone, Copy)]

0 commit comments

Comments
 (0)