Fix debug dump and error output.

Bug swiftshader:6

Change-Id: I170feba4050b750727fa57927545996577123e30
Reviewed-on: https://swiftshader-review.googlesource.com/7930
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8155
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index d2833c9..77e159a 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -245,6 +245,7 @@
 		}
 
 		// Expect ELF bitness to match platform
+		assert(sizeof(void*) == 8 ? elfHeader->getFileClass() == ELFCLASS64 : elfHeader->getFileClass() == ELFCLASS32);
 		assert(sizeof(void*) == 8 ? elfHeader->e_machine == EM_X86_64 : elfHeader->e_machine == EM_386);
 
 		SectionHeader *sectionHeader = (SectionHeader*)(elfImage + elfHeader->e_shoff);
@@ -383,20 +384,22 @@
 		Flags.setOutFileType(Ice::FT_Elf);
 		Flags.setOptLevel(Ice::Opt_2);
 		Flags.setApplicationBinaryInterface(Ice::ABI_Platform);
+		Flags.setVerbose(false ? Ice::IceV_All : Ice::IceV_None);
 
-		std::unique_ptr<Ice::Ostream> cout(new llvm::raw_os_ostream(std::cout));
+		static llvm::raw_os_ostream cout(std::cout);
+		static llvm::raw_os_ostream cerr(std::cerr);
 
 		if(false)   // Write out to a file
 		{
 			std::error_code errorCode;
 			::out = new Ice::Fdstream("out.o", errorCode, llvm::sys::fs::F_None);
 			::elfFile = new Ice::ELFFileStreamer(*out);
-			::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfFile);
+			::context = new Ice::GlobalContext(&cout, &cout, &cerr, elfFile);
 		}
 		else
 		{
 			ELFMemoryStreamer *elfMemory = new ELFMemoryStreamer();
-			::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfMemory);
+			::context = new Ice::GlobalContext(&cout, &cout, &cerr, elfMemory);
 			::routine = elfMemory;
 		}
 	}