[PATCH] D150013: [Clang] Respect `-L` options when compiling directly for AMDGPU

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 6 08:18:48 PDT 2023


jhuber6 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AMDGPU.cpp:546
   addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+  Args.AddAllArgs(CmdArgs, options::OPT_L);
----------------
yaxunl wrote:
> AddLinkerInputs has code doing that, and it handles env var LIBRARY_PATH. However that code is disabled for AMDGPU because AMDGPU returns true for isCrossCompiling.
> 
> https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/CommonArgs.cpp#L236
> 
> It seems isCrossCompiling is solely for controlling whether to consume `-L`. If we want amdgpu toolchain to accept `-L`, we can simply let isCrossCompiling return false.
Good catch, we could maybe set `isCrossCompiling` to false if targeted directly by the user, e.g. `--target=amdgcn-amd-amdhsa` vs `--offload-arch`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150013



More information about the cfe-commits mailing list