Conversation
Hmm, yeah. I feel.. the same. Wonder if anyone else has thoughts.
FWIW, these days, only an issue needs to be opened, not a full PR, but I appreciate it! Makes it even easier on us. |
Gankra
left a comment
There was a problem hiding this comment.
Hey um, wow I completely missed this!
I think this is good content to add to the nomicon, but needs a fair amount of cleanup to be clearer to someone who isn't totally aware of all these concepts, and be more platform agnostic (or clear in its platform-specific-ness).
| -C panic=abort -C relocation-model=static \ | ||
| -C link-arg=-nostartfiles -C link-arg=-Wl,-Tlink.x \ | ||
| --emit=link,obj \ | ||
| foo.rs |
There was a problem hiding this comment.
To maximize readability can you make this one -C per line?
| // *internal* symbols when looking for an `EXTERN`-ed symbol | ||
| #[no_mangle] | ||
| #[used] | ||
| pub static FOO: u32 = 0; |
There was a problem hiding this comment.
I am of the soft opinion that foo/bar/baz are subpar names to use in example code. I'd prefer descriptive names like: USED_AND_EXTERN, JUST_USED, TOTALLY_DEAD
| #[panic_implementation] | ||
| fn panic(_: &PanicInfo) -> ! { | ||
| loop {} | ||
| } |
There was a problem hiding this comment.
This panic stuff seems like a big distraction, what's the deal? Just trying to make the smallest number of symbols possible? How bad is it if you don't do this?
| } | ||
| ``` | ||
|
|
||
| ``` console |
There was a problem hiding this comment.
The text should ideally say what this block is. Linux?
| ``` | ||
|
|
||
| ``` console | ||
| $ echo 'EXTERN(FOO);' > link.x |
There was a problem hiding this comment.
pls comment this to explain what this is, something like "create a linker script for our EXTERN declarations".
| --emit=link,obj \ | ||
| foo.rs | ||
|
|
||
| $ nm -C foo.o |
There was a problem hiding this comment.
I wouldn't expect a reader to have any idea what nm is, some exposition would be desirable.
| linker script command. Linkers are lazy: once they have found all the symbols needed by the first / | ||
| root object file they will stop looking at the other object files in their list of arguments. | ||
| `EXTERN` forces the linker to look into the other object files until it finds the `EXTERN`-ed | ||
| symbol. |
There was a problem hiding this comment.
Is this universal? Only for *nix? Is this concept also applicable to windows?
| * [Final Code](vec-final.md) | ||
| * [Implementing Arc and Mutex](arc-and-mutex.md) | ||
| * [FFI](ffi.md) | ||
| * [Application Binary Interface](abi.md) |
There was a problem hiding this comment.
imo "application binary interface" is less a term than ABI is these days, so I'd call this section ABI (just as its neighbour is FFI). One of them there acronyms that's losts its meaning.
|
closing due to inactivity, sorry for missing you! |
r? @oli-obk or @steveklabnik
I'm not 100% sure about grouping all those features under an "ABI" section, but having a single #[used] section seemed overkill. I'm open to suggestions about grouping features differently, e.g. using a different section name.
Required by rust-lang/rust#51363