Skip to content

error: undefined symbol: __chkstk in compiling UEFI application on ARM64 #57983

Open
@snoword

Description

@snoword

Hi,

I'm creating a UEFI application on ARM64. My target .json file is as follows and it works well for a simple hello_world application.

{
  "llvm-target": "aarch64-pc-windows-msvc",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "os": "uefi",
  "arch": "aarch64",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "linker": "rust-lld",
  "linker-flavor": "lld-link",
  "pre-link-args": {
    "lld-link": [
        "/Subsystem:EFI_Application",
	"/Entry:wenqiu_entry",
	"/Machine:arm64"
    ]
  },
  "panic-strategy": "abort",
  "default-hidden-visibility": true,
  "executables": true,
  "exe-suffix": ".efi",
  "is-like-windows": true,
  "emit-debug-gdb-scripts": false,
}

However, when I create a static Once object
pub static MY_OBJECT: Once<MutexIrqSafe<MyStruct>> = Once::new();
and initialize it with
MY_OBJECT.call_once(|| {MutexIrqSafe::new( myobj ) });,
an error occurs

note: rust-lld: error: undefined symbol: __chkstk

I found this link #56913 and it says this error is caused by a large local variable. According to the corresponding commitment 0b00db, I add

"stack_probes": true,

in the target.json file, but the problem is still there. The toolchain I use is nightly-2019-01-02.

Does anyone know how to solve the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesO-AArch64Armv8-A or later processors in AArch64 mode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions