[llvm] r258627 - [Bitcode] Insert the darwin wrapper at the beginning of a file when the

Akira Hatanaka via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 23 08:02:10 PST 2016


Author: ahatanak
Date: Sat Jan 23 10:02:10 2016
New Revision: 258627

URL: http://llvm.org/viewvc/llvm-project?rev=258627&view=rev
Log:
[Bitcode] Insert the darwin wrapper at the beginning of a file when the
target is macho.

It looks like the check for macho was accidentally dropped in r132959.

I don't have a test case, but I'll add one if anyone knows how this can
be tested.

Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=258627&r1=258626&r2=258627&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Sat Jan 23 10:02:10 2016
@@ -3045,7 +3045,7 @@ void llvm::WriteBitcodeToFile(const Modu
   // If this is darwin or another generic macho target, reserve space for the
   // header.
   Triple TT(M->getTargetTriple());
-  if (TT.isOSDarwin())
+  if (TT.isOSDarwin() || TT.isOSBinFormatMachO())
     Buffer.insert(Buffer.begin(), DarwinBCHeaderSize, 0);
 
   // Emit the module into the buffer.
@@ -3067,7 +3067,7 @@ void llvm::WriteBitcodeToFile(const Modu
                 EmitFunctionSummary);
   }
 
-  if (TT.isOSDarwin())
+  if (TT.isOSDarwin() || TT.isOSBinFormatMachO())
     EmitDarwinBCHeaderAndTrailer(Buffer, TT);
 
   // Write the generated bitstream to "Out".




More information about the llvm-commits mailing list