diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-10 00:00:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 00:00:27 +0200 |
| commit | 2059391eb2cebb798e2d713ea60bd99a8c389432 (patch) | |
| tree | 15f2514bf3ed6725e0affcbe2628aafa1b952057 /src/doc/rustc | |
| parent | cf7a9ae8699033c5d2dd860dc0b2360851c49356 (diff) | |
| parent | e1eab5379e8b0122e3426674a44813e5644a4ada (diff) | |
| download | rust-2059391eb2cebb798e2d713ea60bd99a8c389432.tar.gz rust-2059391eb2cebb798e2d713ea60bd99a8c389432.zip | |
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.
Diffstat (limited to 'src/doc/rustc')
| -rw-r--r-- | src/doc/rustc/src/linker-plugin-lto.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/rustc/src/linker-plugin-lto.md b/src/doc/rustc/src/linker-plugin-lto.md index 9c644dd404d..b1854b22a7c 100644 --- a/src/doc/rustc/src/linker-plugin-lto.md +++ b/src/doc/rustc/src/linker-plugin-lto.md @@ -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 ``` |
