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

linkage: Add a note about symbol visibility and unused sections to the paragraph about staticlibs #1361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdroege
Copy link

@sdroege sdroege commented May 17, 2023

@ehuss
Copy link
Contributor

ehuss commented May 22, 2023

@bjorn3 or @petrochenkov Does the information here look correct to you?

@petrochenkov
Copy link
Contributor

Yes, but I'm not sure this belongs to the language reference?
It's all about implementation details.

dependencies, including the standard library, and also exports all public
symbols of them, linking the static library into an executable or shared
library will need special care. In case of a shared library the list of
exported symbols will have to be limited via e.g. a linker or symbol version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say that they have to or that special care is needed.
It's more like "if you want to optimize the output in a similar way to rustc".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of a shared library it seems more than an optimization as you're otherwise risking symbol conflicts, but yes.

How about softening it from the (current) "must" to "should"?

@ehuss
Copy link
Contributor

ehuss commented May 22, 2023

Yes, but I'm not sure this belongs to the language reference?

Yea, there is a gray area where it is unclear how much regarding crate types and linkage are implementation-specific, and what should be considered part of the language. We haven't really nailed down how to draw those lines (#599 discusses this a bit). I seem to recall thinking that most of this chapter should be moved to the rustc guide (at least the compiler-specific parts), but I'm not sure exactly how to make that separation. We also don't have a home for guide-style material like this.

I would love to see a section of the rustc guide (or an entire book!) on linking with Rust. This seems like the kind of content that would live there.

I think for now, without a clear home for this, leaving it here would be fine. It can be moved to a better home in the future.

@sdroege
Copy link
Author

sdroege commented May 23, 2023

I agree that the reference seems like the wrong place, but this specific chapter seems to be the best currently existing place for this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants