[OpenMP] Try to embed offloading objects after codegen
authorJoseph Huber <jhuber6@vols.utk.edu>
Mon, 21 Feb 2022 15:07:37 +0000 (10:07 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 15 Mar 2022 00:08:24 +0000 (20:08 -0400)
commit806bbc49dc07465eddc883b09d48dd93fb64d147
tree6f9cee2f7b7dce6dbde37d52fdbf773b0f7532fd
parentc4500de255c3b3088f903d6be1913e8e8c504482
[OpenMP] Try to embed offloading objects after codegen

Currently we use the `-fembed-offload-object` option to embed a binary
file into the host as a named section. This is currently only used as a
codegen action, meaning we only handle this option correctly when the
input is a bitcode file. This patch adds the same handling to embed an
offloading object after we complete code generation. This allows us to
embed the object correctly if the input file is source or bitcode.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D120270
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/Frontend/embed-object.c [new file with mode: 0644]