Skip to content

STATUS_STACK_BUFFER_OVERRUN return code when running with dynamic linking using rust-lld on Windows 11 #2921

Closed
@meepleek

Description

@meepleek

Bevy version

0.5 and main ( 07ed1d0 )

Operating system & version

Win 11 (day1 release - 21H2)

What you did

Running cargo run a minimal hello.world bevy app with dynamic linking using rust-lld on Win11.

use bevy::prelude::*;

fn main() {
    App::build()
        .add_system(hello_world.system())
        .run();
}

fn hello_world() {
    println!("hello world!");
}

config.toml

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
# rustflags = ["-Zshare-generics=n", "-Ccontrol-flow-guard=nochecks"]
rustflags = ["-Zshare-generics=n"]

What you expected to happen

The app runs with dynamic linking

What actually happened

The process ends immediately with

PS C:\Projects\GameDev\bevy\dynamic_test> cargo run
   Compiling dynamic_test v0.1.0 (C:\Projects\GameDev\bevy\dynamic_test)
    Finished dev [optimized + debuginfo] target(s) in 1.32s
     Running `target\debug\dynamic_test.exe`
error: process didn't exit successfully: `target\debug\dynamic_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

Additional information

Either not using or rust-lld works.
This compiler flag seems that it could be related, but adding -Ccontrol-flow-guard=nochecks to config.toml did not help.

Also possibly relevant:
MS Docs on the MSVC flag /GS
MS Docs on Control Flow Guard

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorO-WindowsSpecific to the Windows desktop operating system

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions