Skip to content

Don't link to libc by default #11941

Closed
Closed
@brson

Description

@brson
Contributor

Right now, since we're linking with the C compiler (#11937) we're giving all Rust code access to libc. I think the compiler itself should not force linking to libc (and anything else cc links us to by default). Instead either std or the potential libc crate (#11828) should be responsible for the libc link.

Activity

thestinger

thestinger commented on Jan 31, 2014

@thestinger
Contributor

I don't think we want a libc crate/module in the long-term. It should come from libclang so it works on more than the hard-wired glibc ABI, etc. Since code gets inlined, I think we do have to link everything to the libraries we use. Passing --as-needed to the linker will strip any unnecessary dependencies.

alexcrichton

alexcrichton commented on Feb 16, 2014

@alexcrichton
Member

Closed by #12205, with -nodefaultlibs gcc will not specify any libraries by default, we have to supply all of them. We now have #[link(name = "c")] for linux required in libstd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binaries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@brson@thestinger

        Issue actions

          Don't link to libc by default · Issue #11941 · rust-lang/rust