Closed RustAndMetal closed 8 months ago
It seems like the target has std but apparently no libm? That's... very unusual and probably should be reported upstream (this may or may not be a bug tbf).
You're right, apparently there is no fmodf
in aarch64-unknown-uefi
.
The issue is with any modulo operation involving f32
, for example inside tiny_skia_path::dash::adjust_dash_offset
:
The dependency on std
can be removed but the issue persists. A minimal example can be reproduced like this:
#!/usr/bin/env cargo
//! ```cargo
//! [dependencies]
//! log = "0.4.20"
//! uefi = "0.24.0"
//! uefi-services = "0.21.0"
//! ```
#![no_main]
#![no_std]
use log::info;
use uefi::prelude::*;
use tiny_skia;
#[entry]
fn main(_image_handle: Handle, mut system_table: SystemTable<Boot>) -> Status {
uefi_services::init(&mut system_table).unwrap();
let mut count = 0f32;
loop {
count += 1f32;
count %= 10f32;
info!("{:?}", count);
}
}
This compiles for x86_64-unknown-uefi
but does not compile for aarch64-unknown-uefi
. Interestingly, the example compiles for aarch64-unknown-none
.
We're not really sure if this is "supposed" to work (i.e. it is a bug in the aarch64-unknown-uefi
target), or if modulo operations for f32
in no-std
are simply not guaranteed to be available?
We found a PR which removes a lot of dependencies on libm
but explicitly keeps fmodf
: https://github.com/rust-lang/rust/pull/27823
TL;DR:
Does *-unknown-uefi
guarantee that modulo operations with f32
are available? If so, this is a bug in the aarch64-unknown-uefi
target. If not, this is a bug in tiny-skia-path
because it incorrectly assumes modulo operations are available. Maybe @dvdhrm or @nicholasbishop know more?
I confirmed I can reproduce this. It's definitely a bug in the target, probably some tweaks are needed in https://github.com/rust-lang/compiler-builtins. I'll take a look at fixing it :)
I think this is out of scope. tiny-skia
supports only x86, aarch64 and wasm32.
Closed by rust-lang/compiler-builtins/pull/553
When building the pattern example for
aarch64-unknown-uefi
usingcargo build --target aarch64-unknown-uefi
withtiny-skia = { version = "0.11.2", features = ["no-std-float"] }
, the build fails.Several symbols cannot be found, for example
fmodf
: