|
3 | 3 | extern crate build_common; |
4 | 4 |
|
5 | 5 | use build_common::generate_and_configure_header; |
6 | | -use std::env; |
7 | | -use std::path::PathBuf; |
8 | | -use std::process::Command; |
| 6 | +use std::{env, path::PathBuf, process::Command}; |
9 | 7 |
|
10 | 8 | /// Locate the `gcc-ld/` shim directory shipped with the Rust toolchain. |
11 | 9 | /// |
@@ -86,22 +84,23 @@ fn main() { |
86 | 84 |
|
87 | 85 | println!("cargo:rerun-if-env-changed=LIBDD_OTEL_THREAD_CTX_INLINE"); |
88 | 86 |
|
89 | | - let inline_mode = env::var_os("LIBDD_OTEL_THREAD_CTX_INLINE").is_some(); |
| 87 | + let inline_mode = env::var("LIBDD_OTEL_THREAD_CTX_INLINE").unwrap(); |
90 | 88 | let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); |
91 | 89 | let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); |
92 | 90 |
|
93 | | - if inline_mode { |
| 91 | + if &inline_mode == "1" { |
94 | 92 | let rust_lld_dir = require_lld_for_inline(&target_arch); |
95 | 93 |
|
96 | 94 | // Emit link args for ALL link types (not just cdylib) so that test |
97 | | - // binaries also link correctly when RUSTFLAGS sets clang as the linker. |
| 95 | + // binaries also link correctly when RUSTFLAGS sets clang as the linker (although we should |
| 96 | + // only build the shared object file in inline mode). |
98 | 97 | if let Some(dir) = rust_lld_dir { |
99 | 98 | println!("cargo:rustc-link-arg=-B{}", dir.display()); |
100 | 99 | } |
101 | 100 | println!("cargo:rustc-link-arg=-fuse-ld=lld"); |
102 | 101 |
|
103 | 102 | // On x86-64, tell the LLVM backend to use TLSDESC during LTO codegen. |
104 | | - // On aarch64 TLSDESC is the only model, so no flag is needed. |
| 103 | + // On aarch64 TLSDESC is the default and the only model. |
105 | 104 | if target_arch == "x86_64" { |
106 | 105 | println!("cargo:rustc-link-arg=-Wl,-mllvm,-enable-tlsdesc"); |
107 | 106 | } |
|
0 commit comments