Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
snoword opened this issue Jan 30, 2019 · 5 comments
Open
Labels
A-linkage Area: linking into static, shared libraries and binaries O-AArch64 Armv8-A or later processors in AArch64 mode

Comments

@snoword
Copy link

snoword commented Jan 30, 2019

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?

@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state labels Jan 30, 2019
@snoword
Copy link
Author

snoword commented Jan 30, 2019

@tirr-c

@tirr-c
Copy link
Contributor

tirr-c commented Jan 31, 2019

I understand stack_probes as configuration that makes compiler to use __rust_probestack from compiler-builtins for __chkstk. I'm guessing the build fails because __rust_probestack is not defined for ARM64 target.

Maybe a call to __chkstk is added since UEFI target is based on Windows target. MSVC runtime has __chkstk, so while the compiler is running for Windows that's not a problem.

@snoword
Copy link
Author

snoword commented Feb 1, 2019

I understand stack_probes as configuration that makes compiler to use __rust_probestack from compiler-builtins for __chkstk. I'm guessing the build fails because __rust_probestack is not defined for ARM64 target.

Maybe a call to __chkstk is added since UEFI target is based on Windows target. MSVC runtime has __chkstk, so while the compiler is running for Windows that's not a problem.

Thank you for your reply! I'll check if ARM64 support it.

@3Shain
Copy link

3Shain commented Dec 23, 2020

any update?

@songzhi
Copy link

songzhi commented Jan 6, 2021

I understand stack_probes as configuration that makes compiler to use __rust_probestack from compiler-builtins for __chkstk. I'm guessing the build fails because __rust_probestack is not defined for ARM64 target.

Maybe a call to __chkstk is added since UEFI target is based on Windows target. MSVC runtime has __chkstk, so while the compiler is running for Windows that's not a problem.

It's still not working now when I run it in Windows.

@workingjubilee workingjubilee added O-AArch64 Armv8-A or later processors in AArch64 mode and removed O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state labels Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries O-AArch64 Armv8-A or later processors in AArch64 mode
Projects
None yet
Development

No branches or pull requests

6 participants