diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -276,6 +276,14 @@ /// CUDA runtime back-end for incorporating them into host-side object file. std::string CudaGpuBinaryFileName; + /// List of file passed with -fembed-offload-binary option to embed + /// device-side offloading binaries in the host object file. + std::string OffloadBinaryString; + + /// List of section names pass with -fembed-offload-binary to use when + /// embedding files passed with -fembed-offload-binary. + std::string OffloadSectionString; + /// The name of the file to which the backend should save YAML optimization /// records. std::string OptRecordFile; diff --git a/clang/include/clang/CodeGen/BackendUtil.h b/clang/include/clang/CodeGen/BackendUtil.h --- a/clang/include/clang/CodeGen/BackendUtil.h +++ b/clang/include/clang/CodeGen/BackendUtil.h @@ -44,6 +44,9 @@ void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts, llvm::MemoryBufferRef Buf); + + void EmbedBinary(llvm::Module *M, const CodeGenOptions &CGOpts, + DiagnosticsEngine &Diags); } #endif diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1148,6 +1148,14 @@ PosFlag, NegFlag>; +def fembed_offload_binary_EQ : Joined<["-"], "fembed-offload-binary=">, + Group, Flags<[NoXarchOption, CC1Option]>, + HelpText<"Embed Offloading device-side binary into host object file.">, + MarshallingInfoString>; +def fembed_offload_section_EQ : Joined<["-"], "fembed-offload-section=">, + Group, Flags<[NoXarchOption, CC1Option]>, + HelpText<"Section name to use for the embedded device binary.">, + MarshallingInfoString>; def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">, Group, Flags<[NoXarchOption, CC1Option, CC1AsOption]>, MetaVarName<"