-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVMRust symbols not defined when building with -Zcross-crate-inline-threshold=always #118084
Comments
This flag causes all the rust code to be built downstream in rustc-main, I suspect the LLVMRust C++ symbols aren't being exported from librustc_driver. |
Try adding
extern "C" block that declares a function. This tells rustc that it needs to re-export these functions of the static library from the produced dylib.
|
Progress! I now have a pile of
|
Is LLVM statically or dynamically linked for you? If it is dynamically linked, I think the |
Dynamic. That got me down to just a few linker errors that now fit on my screen. I think I also need a link name on the normal LLVM extern block, but the name is something like "LLVM-17-rust-1.76.0-nightly". |
For dynamic libraries it shouldn't matter. The build script already adds a |
Functions starting with LLVMTimeTraceProfiler despite the name are defined in our llvm-wrapper, so should get the same treatment as those starting with LLVMRust. |
maybe they should be renamed instead 🙃 |
Yeah, I can do that |
Rollup merge of rust-lang#118142 - saethlin:llvm-linkage, r=tmiasko Tighten up link attributes for llvm-wrapper bindings Fixes rust-lang#118084 by moving all of the declarations of symbols from `llvm_rust` into a separate extern block with `#[link(name = "llvm-wrapper", kind = "static")]`. This also renames `LLVMTimeTraceProfiler*` to `LLVMRustTimeTraceProfiler*` because those are functions from `llvm_rust`. r? tmiasko
Tighten up link attributes for llvm-wrapper bindings Fixes rust-lang/rust#118084 by moving all of the declarations of symbols from `llvm_rust` into a separate extern block with `#[link(name = "llvm-wrapper", kind = "static")]`. This also renames `LLVMTimeTraceProfiler*` to `LLVMRustTimeTraceProfiler*` because those are functions from `llvm_rust`. r? tmiasko
I tried this code:
I expected to see this happen: build succeeds
Instead, this happened: huge linker error
... and on and on and on...
(it is entirely possible that the flag is broken, I haven't tried using it very many places yet)
The text was updated successfully, but these errors were encountered: