profile
viewpoint
Scott Mabin MabezDev UK mabez.dev Computer Science graduate passionate about embedded systems, with a particular interest in IoT systems and Rust

MabezDev/hm11 2

A driver crate for the hm11 bluetooth module

MabezDev/ArduinoWeatherProject 1

Weather srtation prject

MabezDev/dotfiles 1

Dotfiles and configs

MabezDev/AndroidPython 0

My adaptation of Android game.

MabezDev/autonomous-robot 0

Firmware for an autonomous robot powered by an arduino nano

MabezDev/awesome-embedded-rust 0

Curated list of resources for Embedded and Low-level development in the Rust programming languag

startedMabezDev/xtensa-rust-quickstart

started time in 2 hours

startedMabezDev/rust-xtensa

started time in 13 hours

startedMabezDev/rust-xtensa

started time in a day

startedfreedreno/freedreno

started time in 2 days

startedMabezDev/xtensa-rust-quickstart

started time in 3 days

startedMabezDev/rust-xtensa

started time in 3 days

startedMabezDev/rust-xtensa

started time in 4 days

fork geohot/appnope

Disable App Nap on OS X 10.9

fork in 5 days

startedMabezDev/rust-xtensa-patches

started time in 5 days

startedMabezDev/rust-xtensa

started time in 5 days

startedMabezDev/xtensa-rust-quickstart

started time in 6 days

startedMabezDev/rust-xtensa

started time in 7 days

startedMabezDev/xtensa-rust-quickstart

started time in 7 days

issue openedesp-rs/esp32-hal

Suspected typo / copy'n'paste bug in 'ram' macro

https://github.com/esp-rs/esp32-hal/blob/459bb29f661e7b6c3ef5cf99dc7335326276e880/procmacros/src/lib.rs#L69-L79

I was just reading over the code and spotted the above suspected typo. The second if condition is identical to the block above, however, the message suggests that it should check the 'initialization' parameters.

created time in 7 days

startedMabezDev/xtensa-rust-quickstart

started time in 8 days

startedMabezDev/rust-xtensa

started time in 8 days

startedMabezDev/rust-xtensa

started time in 9 days

startedMabezDev/rust-xtensa

started time in 9 days

startedMabezDev/xtensa-rust-quickstart

started time in 9 days

issue commentrust-lang/wg-cargo-std-aware

Can we tailor the version of the compiler-builtins package that is compiled and linked together with the core crate?

It is currently not possible to change the version with build-std. As @SimonSapin mentioned, typically testing should be done by updating it in a clone of the rust-lang/rust repository and building rustc from there. Assuming things work, anyone is welcome to post a PR to bump the version (see https://github.com/rust-lang/rust/pull/78209 for an example).

Supporting custom code with build-std is tracked in #7, though there isn't much of a plan or strategy on how that will work, yet.

parraman

comment created time in 9 days

issue closedrust-lang/wg-cargo-std-aware

Linker can't find core::panicking::panic when lto is turned on

With -Z build-std and lto = true, the linker can't link to core::panicking::panic.

The Issue might have to do with the fact that neither the binutils-arm-none-eabi toolchain nor llvm-objdump can read the generated libcore-***.rlib file:

$ arm-none-eabi-objdump -Cd target/armv7a-none-eabi/debug/deps/libcore-03f9f7bf54691bce.rlib
In archive target/armv7a-none-eabi/debug/deps/libcore-03f9f7bf54691bce.rlib:
arm-none-eabi-objdump: core-03f9f7bf54691bce.core.r68z9s80-cgu.0.rcgu.o: File format not recognized
  ...

$ llvm-objdump -Cd target/armv7a-none-eabi/debug/deps/libcore-03f9f7bf54691bce.rlib
 <no output>

Steps to Repoduce

src/main.rs

#![no_std]
#![no_main]

#[no_mangle]
unsafe fn _start(v: f64, _b: bool) -> f64 {
    v / v   // uses __aeabi_ddiv
            // which uses compiler_builtins::float::div::__divdf3
            // which uses compiler_builtins::float::div::div64
            // which uses <u64 as core::ops::arith::Sub>::sub
            // which uses core::panicking::panic
}

#[panic_handler]
fn panic(_ : &core::panic::PanicInfo<'_>) -> ! {
    loop {}
}

Cargo.toml

[package]
name = "arm-quick-tests"
version = "0.1.0"
edition = "2018"

[profile.dev]
lto = true

With build-std

$ cargo build --target armv7a-none-eabi -Z build-std

  ...

   Compiling arm-quick-tests v0.1.0 (/home/hnj/projects/psp/arm-quick-tests)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" "/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7a-none-eabi/lib" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/arm_quick_tests-4b5a9387f1da73da.rustc_std_workspace_core-a7ae2bd4c0ad8c97.rustc_std_workspace_core.16ed7zji-cgu.0.rcgu.o.rcgu.o" "-o" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/arm_quick_tests-4b5a9387f1da73da" "--gc-sections" "-L" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps" "-L" "/home/hnj/projects/psp/arm-quick-tests/target/debug/deps"
"-L" "/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7a-none-eabi/lib" "-Bstatic" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib" "-Bdynamic"
  = note: rust-lld: error: undefined symbol: core::panicking::panic::hd649c340f3d8c4c6
          >>> referenced by arith.rs:206 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:206)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$u64$u20$as$u20$core..ops..arith..Sub$GT$::sub::h2cefb96ba13f6e84) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced by arith.rs:731 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:731)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$i64$u20$as$u20$core..ops..arith..AddAssign$GT$::add_assign::h4eb6c8c224d7986a) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced by arith.rs:731 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:731)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$u64$u20$as$u20$core..ops..arith..AddAssign$GT$::add_assign::he3030313ce7894e6) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced 11 more times


error: aborting due to previous error

error: could not compile `arm-quick-tests`

Without build-std:

$ cargo build --target armv7a-none-eabi
   Compiling arm-quick-tests v0.1.0 (/home/hnj/projects/psp/arm-quick-tests)
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s

Without tlo = true:

$ cargo build --target armv7a-none-eabi -Z build-std

   ...

   Compiling arm-quick-tests v0.1.0 (/home/hnj/projects/psp/arm-quick-tests)
    Finished dev [unoptimized + debuginfo] target(s) in 27.63s

Version:

$ rustc --version
rustc 1.50.0-nightly (a0d664bae 2020-11-22)

closed time in 9 days

hnj2

issue commentrust-lang/wg-cargo-std-aware

Linker can't find core::panicking::panic when lto is turned on

Thank you very much!

hnj2

comment created time in 9 days

issue commentrust-lang/wg-cargo-std-aware

Linker can't find core::panicking::panic when lto is turned on

I think you're running into the same thing as https://github.com/rust-lang/compiler-builtins/issues/347?

Essentially, compiler-builtins expects to be compiled with overflow-checks=false and debug-assertions=false which cargo -Z build-std does not do ... You can add

[profile.dev.package.compiler_builtins]
overflow-checks = false

to your Cargo.toml which gives a warning but still does the trick ...

hnj2

comment created time in 9 days

issue commentrust-lang/wg-cargo-std-aware

Linker can't find core::panicking::panic when lto is turned on

Not sure if this is the right place or if rust-lang/rust is the place to put this issue?

hnj2

comment created time in 9 days

issue openedrust-lang/wg-cargo-std-aware

Linker can't find core::panicking::panic when lto is turned on

src/main.rs

#![no_std]
#![no_main]

#[no_mangle]
unsafe fn _start(v: f64, _b: bool) -> f64 {
    v / v   // uses __aeabi_ddiv
            // which uses compiler_builtins::float::div::__divdf3
            // which uses compiler_builtins::float::div::div64
            // which uses <u64 as core::ops::arith::Sub>::sub
            // which uses core::panicking::panic
}

#[panic_handler]
fn panic(_ : &core::panic::PanicInfo<'_>) -> ! {
    loop {}
}

Cargo.toml

[package]
name = "arm-quick-tests"
version = "0.1.0"
edition = "2018"

[profile.dev]
lto = true

Without build-std:

$ cargo build --target armv7a-none-eabi
   Compiling arm-quick-tests v0.1.0 (/home/hnj/projects/psp/arm-quick-tests)
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s

With build-std

$ cargo build --target armv7a-none-eabi -Z build-std

  ...

   Compiling arm-quick-tests v0.1.0 (/home/hnj/projects/psp/arm-quick-tests)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" "/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7a-none-eabi/lib" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/arm_quick_tests-4b5a9387f1da73da.rustc_std_workspace_core-a7ae2bd4c0ad8c97.rustc_std_workspace_core.16ed7zji-cgu.0.rcgu.o.rcgu.o" "-o" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/arm_quick_tests-4b5a9387f1da73da" "--gc-sections" "-L" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps" "-L" "/home/hnj/projects/psp/arm-quick-tests/target/debug/deps"
"-L" "/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7a-none-eabi/lib" "-Bstatic" "/home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib" "-Bdynamic"
  = note: rust-lld: error: undefined symbol: core::panicking::panic::hd649c340f3d8c4c6
          >>> referenced by arith.rs:206 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:206)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$u64$u20$as$u20$core..ops..arith..Sub$GT$::sub::h2cefb96ba13f6e84) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced by arith.rs:731 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:731)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$i64$u20$as$u20$core..ops..arith..AddAssign$GT$::add_assign::h4eb6c8c224d7986a) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced by arith.rs:731 (/home/hnj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:731)
          >>>               compiler_builtins-14592acc24880b22.compiler_builtins.elyi3bsc-cgu.15.rcgu.o:(_$LT$u64$u20$as$u20$core..ops..arith..AddAssign$GT$::add_assign::he3030313ce7894e6) in archive /home/hnj/projects/psp/arm-quick-tests/target/armv7a-none-eabi/debug/deps/libcompiler_builtins-14592acc24880b22.rlib
          >>> referenced 11 more times


error: aborting due to previous error

error: could not compile `arm-quick-tests`

Version:

$ rustc --version
rustc 1.50.0-nightly (a0d664bae 2020-11-22)

created time in 9 days

startedMabezDev/rust-xtensa

started time in 10 days

startedfreedomtan/TestANE

started time in 11 days

fork geohot/pyopencl

OpenCL integration for Python, plus shiny features

http://mathema.tician.de/software/pyopencl

fork in 11 days

created repositoryjamesmunns/lipo-stamp

A tiny Li-Po/Li-Ion charging management SoM

created time in 11 days

more