Skip to content

rustc -C link-args=-static-libgcc does not work on Windows #15420

Closed
@abonander

Description

@abonander

When building on Windows, libgcc is dynamically linked by default. In the GCC Linker Options, it says that this is necessary for cross-library exception handling, but for programs that don't need that, this adds an unnecessary dynamic linking to the libgcc DLL, which would have to be distributed with the built executable since it's not available by default on Windows.

Passing -C link-args=-static-libgcc should make libgcc statically linked, but it doesn't seem to override the -shared-libgcc flag. While this suggests a bug or undocumented behavior with the GCC linker, rustc should be aware that the user wants to statically link libgcc and not add the -shared-libgcc linker flag.

I'm using Mingw-builds 4.8.1 on Windows 7 (OS is 64-bit, Mingw is 32-bit) and the Rust 0.11.0 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesO-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions