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); ---------------- MaskRay wrote: > jhuber6 wrote: > > yaxunl wrote: > > > jhuber6 wrote: > > > > 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`. > > > That would be better. Thanks. > > It still is technically cross compiling, since we are building for a target > > that does not match the system's architecture. The original code that > > prevents passing `-L` was contributed by @MaskRay. I understand that we may > > not want to pass `LIBRARY_PATH` defines, but what's the rationale for not > > passing any `-L` options manually specified by the user? > The `LIBRARY_PATH` code had been there when I moved it in 2019. It'd be best > not to rely on `LIBRARY_PATH`. I think that forwarding `-L` seems reasonable > but I am not familiar with the amdgpu ecosystem.. The linker is just `lld` so it should be the same conceptually. I'm just figuring that even if the user is cross compiling we should respect `-L` passed on the command line. Should I change this patch to make that change? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150013/new/ https://reviews.llvm.org/D150013 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits