[clang] [HIP] Support device-only linking of bitcode offload binaries (PR #212342)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 19:43:27 PDT 2026


================
@@ -0,0 +1,53 @@
+// REQUIRES: amdgpu-registered-target
+// REQUIRES: lld
+
+// RUN: %clang --target=amdgcn-amd-amdhsa -emit-llvm -c -nogpulib -DVAR=x %s -o %t.x.bc
+// RUN: %clang --target=amdgcn-amd-amdhsa -emit-llvm -c -nogpulib -DVAR=y %s -o %t.y.bc
+// RUN: llvm-offload-binary -o %t.x.bundle.bc \
+// RUN:   --image=file=%t.x.bc,triple=amdgcn-amd-amdhsa,arch=gfx906,kind=hip \
+// RUN:   --image=file=%t.x.bc,triple=amdgcn-amd-amdhsa,arch=gfx942,kind=hip
+// RUN: llvm-offload-binary -o %t.y.bundle.bc \
----------------
yxsamliu wrote:

The `.bc` suffix is intentional. Here, `OffloadBinary` is a container for bitcode, just like the legacy bundled-bitcode format was a container for bitcode. Clang has no separate file type or extension for either container, so it continues to use `.bc`. This also matches HIPRT’s current workflow.

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


More information about the cfe-commits mailing list