Subzero: Add basic ELFObjectWriter (text section, symtab, strtab, headers).

Able to write out the ELF file header w/ a text section,
a symbol table, and string table. Write text buffer
directly to file after translating each CFG.
This means that the header is written out early w/ fake
data and then we seek back and write the real header
at the very end.

Does not yet handle relocations, data, rodata, constant
pools, bss, or -ffunction-sections, more than 64K sections
or more than 2^24 symbols.

Numbers w/ current NOASSERT=1 build on 176.gcc:

w/out -elf-writer:
    0.233771 (21.1%): [ 1287] emit
    28MB .s file

w/ -elf-writer:
    0.051056 ( 5.6%): [ 1287] emit
    2.4MB .o file

BUG=none
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/678533005
diff --git a/src/assembler_ia32.cpp b/src/assembler_ia32.cpp
index 94263e8..30b84e8 100644
--- a/src/assembler_ia32.cpp
+++ b/src/assembler_ia32.cpp
@@ -20,7 +20,6 @@
 
 #include "assembler_ia32.h"
 #include "IceCfg.h"
-#include "IceMemoryRegion.h"
 #include "IceOperand.h"
 
 namespace Ice {
@@ -37,13 +36,6 @@
         DirectCallRelocation(Kind, Sym);
   }
 
-  void Process(const MemoryRegion &region, intptr_t position) override {
-    // Direct calls are relative to the following instruction on x86.
-    int32_t pointer = region.Load<int32_t>(position);
-    int32_t delta = region.start() + position + sizeof(int32_t);
-    region.Store<int32_t>(position, pointer - delta);
-  }
-
 private:
   DirectCallRelocation(FixupKind Kind, const ConstantRelocatable *Sym)
       : AssemblerFixup(Kind, Sym) {}
@@ -77,6 +69,22 @@
 #endif
 }
 
+void AssemblerX86::alignFunction() {
+  intptr_t Pos = buffer_.GetPosition();
+  SizeT Align = 1 << getBundleAlignLog2Bytes();
+  intptr_t Mod = Pos & (Align - 1);
+  if (Mod == 0) {
+    return;
+  }
+  SizeT BytesNeeded = Align - Mod;
+  const SizeT HltSize = 1;
+  while (BytesNeeded > 0) {
+    hlt();
+    BytesNeeded -= HltSize;
+  }
+  assert((buffer_.GetPosition() & (Align - 1)) == 0);
+}
+
 Label *AssemblerX86::GetOrCreateLabel(SizeT Number, LabelVector &Labels) {
   Label *L = nullptr;
   if (Number == Labels.size()) {