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/IceTypes.def b/src/IceTypes.def
index 3d4c9b1..0b85ad6 100644
--- a/src/IceTypes.def
+++ b/src/IceTypes.def
@@ -15,13 +15,18 @@
 #ifndef SUBZERO_SRC_ICETYPES_DEF
 #define SUBZERO_SRC_ICETYPES_DEF
 
-#define TARGETARCH_TABLE                                                 \
-  /* enum value, printable string */                                     \
-  X(Target_X8632, "x86-32")                                              \
-  X(Target_X8664, "x86-64")                                              \
-  X(Target_ARM32, "arm32")                                               \
-  X(Target_ARM64, "arm64")                                               \
-//#define X(tag, str)
+// Attributes of each target architecture.
+// NOTE on is_elf64 -- At some point NaCl would like to use ELF32 for all
+// ILP32 sandboxes, but for now the 64-bit architectures use ELF64:
+// https://code.google.com/p/nativeclient/issues/detail?id=349
+// TODO: Whoever adds AArch64 will need to set ABI e_flags.
+#define TARGETARCH_TABLE                                                \
+  /* enum value, printable string, is_elf64, e_machine, e_flags */      \
+  X(Target_X8632, "x86-32", false, EM_386,    0)                        \
+  X(Target_X8664, "x86-64", true,  EM_X86_64, 0)                        \
+  X(Target_ARM32, "arm32",  false, EM_ARM,    EF_ARM_EABI_VER5)         \
+  X(Target_ARM64, "arm64",  true,  EM_AARCH64, 0)                       \
+  //#define X(tag, str, is_elf64, e_machine, e_flags)
 
 #define ICETYPE_TABLE                                                    \
   /* enum value,  size, align, # elts, element type, printable string */ \