Skip to content

How can you disable stack checking? #65751

Open
@Lokathor

Description

@Lokathor

On Windows-MSCV-x86_64 I am attempting to create a no_std binary with Stable (1.38). I'm getting an unresolved symbol for __chkstk:

D:\dev\quixotic>cargo run
   Compiling quixotic v0.0.0 (D:\dev\quixotic)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\dev\\quixotic\\target\\debug\\deps\\main-13addd73d3845cd6.1z81p1fkccyc5iby.rcgu.o" "D:\\dev\\quixotic\\target\\debug\\deps\\main-13addd73d3845cd6.22n4xq61sdy0azbs.rcgu.o" "D:\\dev\\quixotic\\target\\debug\\deps\\main-13addd73d3845cd6.255oap8fzr2s5w11.rcgu.o" "D:\\dev\\quixotic\\target\\debug\\deps\\main-13addd73d3845cd6.2u5094on6j0uypp3.rcgu.o" "/OUT:D:\\dev\\quixotic\\target\\debug\\deps\\main-13addd73d3845cd6.exe" "/SUBSYSTEM:console" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:D:\\dev\\quixotic\\target\\debug\\deps" "/LIBPATH:C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\dev\\quixotic\\target\\debug\\deps\\libwinapi-f9a577440f324f5e.rlib" "C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-6391a360e3eeafba.rlib" "C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-6c8df881cdc2afb2.rlib" "C:\\Users\\Daniel\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-f998976453a15b70.rlib" "advapi32.lib" "cfgmgr32.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "opengl32.lib" "user32.lib" "winspool.lib"
  = note: main-13addd73d3845cd6.1z81p1fkccyc5iby.rcgu.o : error LNK2019: unresolved external symbol 
__chkstk referenced in function mainCRTStartup
          main-13addd73d3845cd6.255oap8fzr2s5w11.rcgu.o : error LNK2001: unresolved external symbol 
__chkstk
          D:\dev\quixotic\target\debug\deps\main-13addd73d3845cd6.exe : fatal error LNK1120: 1 unresolved externals


error: aborting due to previous error

error: Could not compile `quixotic`.

To learn more, run the command again with --verbose.

Normally, you resolve this in the C/C++ MSVC compiler with /GS- to disable stack security checks, /Gs999999999 to disable stack probes, and telling the linker /STACK:0x100000,0x100000 to force it to commit the entire 1MB of stack right away instead of using all the pages individually.

I can pass the linker arg to link.exe easily enough, but what would the rustc equivalents to disable stack checking and stack probing be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions