Make dexlayout and profman independent of libart

Remove the libart dependency from these two tools.  Dexdiag remains
dependent because vdex_file.* is in runtime.  It could possibly be moved
also.

Bug: 78652467
Test: make -j 40 checkbuild
      make -j 40 test-art-host-gtest

Change-Id: I68a62f8b2a2730067aee5ff5e0cf81acdca0d703
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index bf56239..147af0c 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -39,7 +39,6 @@
         "dex2oat-pgo-defaults",
     ],
     shared_libs: [
-        "libart",
         "libdexfile",
         "libartbase",
         "libprofile",
@@ -61,7 +60,6 @@
       "art_debug_defaults",
     ],
     shared_libs: [
-        "libartd",
         "libdexfiled",
         "libartbased",
         "libprofiled",
@@ -72,7 +70,6 @@
     name: "dexlayout-defaults",
     defaults: ["art_defaults"],
     host_supported: true,
-    srcs: ["dexlayout_main.cc"],
     shared_libs: [
         "libbase",
     ],
@@ -81,9 +78,10 @@
 art_cc_binary {
     name: "dexlayout",
     defaults: ["dexlayout-defaults"],
+    srcs: ["dexlayout_main.cc"],
     shared_libs: [
+        "libdexfile",
         "libprofile",
-        "libart",
         "libartbase",
         "libart-dexlayout",
     ],
@@ -95,9 +93,10 @@
         "art_debug_defaults",
         "dexlayout-defaults",
     ],
+    srcs: ["dexlayout_main.cc"],
     shared_libs: [
+        "libdexfiled",
         "libprofiled",
-        "libartd",
         "libartbased",
         "libartd-dexlayout",
     ],
@@ -121,6 +120,7 @@
     cflags: ["-Wall"],
     shared_libs: [
         "libart",
+        "libdexfile",
         "libartbase",
         "libart-dexlayout",
         "libbase",
diff --git a/dexlayout/dexdiag.cc b/dexlayout/dexdiag.cc
index 6cb141f..aa4e6d0 100644
--- a/dexlayout/dexdiag.cc
+++ b/dexlayout/dexdiag.cc
@@ -27,7 +27,6 @@
 #include "android-base/stringprintf.h"
 
 #include "base/logging.h"  // For InitLogging.
-#include "base/mutex.h"
 #include "base/stringpiece.h"
 
 #include "dexlayout.h"
@@ -37,7 +36,6 @@
 #ifdef ART_TARGET_ANDROID
 #include "pagemap/pagemap.h"
 #endif
-#include "runtime.h"
 #include "vdex_file.h"
 
 namespace art {
@@ -446,6 +444,11 @@
   PrintLetterKey();
 }
 
+NO_RETURN static void Abort(const char* msg) {
+  std::cerr << msg;
+  exit(1);
+}
+
 static int DexDiagMain(int argc, char* argv[]) {
   if (argc < 2) {
     Usage(argv[0]);
@@ -471,8 +474,7 @@
   }
 
   // Art specific set up.
-  Locks::Init();
-  InitLogging(argv, Runtime::Abort);
+  InitLogging(argv, Abort);
   MemMap::Init();
 
 #ifdef ART_TARGET_ANDROID
diff --git a/dexlayout/dexlayout_main.cc b/dexlayout/dexlayout_main.cc
index 185c142..71e56d19 100644
--- a/dexlayout/dexlayout_main.cc
+++ b/dexlayout/dexlayout_main.cc
@@ -34,7 +34,6 @@
 #include "base/logging.h"  // For InitLogging.
 #include "base/mem_map.h"
 #include "profile/profile_compilation_info.h"
-#include "runtime.h"
 
 namespace art {
 
@@ -66,12 +65,17 @@
   LOG(ERROR) << " -x : compact dex generation level, either 'none' or 'fast'";
 }
 
+NO_RETURN static void Abort(const char* msg) {
+  LOG(ERROR) << msg;
+  exit(1);
+}
+
 /*
  * Main driver of the dexlayout utility.
  */
 int DexlayoutDriver(int argc, char** argv) {
   // Art specific set up.
-  InitLogging(argv, Runtime::Abort);
+  InitLogging(argv, Abort);
   MemMap::Init();
 
   Options options;
diff --git a/profman/profman.cc b/profman/profman.cc
index cd88d03..1f77239 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -33,6 +33,7 @@
 
 #include "base/dumpable.h"
 #include "base/logging.h"  // For InitLogging.
+#include "base/mem_map.h"
 #include "base/scoped_flock.h"
 #include "base/stringpiece.h"
 #include "base/time_utils.h"
@@ -49,7 +50,6 @@
 #include "dex/type_reference.h"
 #include "profile/profile_compilation_info.h"
 #include "profile_assistant.h"
-#include "runtime.h"
 
 namespace art {
 
@@ -177,6 +177,11 @@
 static constexpr char kMethodFlagStringStartup = 'S';
 static constexpr char kMethodFlagStringPostStartup = 'P';
 
+NO_RETURN static void Abort(const char* msg) {
+  LOG(ERROR) << msg;
+  exit(1);
+}
+
 // TODO(calin): This class has grown too much from its initial design. Split the functionality
 // into smaller, more contained pieces.
 class ProfMan FINAL {
@@ -202,8 +207,8 @@
     original_argc = argc;
     original_argv = argv;
 
-    Locks::Init();
-    InitLogging(argv, Runtime::Abort);
+    MemMap::Init();
+    InitLogging(argv, Abort);
 
     // Skip over the command name.
     argv++;