Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't link to libc by default #11941

Closed
brson opened this issue Jan 30, 2014 · 2 comments
Closed

Don't link to libc by default #11941

brson opened this issue Jan 30, 2014 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries

Comments

@brson
Copy link
Contributor

brson commented Jan 30, 2014

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.

@thestinger
Copy link
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
Copy link
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
Labels
A-linkage Area: linking into static, shared libraries and binaries
Projects
None yet
Development

No branches or pull requests

3 participants