add some documentation to the unstable book
This commit is contained in:
parent
95bb45431a
commit
2a177b7715
2 changed files with 62 additions and 0 deletions
|
|
@ -106,6 +106,7 @@
|
|||
- [link_llvm_intrinsics](link-llvm-intrinsics.md)
|
||||
- [linkage](linkage.md)
|
||||
- [linked_list_extras](linked-list-extras.md)
|
||||
- [linker-flavor](linker-flavor.md)
|
||||
- [log_syntax](log-syntax.md)
|
||||
- [lookup_host](lookup-host.md)
|
||||
- [loop_break_value](loop-break-value.md)
|
||||
|
|
|
|||
61
src/doc/unstable-book/src/linker-flavor.md
Normal file
61
src/doc/unstable-book/src/linker-flavor.md
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# `linker-flavor`
|
||||
|
||||
The tracking issue for this feature is: None
|
||||
|
||||
------------------------
|
||||
|
||||
Every `rustc` target defaults to some linker. For example, Linux targets default
|
||||
to gcc. In some cases, you may want to override the default; you can do that
|
||||
with the unstable CLI argument: `-Z linker-flavor`.
|
||||
|
||||
Here how you would use this flag to link a Rust binary for the
|
||||
`thumbv7m-none-eabi` using LLD instead of GCC.
|
||||
|
||||
``` text
|
||||
$ xargo rustc --target thumbv7m-none-eabi -- \
|
||||
-C linker=ld.lld \
|
||||
-Z linker-flavor=ld \
|
||||
-Z print-link-args | tr ' ' '\n'
|
||||
"ld.lld"
|
||||
"-L"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps/app-512e9dbf385f233c.0.o"
|
||||
"-o"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps/app-512e9dbf385f233c"
|
||||
"--gc-sections"
|
||||
"-L"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps"
|
||||
"-L"
|
||||
"$PWD/target/debug/deps"
|
||||
"-L"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib"
|
||||
"-Bstatic"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib/libcore-e1ccb7dfb1cb9ebb.rlib"
|
||||
"-Bdynamic"
|
||||
```
|
||||
|
||||
Whereas the default is:
|
||||
|
||||
```
|
||||
$ xargo rustc --target thumbv7m-none-eabi -- \
|
||||
-C link-arg=-nostartfiles \
|
||||
-Z print-link-args | tr ' ' '\n'
|
||||
"arm-none-eabi-gcc"
|
||||
"-L"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps/app-961e39416baa38d9.0.o"
|
||||
"-o"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps/app-961e39416baa38d9"
|
||||
"-Wl,--gc-sections"
|
||||
"-nodefaultlibs"
|
||||
"-L"
|
||||
"$PWD/target/thumbv7m-none-eabi/debug/deps"
|
||||
"-L"
|
||||
"$PWD/target/debug/deps"
|
||||
"-L"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib"
|
||||
"-Wl,-Bstatic"
|
||||
"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib/libcore-e1ccb7dfb1cb9ebb.rlib"
|
||||
"-nostartfiles"
|
||||
"-Wl,-Bdynamic"
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue