From: Steven Wu Date: Wed, 11 May 2016 16:26:03 +0000 (+0000) Subject: Embed bitcode in object file (clang cc1 part) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22dbcfe84e6eb926e4f77dcd4716e02cf9583f7f;p=clang Embed bitcode in object file (clang cc1 part) Summary: Teach clang to embed bitcode inside bitcode. When -fembed-bitcode cc1 option is used, clang will embed both the input bitcode and cc1 commandline into the bitcode in special sections before compiling to the object file. Using -fembed-bitcode-marker will only introduce a marker in both sections. Depends on D17390 Reviewers: rsmith Subscribers: yaron.keren, vsk, cfe-commits Differential Revision: http://reviews.llvm.org/D17392 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269202 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/CodeGen/BackendUtil.h b/include/clang/CodeGen/BackendUtil.h index a3e3824508..f88057bfe6 100644 --- a/include/clang/CodeGen/BackendUtil.h +++ b/include/clang/CodeGen/BackendUtil.h @@ -16,6 +16,7 @@ namespace llvm { class Module; + class MemoryBufferRef; } namespace clang { @@ -37,6 +38,9 @@ namespace clang { const TargetOptions &TOpts, const LangOptions &LOpts, const llvm::DataLayout &TDesc, llvm::Module *M, BackendAction Action, raw_pwrite_stream *OS); + + void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts, + llvm::MemoryBufferRef Buf); } #endif diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index e367b8c0bb..602e8fa7de 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -450,11 +450,14 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group, Flags<[DriverOption, CC1Option]>, HelpText<"Disable generation of linker directives for automatic library linking">; +def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">, + Group, Flags<[DriverOption, CC1Option]>, MetaVarName<"