Chromium Code Reviews| Index: src/IceELFObjectWriter.cpp |
| diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp |
| index 9c75482def48ede32edf4d4d097cd5b04e14e768..2f86c8dffe1234d7ca93299bb14a14baa22f1397 100644 |
| --- a/src/IceELFObjectWriter.cpp |
| +++ b/src/IceELFObjectWriter.cpp |
| @@ -383,8 +383,9 @@ void ELFObjectWriter::writeDataOfType(SectionType ST, |
| for (VariableDeclaration::Initializer *Init : Var->getInitializers()) { |
| switch (Init->getKind()) { |
| case VariableDeclaration::Initializer::DataInitializerKind: { |
| - const auto Data = llvm::cast<VariableDeclaration::DataInitializer>( |
| - Init)->getContents(); |
| + const auto Data = |
| + llvm::cast<VariableDeclaration::DataInitializer>(Init) |
| + ->getContents(); |
| Section->appendData(Str, llvm::StringRef(Data.data(), Data.size())); |
| break; |
| } |
| @@ -487,7 +488,8 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) { |
| // between entries. |
| assert(WriteAmt % Align == 0); |
| // Check that we write the full PrimType. |
| - assert(WriteAmt == sizeof(typename ConstType::PrimType)); |
| + assert(WriteAmt == sizeof(typename ConstType::PrimType) || |
|
Jim Stichnoth
2015/06/19 16:51:02
I think this assert should be removed. The commen
qining
2015/06/19 20:22:25
Done.
|
| + WriteAmt == sizeof(short) || WriteAmt == sizeof(char)); |
| const Elf64_Xword ShFlags = SHF_ALLOC | SHF_MERGE; |
| std::string SecBuffer; |
| llvm::raw_string_ostream SecStrBuf(SecBuffer); |
| @@ -503,6 +505,8 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) { |
| // Write the data. |
| for (Constant *C : Pool) { |
| + if (!C->shouldBePooled) |
| + continue; |
| auto Const = llvm::cast<ConstType>(C); |
| std::string SymBuffer; |
| llvm::raw_string_ostream SymStrBuf(SymBuffer); |
| @@ -528,6 +532,8 @@ template void ELFObjectWriter::writeConstantPool<ConstantFloat>(Type Ty); |
| template void ELFObjectWriter::writeConstantPool<ConstantDouble>(Type Ty); |
| +template void ELFObjectWriter::writeConstantPool<ConstantInteger32>(Type Ty); |
| + |
| void ELFObjectWriter::writeAllRelocationSections() { |
| writeRelocationSections(RelTextSections); |
| writeRelocationSections(RelDataSections); |