[PATCH] D126398: [Clang] Introduce `-dl` option to perform offload device linking

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 25 11:19:02 PDT 2022


jhuber6 added a comment.

In D126398#3537942 <https://reviews.llvm.org/D126398#3537942>, @tra wrote:

> Naming, as usual, is hard. I would prefer a more explicit `--offload-link` which would be in line with other --offload* options we have by now. 
> `-dl` is cryptic for uninitiated and is uncomfortably close to commonly used `-ldl`. If it gets mistyped as `-ld`, it would lead to a legitimate but unrelated error about missing `libd`. Or it might silently succeed linking with `libd` without actually doing any device linking.

Yeah, I can see your point, `--offload-link` definitely works but it would be nice to have something less verbose. Maybe could just use `-dlink` or something.

>> I was considering if this could be merged into the -fuse-ld option,
>> but becuse the device linker wraps over the users linker it would
>> conflict with that. In the future it's possible to merge this into lld
>> completely or gold via a plugin. Let me know what you think for this.

I should also add, even if we built-in support for this into LLD or Gold, we'll probably still need a flag like this to tell Gold to use the plugin, or LLD to do the extra processing.

Unrelated, but in the future I'm also considering making the linker wrapper add the necessary libraries for whatever offloading kinds it found. E.g. if the link job finds embedded `OpenMP` code it will add `-lomp -lomptarget` if not already present.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126398/new/

https://reviews.llvm.org/D126398



More information about the cfe-commits mailing list