mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Rollup merge of #100072 - oToToT:patch-1, r=michaelwoerister
linker-plugin-lto.md: Correct the name of example c file The final output is linked with `cmain.o`, but we use `main.o` in the example. This patch changes the name to `cmain.c` and `cmain.o` as the "C/C++ code as a dependency in Rust" section.
This commit is contained in:
commit
2059391eb2
@ -30,7 +30,7 @@ Using `rustc` directly:
|
||||
# Compile the Rust staticlib
|
||||
rustc --crate-type=staticlib -Clinker-plugin-lto -Copt-level=2 ./lib.rs
|
||||
# Compile the C code with `-flto=thin`
|
||||
clang -c -O2 -flto=thin -o main.o ./main.c
|
||||
clang -c -O2 -flto=thin -o cmain.o ./cmain.c
|
||||
# Link everything, making sure that we use an appropriate linker
|
||||
clang -flto=thin -fuse-ld=lld -L . -l"name-of-your-rust-lib" -o main -O2 ./cmain.o
|
||||
```
|
||||
@ -41,7 +41,7 @@ Using `cargo`:
|
||||
# Compile the Rust staticlib
|
||||
RUSTFLAGS="-Clinker-plugin-lto" cargo build --release
|
||||
# Compile the C code with `-flto=thin`
|
||||
clang -c -O2 -flto=thin -o main.o ./main.c
|
||||
clang -c -O2 -flto=thin -o cmain.o ./cmain.c
|
||||
# Link everything, making sure that we use an appropriate linker
|
||||
clang -flto=thin -fuse-ld=lld -L . -l"name-of-your-rust-lib" -o main -O2 ./cmain.o
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user