diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 5eb3861064e..fd4fd6fb0e1 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -526,6 +526,11 @@ bool BytecodeParser::ParseVersionInfo(const uchar *&Buf, const uchar *EndBuf) { return true; } + TheModule->setEndianness(isBigEndian ? Module::BigEndian : + Module::LittleEndian); + TheModule->setPointerSize(hasLongPointers ? Module::Pointer64 : + Module::Pointer32); + BCR_TRACE(1, "Bytecode Rev = " << (unsigned)RevisionNum << "\n"); BCR_TRACE(1, "BigEndian/LongPointers = " << isBigEndian << "," << hasLongPointers << "\n"); diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 03a6c4668e9..f97d7e232b5 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -43,8 +43,8 @@ BytecodeWriter::BytecodeWriter(std::deque &o, const Module *M) // Emit the top level CLASS block. BytecodeBlock ModuleBlock(BytecodeFormat::Module, Out); - bool isBigEndian = true; - bool hasLongPointers = true; + bool isBigEndian = M->isBigEndian(); + bool hasLongPointers = M->has64BitPointers(); // Output the version identifier... we are currently on bytecode version #2 unsigned Version = (2 << 4) | isBigEndian | (hasLongPointers << 1);