This revision was automatically updated to reflect the committed changes. Closed by commit rG92a606f6de77: [HIP] Pass -Xoffload-linker option to device linker (authored by yaxunl). Herald added a project: clang.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126704/new/ https://reviews.llvm.org/D126704 Files: clang/lib/Driver/ToolChains/HIPAMD.cpp clang/test/Driver/hip-options.hip Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -106,3 +106,13 @@ // RUN: --offload-arch=gfx906 -fopenmp -fopenmp-targets=amdgcn %s 2>&1 \ // RUN: | FileCheck -check-prefix=OMPTGT %s // OMPTGT: unsupported option '-fopenmp-targets=' for language mode 'HIP' + +// Check -Xoffload-linker option is passed to lld. + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 -fgpu-rdc -Xoffload-linker --build-id=md5 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=OFL-LINK %s +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 -Xoffload-linker --build-id=md5 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=OFL-LINK %s +// OFL-LINK: lld{{.*}}"--build-id=md5" Index: clang/lib/Driver/ToolChains/HIPAMD.cpp =================================================================== --- clang/lib/Driver/ToolChains/HIPAMD.cpp +++ clang/lib/Driver/ToolChains/HIPAMD.cpp @@ -147,6 +147,9 @@ addLinkerCompressDebugSectionsOption(TC, Args, LldArgs); + for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) + LldArgs.push_back(Arg->getValue(1)); + LldArgs.append({"-o", Output.getFilename()}); for (auto Input : Inputs) LldArgs.push_back(Input.getFilename());
Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -106,3 +106,13 @@ // RUN: --offload-arch=gfx906 -fopenmp -fopenmp-targets=amdgcn %s 2>&1 \ // RUN: | FileCheck -check-prefix=OMPTGT %s // OMPTGT: unsupported option '-fopenmp-targets=' for language mode 'HIP' + +// Check -Xoffload-linker option is passed to lld. + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 -fgpu-rdc -Xoffload-linker --build-id=md5 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=OFL-LINK %s +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 -Xoffload-linker --build-id=md5 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=OFL-LINK %s +// OFL-LINK: lld{{.*}}"--build-id=md5" Index: clang/lib/Driver/ToolChains/HIPAMD.cpp =================================================================== --- clang/lib/Driver/ToolChains/HIPAMD.cpp +++ clang/lib/Driver/ToolChains/HIPAMD.cpp @@ -147,6 +147,9 @@ addLinkerCompressDebugSectionsOption(TC, Args, LldArgs); + for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) + LldArgs.push_back(Arg->getValue(1)); + LldArgs.append({"-o", Output.getFilename()}); for (auto Input : Inputs) LldArgs.push_back(Input.getFilename());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits