[clang] Revert "[Clang][OpenMP][Driver] Make linker to link Device RTL when built for SPIRV" (PR #181876)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 10:12:19 PST 2026


https://github.com/fineg74 created https://github.com/llvm/llvm-project/pull/181876

Reverts llvm/llvm-project#180066

>From 46d540c340be2a12bbef4b5d3d5f9bea0e127a27 Mon Sep 17 00:00:00 2001
From: fineg74 <61437305+fineg74 at users.noreply.github.com>
Date: Tue, 17 Feb 2026 10:11:48 -0800
Subject: [PATCH] =?UTF-8?q?Revert=20"[Clang][OpenMP][Driver]=20Make=20link?=
 =?UTF-8?q?er=20to=20link=20Device=20RTL=20=20when=20built=20fo=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit db547e8846c9830f6843d41c310f8f707a470914.
---
 clang/lib/Driver/ToolChains/Clang.cpp  |  2 +-
 clang/test/Driver/openmp-offload-gpu.c | 17 -----------------
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 1421c3b3b1ea4..c16aa33f29ebb 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9304,7 +9304,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
 
       // If this is OpenMP the device linker will need `-lompdevice`.
       if (Kind == Action::OFK_OpenMP && !Args.hasArg(OPT_no_offloadlib) &&
-          TC->getTriple().isGPU())
+          (TC->getTriple().isAMDGPU() || TC->getTriple().isNVPTX()))
         LinkerArgs.emplace_back("-lompdevice");
 
       // Forward all of these to the appropriate toolchain.
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c
index f12e79868fca2..fb1bc9ffdbbd4 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -410,20 +410,3 @@
 // RUN:   | FileCheck --check-prefix=SHOULD-EXTRACT %s
 //
 // SHOULD-EXTRACT: clang-linker-wrapper{{.*}}"--should-extract=gfx906"
-
-//
-// Check ompdevice is linked.
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=nvptx64 --offload-arch=sm_52 \
-// RUN:     --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:     --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=amdgcn --offload-arch=gfx908 \
-// RUN:     --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=spirv64 \
-// RUN:     --libomptarget-spirv-bc-path=%S/Inputs/spirv-openmp/lib/libomptarget-spirv.bc %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-// OMPDEVICE: clang-linker-wrapper{{.*}}--device-linker{{.*}}-lompdevice



More information about the cfe-commits mailing list