[clang] [llvm] [clang-linker-wrapper][SYCL] Support relocatable linking (PR #242098)

Yury Plyakhin via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 15:49:48 PST 2026


================
@@ -319,11 +319,14 @@
 // RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o \
 // RUN:   -fembed-offload-object=%t.out
 // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu \
-// RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=SYCL
+// RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=SYCL,SYCL-NOREL
 // RUN: clang-linker-wrapper --print-wrapped-module --dry-run --host-triple=x86_64-unknown-linux-gnu -r \
-// RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=SYCL
+// RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefixes=SYCL,SYCL-REL
 
-//      SYCL: @.sycl_offloading.binary = internal unnamed_addr constant [0 x i8] zeroinitializer, section ".llvm.offloading"
+// -r removes .llvm.offloading from the -o file, but the registration code
+// refers to the device image, so the image goes in .sycl_fatbin instead.
----------------
YuriPlyakhin wrote:

nit
the explanation already lives in the code.  I'd drop it here to not maintain several places with the same comment.

https://github.com/llvm/llvm-project/pull/242098


More information about the cfe-commits mailing list