Skip to content

Doc: explicits the .rodata section in std::str #18456

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

Closed
wants to merge 1 commit into from

Conversation

gamazeps
Copy link
Contributor

Made the fact that rodata is a section of the executable more explicit
Closes #18449

@gamazeps gamazeps changed the title DOC: explicits the .rodata section in std::str Doc: explicits the .rodata section in std::str Oct 30, 2014
@thestinger
Copy link
Contributor

The issue was filed about rodata being an unfamiliar term. It's also an implementation detail which is not portable across platforms. I think it needs to be removed entirely and replaced with documentation explaining that string constants are immutable views with a 'static lifetime (&'static str).

@gamazeps
Copy link
Contributor Author

Ok, I see what you meant :)

What I tried to do was just trying to make it easier to look for on the internet by making it more explicit.
By the way is it really an implementation detail ? Because in C, having strings is .rodata is the norm (at least with gcc), or at least that's what I have always seen (wether in -Os, -O0 or -O3)

@richo
Copy link
Contributor

richo commented Oct 30, 2014

That's true in ELF, on x86, but iirc mips doesn't actually have a rodata segment.

@gamazeps
Copy link
Contributor Author

ELF is the norm in mips too (bare-metal C on mips is my day job :p )

@thestinger
Copy link
Contributor

Rust isn't artificially limited to platforms with an rodata section and memory protection concepts. It makes no guarantees about low-level code generation implementation details like this. Documenting that string literals are immutable views with static lifetimes doesn't require getting bogged down in implementation details. It's not helpful for the documentation to mention irrelevant low-level details rather than communicating the semantics and performance characteristics.

@gamazeps
Copy link
Contributor Author

No worries, your explanation is clearer, I'll use it in a few minutes (I'm on another issue for now ;) )

@thestinger
Copy link
Contributor

(for example, there's no rodata section on Windows - it's named differently)

@gamazeps
Copy link
Contributor Author

@thestinger taken into acount, and now ?

bors added a commit that referenced this pull request Nov 2, 2014
Made the fact that rodata is a section of the executable more explicit
Closes #18449
@bors bors closed this Nov 3, 2014
@gamazeps gamazeps deleted the issue18449 branch May 7, 2017 14:52
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

Successfully merging this pull request may close these issues.

rodata in std::str may be an unfamiliar term
7 participants