Include dlmalloc.{h, c} without relative path inclusion

Merged-In: I1b9c95e35751dfef635a2aabe790457e5ccdba71
Test: m com.android.art (with no errors)
Bug: 236243696
Change-Id: I23d44261e8eebc16a6774dca3e99561286bee204
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 809445b..8e77b43 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -130,7 +130,7 @@
         "exec_utils.cc",
         "fault_handler.cc",
         "gc/allocation_record.cc",
-        "gc/allocator/dlmalloc.cc",
+        "gc/allocator/art-dlmalloc.cc",
         "gc/allocator/rosalloc.cc",
         "gc/accounting/bitmap.cc",
         "gc/accounting/card_table.cc",
@@ -455,11 +455,15 @@
     header_libs: [
         "art_cmdlineparser_headers",
         "cpp-define-generator-definitions",
+        "dlmalloc",
         "jni_platform_headers",
         "libart_headers",
         "libnativehelper_header_only",
     ],
-    export_header_lib_headers: ["libart_headers"],
+    export_header_lib_headers: [
+        "dlmalloc",
+        "libart_headers",
+    ],
     whole_static_libs: [
         "libcpu_features",
     ],
diff --git a/runtime/gc/allocator/dlmalloc.cc b/runtime/gc/allocator/art-dlmalloc.cc
similarity index 95%
rename from runtime/gc/allocator/dlmalloc.cc
rename to runtime/gc/allocator/art-dlmalloc.cc
index 79d4fbf..e2dda70 100644
--- a/runtime/gc/allocator/dlmalloc.cc
+++ b/runtime/gc/allocator/art-dlmalloc.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "dlmalloc.h"
+#include "art-dlmalloc.h"
 
 #include <android-base/logging.h>
 
@@ -39,8 +39,8 @@
 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
 #pragma GCC diagnostic ignored "-Wnull-pointer-arithmetic"
 #pragma GCC diagnostic ignored "-Wexpansion-to-defined"
-#include "../../../external/dlmalloc/malloc.c"
-// Note: malloc.c uses a DEBUG define to drive debug code. This interferes with the DEBUG severity
+#include "dlmalloc.c"  // NOLINT - from external/dlmalloc
+// Note: dlmalloc.c uses a DEBUG define to drive debug code. This interferes with the DEBUG severity
 //       of libbase, so undefine it now.
 #undef DEBUG
 #pragma GCC diagnostic pop
diff --git a/runtime/gc/allocator/dlmalloc.h b/runtime/gc/allocator/art-dlmalloc.h
similarity index 90%
rename from runtime/gc/allocator/dlmalloc.h
rename to runtime/gc/allocator/art-dlmalloc.h
index b12691a..a839904 100644
--- a/runtime/gc/allocator/dlmalloc.h
+++ b/runtime/gc/allocator/art-dlmalloc.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_
-#define ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_
+#ifndef ART_RUNTIME_GC_ALLOCATOR_ART_DLMALLOC_H_
+#define ART_RUNTIME_GC_ALLOCATOR_ART_DLMALLOC_H_
 
 #include <cstdint>
 
@@ -33,7 +33,7 @@
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wredundant-decls"
 #pragma GCC diagnostic ignored "-Wnull-pointer-arithmetic"
-#include "../../external/dlmalloc/malloc.h"
+#include "dlmalloc.h"  // from external/dlmalloc
 #pragma GCC diagnostic pop
 
 // Callback for dlmalloc_inspect_all or mspace_inspect_all that will madvise(2) unused
@@ -58,4 +58,4 @@
 }  // namespace gc
 }  // namespace art
 
-#endif  // ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_
+#endif  // ART_RUNTIME_GC_ALLOCATOR_ART_DLMALLOC_H_
diff --git a/runtime/gc/space/dlmalloc_space-inl.h b/runtime/gc/space/dlmalloc_space-inl.h
index 4fc4ada..6041fd0 100644
--- a/runtime/gc/space/dlmalloc_space-inl.h
+++ b/runtime/gc/space/dlmalloc_space-inl.h
@@ -18,7 +18,7 @@
 #define ART_RUNTIME_GC_SPACE_DLMALLOC_SPACE_INL_H_
 
 #include "dlmalloc_space.h"
-#include "gc/allocator/dlmalloc.h"
+#include "gc/allocator/art-dlmalloc.h"
 #include "thread.h"
 
 namespace art {
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 4148660..f725d97 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -40,7 +40,7 @@
 #include "entrypoints/entrypoint_utils-inl.h"
 #include "entrypoints/runtime_asm_entrypoints.h"
 #include "gc/accounting/bitmap-inl.h"
-#include "gc/allocator/dlmalloc.h"
+#include "gc/allocator/art-dlmalloc.h"
 #include "gc/scoped_gc_critical_section.h"
 #include "handle.h"
 #include "handle_scope-inl.h"
diff --git a/runtime/jit/jit_memory_region.cc b/runtime/jit/jit_memory_region.cc
index 56407f5..3f43aca 100644
--- a/runtime/jit/jit_memory_region.cc
+++ b/runtime/jit/jit_memory_region.cc
@@ -27,7 +27,7 @@
 #include "base/membarrier.h"
 #include "base/memfd.h"
 #include "base/systrace.h"
-#include "gc/allocator/dlmalloc.h"
+#include "gc/allocator/art-dlmalloc.h"
 #include "jit/jit_scoped_code_cache_write.h"
 #include "oat_quick_method_header.h"
 #include "palette/palette.h"
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index db5d420..e75afd2 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -41,7 +41,7 @@
 #include "dex/dex_file-inl.h"
 #include "dex/dex_file_types.h"
 #include "gc/accounting/card_table-inl.h"
-#include "gc/allocator/dlmalloc.h"
+#include "gc/allocator/art-dlmalloc.h"
 #include "gc/heap.h"
 #include "gc/space/dlmalloc_space.h"
 #include "gc/space/image_space.h"