-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc: Add a new crate type, cdylib #33553
Conversation
r? @jroesch (rust_highfive has picked a reviewer for you, use r? to override) |
r? @brson |
@bors r+ |
📌 Commit a3f5d08 has been approved by |
let res = (|| -> io::Result<()> { | ||
let mut f = BufWriter::new(File::create(&path)?); | ||
for sym in exported_symbols(sess, trans, crate_type) { | ||
writeln!(f, " {}", sym)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be enough for iOS, see failure.
@bors r- Likely responsible for this failure. |
Indeed! looks quite suspicious |
@bors: r=brson bfe7a80 |
Travis fails |
⌛ Testing commit bfe7a80 with merge 2d45326... |
💔 Test failed - auto-mac-64-opt-rustbuild |
I'm working on rebasing this over #33602 because otherwise I'd need windows to investigate my metadata problem. |
⌛ Testing commit 557aae0 with merge 3ad8865... |
💔 Test failed - auto-linux-64-opt-rustbuild |
rustc: Add a new crate type, cdylib This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: rust-lang/rfcs#1510 Closes #33132
💔 Test failed - auto-linux-musl-64-opt |
@bors: r=brson 0192796 |
⌛ Testing commit 0192796 with merge 89347bf... |
💔 Test failed - auto-mac-64-nopt-t |
This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: rust-lang/rfcs#1510 Closes rust-lang#33132
rustc: Add a new crate type, cdylib This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: rust-lang/rfcs#1510 Closes #33132
This is kind of immediately a new feature on the stable release where this is included, isn't it? If I'm wrong, then the relnote tag can be removed again. |
@alexcrichton How can I compile a crate as |
@torkleyy unfortunately that's not possible right now (short of generating a new |
@alexcrichton Thanks for your reply!
Sure, I'll do that. |
This commit is an implementation of RFC 1510 which adds a new crate type,
cdylib
, to the compiler. This new crate type differs from the existingdylib
crate type in a few key ways:
extern
functions are visible symbolsThis commit is relatively simple by just plubming the compiler with another
crate type which takes different branches here and there. The only major change
is an implementation of the
Linker::export_symbols
function on Unix which nowactually does something. This helps restrict the public symbols from a cdylib on
Unix.
With this PR a "hello world"
cdylib
is 7.2K while the samedylib
is 2.4MB,which is some nice size savings!
Closes #33132