Refactor linker files from compiler/ to dex2oat/.

This shifts some code from the libart-compiler.so to dex2oat
and reduces memory needed for JIT. We also avoid loading the
libart-dexlayout.so for JIT but the memory savings are
minimal (one shared clean page, two shared dirty pages and
some per-app kernel mmap data) as the code has never been
needed in memory by JIT.

aosp_angler-userdebug file sizes (stripped):
  lib64/libart-compiler.so: 2989112 -> 2671888 (-310KiB)
  lib/libart-compiler.so: 2160816 -> 1939276 (-216KiB)
  bin/dex2oat: 141868 -> 368808 (+222KiB)
LOAD/executable elf mapping sizes:
  lib64/libart-compiler.so: 2866308 -> 2555500 (-304KiB)
  lib/libart-compiler.so: 2050960 -> 1834836 (-211KiB)
  bin/dex2oat: 129316 -> 345916 (+212KiB)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: cd art/; mma; cd -
Change-Id: If62f02847a6cbb208eaf7e1f3e91af4663fa4a5f
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 7b11258..36bd4bc 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -41,7 +41,6 @@
 #include "dex_file-inl.h"
 #include "dex_instruction-inl.h"
 #include "disassembler.h"
-#include "elf_builder.h"
 #include "gc/accounting/space_bitmap-inl.h"
 #include "gc/space/image_space.h"
 #include "gc/space/large_object_space.h"
@@ -51,6 +50,7 @@
 #include "indenter.h"
 #include "interpreter/unstarted_runtime.h"
 #include "linker/buffered_output_stream.h"
+#include "linker/elf_builder.h"
 #include "linker/file_output_stream.h"
 #include "mirror/array-inl.h"
 #include "mirror/class-inl.h"
@@ -133,9 +133,10 @@
     if (elf_file == nullptr) {
       return false;
     }
-    std::unique_ptr<BufferedOutputStream> output_stream =
-        std::make_unique<BufferedOutputStream>(std::make_unique<FileOutputStream>(elf_file.get()));
-    builder_.reset(new ElfBuilder<ElfTypes>(isa, features.get(), output_stream.get()));
+    std::unique_ptr<linker::BufferedOutputStream> output_stream =
+        std::make_unique<linker::BufferedOutputStream>(
+            std::make_unique<linker::FileOutputStream>(elf_file.get()));
+    builder_.reset(new linker::ElfBuilder<ElfTypes>(isa, features.get(), output_stream.get()));
 
     builder_->Start();
 
@@ -326,7 +327,7 @@
 
  private:
   const OatFile* oat_file_;
-  std::unique_ptr<ElfBuilder<ElfTypes> > builder_;
+  std::unique_ptr<linker::ElfBuilder<ElfTypes>> builder_;
   std::vector<debug::MethodDebugInfo> method_debug_infos_;
   std::unordered_set<uint32_t> seen_offsets_;
   const std::string output_name_;