Skip to content

Support static linking crates #552

Closed
@espindola

Description

@espindola

Currently a crate is always compiled to a shared library. We should support both regular static linking and LTO. I think we should rename --shared to --lib. This is what it would look at:

*) rustc --lib --shared foo.rc -o foo.so
*) rustc --lib --static foo.rc -o foo.lib (really just a .o, but has a different ending)
*) rustc --lib --static --emit-llvm foo.rc -o foo.bclib (really just a .bc, but has a different ending)

rustc then looks for .lib and .bclib when resolving use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-driverArea: rustc_driver that ties everything together into the `rustc` compilerA-linkageArea: linking into static, shared libraries and binariesC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions