In order to do offloading compilation we need to embed files into the host and create fatbainaries. Clang uses a special binary format to bundle several files along with their metadata into a single binary image. This is currently performed using the `-fembed-offload-binary` option. However this is not very extensibile since it requires changing the command flag every time we want to add something and makes optional arguments difficult. This patch introduces a new tool called `clang-offload-packager` that behaves similarly to CUDA's `fatbinary`. This tool takes several input files with metadata and embeds it into a single image that can then be embedded in the host. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D125165
16 lines
720 B
LLVM
16 lines
720 B
LLVM
; RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm \
|
|
; RUN: -fembed-offload-object=%S/Inputs/empty.h \
|
|
; RUN: -fembed-offload-object=%S/Inputs/empty.h -x ir %s -o - \
|
|
; RUN: | FileCheck %s -check-prefix=CHECK
|
|
|
|
; CHECK: @[[OBJECT_1:.+]] = private constant [0 x i8] zeroinitializer, section ".llvm.offloading", align 8
|
|
; CHECK: @[[OBJECT_2:.+]] = private constant [0 x i8] zeroinitializer, section ".llvm.offloading", align 8
|
|
; CHECK: @llvm.compiler.used = appending global [3 x ptr] [ptr @x, ptr @[[OBJECT_1]], ptr @[[OBJECT_2]]], section "llvm.metadata"
|
|
|
|
@x = private constant i8 1
|
|
@llvm.compiler.used = appending global [1 x ptr] [ptr @x], section "llvm.metadata"
|
|
|
|
define i32 @foo() {
|
|
ret i32 0
|
|
}
|