Skip to content

offload: automate manual clang-linker-wrapper step - #162309

Draft
sgasho wants to merge 1 commit into
rust-lang:mainfrom
sgasho:offload-clang-linker-wrapper
Draft

offload: automate manual clang-linker-wrapper step#162309
sgasho wants to merge 1 commit into
rust-lang:mainfrom
sgasho:offload-clang-linker-wrapper

Conversation

@sgasho

@sgasho sgasho commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

automate manual clang-linker-wrapper step from https://rustc-dev-guide.rust-lang.org/offload/usage.html
extract bitcode from device.bin and then wraps it into the host module.
needs some refactoring.

r? @ZuseZ4

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 4, 2026
pub(crate) struct OffloadEmbedFailed;

#[derive(Diagnostic)]
#[diag("call to WrapImages failed, `wrapper.o` was not created")]

@sgasho sgasho Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO(tomorrow): I forgot to fix the diag comment. wrapper.o no longer exists.

View changes since the review

);

if sess.opts.unstable_opts.offload.iter().any(|o| matches!(o, config::Offload::Host(_))) {
cmd.link_dylib_by_name("omptarget", false, true);

@ZuseZ4 ZuseZ4 Sep 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to your last PR, we should ship these in our sysroot. Is it guaranteed to be on our default search path? If not, we might want to add an rpath or -L, or?

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants