Skip to content

Commit 2059391

Browse files
authored
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.
2 parents cf7a9ae + e1eab53 commit 2059391

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/doc/rustc/src/linker-plugin-lto.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Using `rustc` directly:
3030
# Compile the Rust staticlib
3131
rustc --crate-type=staticlib -Clinker-plugin-lto -Copt-level=2 ./lib.rs
3232
# Compile the C code with `-flto=thin`
33-
clang -c -O2 -flto=thin -o main.o ./main.c
33+
clang -c -O2 -flto=thin -o cmain.o ./cmain.c
3434
# Link everything, making sure that we use an appropriate linker
3535
clang -flto=thin -fuse-ld=lld -L . -l"name-of-your-rust-lib" -o main -O2 ./cmain.o
3636
```
@@ -41,7 +41,7 @@ Using `cargo`:
4141
# Compile the Rust staticlib
4242
RUSTFLAGS="-Clinker-plugin-lto" cargo build --release
4343
# Compile the C code with `-flto=thin`
44-
clang -c -O2 -flto=thin -o main.o ./main.c
44+
clang -c -O2 -flto=thin -o cmain.o ./cmain.c
4545
# Link everything, making sure that we use an appropriate linker
4646
clang -flto=thin -fuse-ld=lld -L . -l"name-of-your-rust-lib" -o main -O2 ./cmain.o
4747
```

0 commit comments

Comments
 (0)