mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[ThinLTO] Fix .llvmcmd emission
llvm::EmbedBitcodeInModule needs (what used to be called) EmbedMarker set, in order to emit .llvmcmd. EmbedMarker is really about embedding the command line, so renamed the parameter accordingly, too. This was not caught at test because the check-prefix was incorrect, but FileCheck does not report that when multiple prefixes are provided. A separate patch will address that. Differential Revision: https://reviews.llvm.org/D90278
This commit is contained in:
parent
7b72307eb3
commit
5f21904e7d
@ -158,11 +158,11 @@ class raw_ostream;
|
||||
/// pass an empty (default-initialized) MemoryBufferRef, and the serialization
|
||||
/// will be handled by this API. The same behavior happens if the provided Buf
|
||||
/// is not bitcode (i.e. if it's invalid data or even textual LLVM assembly).
|
||||
/// If EmbedMarker is set, the command line is also exported in
|
||||
/// If EmbedCmdline is set, the command line is also exported in
|
||||
/// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs
|
||||
/// were empty.
|
||||
void EmbedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode,
|
||||
bool EmbedMarker,
|
||||
bool EmbedCmdline,
|
||||
const std::vector<uint8_t> &CmdArgs);
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -4834,7 +4834,7 @@ static const char *getSectionNameForCommandline(const Triple &T) {
|
||||
}
|
||||
|
||||
void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
|
||||
bool EmbedBitcode, bool EmbedMarker,
|
||||
bool EmbedBitcode, bool EmbedCmdline,
|
||||
const std::vector<uint8_t> &CmdArgs) {
|
||||
// Save llvm.compiler.used and remove it.
|
||||
SmallVector<Constant *, 2> UsedArray;
|
||||
@ -4892,7 +4892,7 @@ void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
|
||||
}
|
||||
|
||||
// Skip if only bitcode needs to be embedded.
|
||||
if (EmbedMarker) {
|
||||
if (EmbedCmdline) {
|
||||
// Embed command-line options.
|
||||
ArrayRef<uint8_t> CmdData(const_cast<uint8_t *>(CmdArgs.data()),
|
||||
CmdArgs.size());
|
||||
|
@ -373,8 +373,7 @@ bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
|
||||
dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but "
|
||||
"command line arguments are not available");
|
||||
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
|
||||
/*EmbedBitcode*/ true,
|
||||
/*EmbedMarker*/ false,
|
||||
/*EmbedBitcode*/ true, /*EmbedCmdline*/ true,
|
||||
/*Cmdline*/ CmdArgs);
|
||||
}
|
||||
// FIXME: Plumb the combined index into the new pass manager.
|
||||
@ -398,7 +397,7 @@ void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
|
||||
if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized)
|
||||
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
|
||||
/*EmbedBitcode*/ true,
|
||||
/*EmbedMarker*/ false,
|
||||
/*EmbedCmdline*/ false,
|
||||
/*CmdArgs*/ std::vector<uint8_t>());
|
||||
|
||||
std::unique_ptr<ToolOutputFile> DwoOut;
|
||||
|
Loading…
Reference in New Issue
Block a user