| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// REQUIRES: nvptx-registered-target |
| 3 |
// REQUIRES: amdgpu-registered-target |
| 4 |
// UNSUPPORTED: system-windows |
| 5 |
|
| 6 |
// RUN: rm -rf %t && mkdir -p %t |
| 7 |
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/elf.o |
| 8 |
|
| 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=gfx908 |
| 19 |
// RUN: diff %t/sm_70.o %t/elf.o |
| 20 |
// RUN: diff %t/gfx908.o %t/elf.o |
| 21 |
|
| 22 |
// Check that we generate a new name if one is not given |
| 23 |
// 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=openmp |
| 30 |
// RUN: diff *-nvptx64-nvidia-cuda-sm_70.0.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_70.0.o |
| 31 |
// RUN: diff *-nvptx64-nvidia-cuda-sm_80.1.o %t/elf.o; rm *-nvptx64-nvidia-cuda-sm_80.1.o |
| 32 |
// RUN: diff *-amdgcn-amd-amdhsa-gfx908.2.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx908.2.o |
| 33 |
// RUN: diff *-amdgcn-amd-amdhsa-gfx90a.3.o %t/elf.o; rm *-amdgcn-amd-amdhsa-gfx90a.3.o |
| 34 |
// RUN: not diff *-amdgcn-amd-amdhsa-gfx90c.4.o %t/elf.o |
| 35 |
|
| 36 |
// Check that we can extract from an ELF object file |
| 37 |
// 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_70 |
| 40 |
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out |
| 41 |
// 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=gfx908 |
| 44 |
// RUN: diff %t/sm_70.o %t/elf.o |
| 45 |
// RUN: diff %t/gfx908.o %t/elf.o |
| 46 |
|
| 47 |
// Check that we can extract from a bitcode file |
| 48 |
// 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_70 |
| 51 |
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o %t/package.bc -fembed-offload-object=%t/package.out |
| 52 |
// 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=gfx908 |
| 55 |
// RUN: diff %t/sm_70.o %t/elf.o |
| 56 |
// RUN: diff %t/gfx908.o %t/elf.o |
| 57 |
|
| 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_70 |
| 62 |
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t/package.o -fembed-offload-object=%t/package.out |
| 63 |
// RUN: llvm-ar rcs %t/package.a %t/package.o |
| 64 |
// RUN: llvm-offload-binary %t/package.a --archive --image=file=%t/gfx908.a,arch=gfx908 |
| 65 |
// RUN: llvm-ar t %t/gfx908.a 2>&1 | FileCheck %s |
| 66 |
// CHECK: {{.*}}.o |