[PATCH] D158582: [AMDGPU] Respect unresolved symbol option if forwarded to linker

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 07:31:55 PDT 2023


jhuber6 added a comment.

In D158582#4610023 <https://reviews.llvm.org/D158582#4610023>, @yaxunl wrote:

> The `-Wl` and `-Xlinker` options are intended for the host linker and we intentionally do not pass them to the device linker.
>
> If users want to pass options to the device linker, they need to use -Xoffload-linker.
>
> There are multiple options affecting the handling of unresolved symbols. I think the proper way is to use `--no-undefined` as the default, which is always passed before those options from `-Xoffload-linker` so that the latter can override the former.
>
> I believe the driver already passes `-Xoffload-linker`  options to amdgpu::Linker::ConstructJob by Args. I think we probably only need to move all the default options (line 563-566) to 554 so that they can be overridden.

Yeah, the original problem was not being able to overload the defaults. This fundamentally is just because the `-Wl` options are being added in `AddLinkerInputs` before the defaults. Surprised I didn't catch that, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158582



More information about the cfe-commits mailing list