aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-29 23:29:54 +0000
committerChris Lattner <sabre@nondot.org>2010-11-29 23:29:54 +0000
commit695b2811866125cef47915915cb014afa99cd732 (patch)
tree26cc500e7632da6298ffc1391350c6e35c5aeca4
parent03f44a04e63ff77af12df33e10ffdc473609dfe2 (diff)
downloadexternal_llvm-695b2811866125cef47915915cb014afa99cd732.zip
external_llvm-695b2811866125cef47915915cb014afa99cd732.tar.gz
external_llvm-695b2811866125cef47915915cb014afa99cd732.tar.bz2
Generalize the darwin wrapper hack to work with generic macho triples as well as darwin ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120346 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index a1f5b38..c75dfcf 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -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());
}