Skip to content

inline-asm stack probe used but not defined on x86_64-unknown-uefi #81196

Closed
@addrianyy

Description

@addrianyy

I tried this code:

#![no_std]
#![no_main]

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

struct LargeObject {
    x: [u64; 4096 / 8],
}

#[no_mangle]
extern fn efi_main(image_handle: usize, system_table: usize) -> ! {
    let obj = LargeObject {
        x: [0u64; 4096 / 8],
    };

    loop {}
}

.cargo/config.toml

[build]
target = "x86_64-unknown-uefi"

[unstable]
build-std = ["core", "compiler_builtins"]
build-std-features = ["compiler-builtins-mem"]

I expected to see this happen: successful build

Instead, this happened:

  = note: rust-lld: error: undefined symbol: inline-asm
          >>> referenced by /home/adrian/dev/bug_test/src/main.rs:14
          >>>               /home/adrian/dev/bug_test/target/x86_64-unknown-uefi/debug/deps/bug_test-a3717c03849f2f91.5fjbp9r5jsbut7ld.rcgu.o:(efi_main)
          >>> referenced by /home/adrian/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/dec2flt/algorithm.rs:16
          >>>               libcore-4d11da90c3f4442d.rlib(core-4d11da90c3f4442d.core.5b14wvwk-cgu.12.rcgu.o):(core::num::dec2flt::algorithm::power_of_ten::hb262726576c8070b)

Meta

rustc --version --verbose:

rustc 1.51.0-nightly (d98d2f57d 2021-01-18)
binary: rustc
commit-hash: d98d2f57d9b98325ff075c343d2c7695b66dfa7d
commit-date: 2021-01-18
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1

I believe that this problem was introduced in commit #77885.
The same problem exits if building compiler-builtins-mem is not enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-UEFIUEFI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions