67 lines · c
1// REQUIRES: x86-registered-target2// REQUIRES: nvptx-registered-target3// REQUIRES: amdgpu-registered-target4// UNSUPPORTED: system-windows5 6// RUN: rm -rf %t && mkdir -p %t7// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/elf.o8 9// Check that we can extract files from the packaged binary.10// RUN: llvm-offload-binary -o %t/package.out \11// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \12// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \13// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \14// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \15// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90c 16// RUN: llvm-offload-binary %t/package.out \17// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \18// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90819// RUN: diff %t/sm_70.o %t/elf.o20// RUN: diff %t/gfx908.o %t/elf.o21 22// Check that we generate a new name if one is not given23// RUN: llvm-offload-binary -o %t/package \24// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \25// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_80 \26// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \27// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90a \28// RUN: --image=file=%t/elf.o,kind=hip,triple=amdgcn-amd-amdhsa,arch=gfx90c 29// RUN: llvm-offload-binary %t/package --image=kind=openmp30// RUN: diff *-nvptx64-nvidia-cuda-sm_70.0.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_70.0.o31// RUN: diff *-nvptx64-nvidia-cuda-sm_80.1.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_80.1.o32// RUN: diff *-amdgcn-amd-amdhsa-gfx908.2.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx908.2.o33// RUN: diff *-amdgcn-amd-amdhsa-gfx90a.3.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx90a.3.o34// RUN: not diff *-amdgcn-amd-amdhsa-gfx90c.4.o %t/elf.o35 36// Check that we can extract from an ELF object file37// RUN: llvm-offload-binary -o %t/package.out \38// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \39// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_7040// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out41// RUN: llvm-offload-binary %t/package.out \42// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \43// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90844// RUN: diff %t/sm_70.o %t/elf.o45// RUN: diff %t/gfx908.o %t/elf.o46 47// Check that we can extract from a bitcode file48// RUN: llvm-offload-binary -o %t/package.out \49// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \50// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_7051// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o %t/package.bc -fembed-offload-object=%t/package.out52// RUN: llvm-offload-binary %t/package.out \53// RUN: --image=file=%t/sm_70.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \54// RUN: --image=file=%t/gfx908.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx90855// RUN: diff %t/sm_70.o %t/elf.o56// RUN: diff %t/gfx908.o %t/elf.o57 58// Check that we can extract from an archive file to an archive file.59// RUN: llvm-offload-binary -o %t/package.out \60// RUN: --image=file=%t/elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \61// RUN: --image=file=%t/elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_7062// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out63// RUN: llvm-ar rcs %t/package.a %t/package.o64// RUN: llvm-offload-binary %t/package.a --archive --image=file=%t/gfx908.a,arch=gfx90865// RUN: llvm-ar t %t/gfx908.a 2>&1 | FileCheck %s66// CHECK: {{.*}}.o67