1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Generalize the darwin wrapper hack to work with generic macho triples as well as darwin ones.

llvm-svn: 120346
This commit is contained in:
Chris Lattner 2010-11-29 23:29:54 +00:00
parent 4e37703b2c
commit c954211f09

View File

@ -1642,9 +1642,12 @@ void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out) {
/// WriteBitcodeToStream - Write the specified module to the specified output
/// stream.
void llvm::WriteBitcodeToStream(const Module *M, BitstreamWriter &Stream) {
// If this is darwin, emit a file header and trailer if needed.
bool isDarwin = M->getTargetTriple().find("-darwin") != std::string::npos;
if (isDarwin)
// If this is darwin or another generic macho target, emit a file header and
// trailer if needed.
bool isMacho =
M->getTargetTriple().find("-darwin") != std::string::npos ||
M->getTargetTriple().find("-macho") != std::string::npos;
if (isMacho)
EmitDarwinBCHeader(Stream, M->getTargetTriple());
// Emit the file header.
@ -1658,6 +1661,6 @@ void llvm::WriteBitcodeToStream(const Module *M, BitstreamWriter &Stream) {
// Emit the module.
WriteModule(M, Stream);
if (isDarwin)
if (isMacho)
EmitDarwinBCTrailer(Stream, Stream.getBuffer().size());
}