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

-Zlto strips pub extern'ed functions provided by extern'ed crates #14500

Closed
wycats opened this issue May 29, 2014 · 6 comments
Closed

-Zlto strips pub extern'ed functions provided by extern'ed crates #14500

wycats opened this issue May 29, 2014 · 6 comments

Comments

@wycats
Copy link
Contributor

wycats commented May 29, 2014

No description provided.

@emberian
Copy link
Member

This seems like desired behavior? LTO only makes sense on executables, who shouldn't be exporting any symbols besides the entry point anyway.

@wycats
Copy link
Contributor Author

wycats commented May 29, 2014

LTO makes sense for .a files too 😄

@emberian
Copy link
Member

Hm, that's true. I guess ... we need a pub extern crate ...;

@wycats
Copy link
Contributor Author

wycats commented May 29, 2014

pub extern crate would work yeah 😄

Although I wonder what the use-case is for declaring a function pub extern "C" and wanting it to be stripped out of a final .a file.

@emberian
Copy link
Member

Well it's not from your crate and it's not actually public, so it gets
caught in the crossfire.

On Thu, May 29, 2014 at 10:06 AM, Yehuda Katz notifications@github.comwrote:

pub extern crate would work yeah [image: 😄]

Although I wonder what the use-case is for declaring a function pub
extern "C" and wanting it to be stripped out of a final .a file.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14500#issuecomment-44556526
.

http://octayn.net/

@wycats
Copy link
Contributor Author

wycats commented May 29, 2014

Sure. I guess I'm proposing a change to the -Zlto stripping rules: never strip #[no_mangle] pub extern "C" functions.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 7, 2014
All rust functions are internal implementation details with respect to the ABI
exposed by crates, but extern fns are public components of the ABI and shouldn't
be stripped. This commit serializes reachable extern fns to metadata, so when
LTO is performed all of their symbols are not stripped.

Closes rust-lang#14500
mcpherrinm pushed a commit to mcpherrinm/rust that referenced this issue Jun 10, 2014
All rust functions are internal implementation details with respect to the ABI
exposed by crates, but extern fns are public components of the ABI and shouldn't
be stripped. This commit serializes reachable extern fns to metadata, so when
LTO is performed all of their symbols are not stripped.

Closes rust-lang#14500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants