diff options
-rw-r--r-- | zjit/build.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/zjit/build.rs b/zjit/build.rs index fc6ad1decf..6aec5407f6 100644 --- a/zjit/build.rs +++ b/zjit/build.rs @@ -1,3 +1,5 @@ +// This build script is only used for `make zjit-test` for building +// the test binary; ruby builds don't use this. fn main() { use std::env; @@ -21,5 +23,13 @@ fn main() { println!("cargo:rustc-link-lib={lib_name}"); } } + + // When doing a combo build, there is a copy of ZJIT symbols in libruby.a + // and Cargo builds another copy for the test binary. Tell the linker to + // not complaint about duplicate symbols. For some reason, darwin doesn't + // suffer the same issue. + if env::var("TARGET").unwrap().contains("linux") { + println!("cargo:rustc-link-arg=-Wl,--allow-multiple-definition"); + } } } |