Merge "Isolate concurrent collector related libcore failures."
diff --git a/Android.mk b/Android.mk
index 34022ae..4f73127 100644
--- a/Android.mk
+++ b/Android.mk
@@ -400,6 +400,35 @@
$(TEST_ART_ADB_ROOT_AND_REMOUNT)
adb sync
+####################################################################################################
+# Fake packages to ensure generation of libopenjdkd when one builds with mm/mmm/mmma.
+#
+# The library is required for starting a runtime in debug mode, but libartd does not depend on it
+# (dependency cycle otherwise).
+#
+# Note: * As the package is phony to create a dependency the package name is irrelevant.
+# * We make MULTILIB explicit to "both," just to state here that we want both libraries on
+# 64-bit systems, even if it is the default.
+
+# ART on the host.
+ifeq ($(ART_BUILD_HOST_DEBUG),true)
+include $(CLEAR_VARS)
+LOCAL_MODULE := art-libartd-libopenjdkd-host-dependency
+LOCAL_MULTILIB := both
+LOCAL_REQUIRED_MODULES := libopenjdkd
+LOCAL_IS_HOST_MODULE := true
+include $(BUILD_PHONY_PACKAGE)
+endif
+
+# ART on the target.
+ifeq ($(ART_BUILD_TARGET_DEBUG),true)
+include $(CLEAR_VARS)
+LOCAL_MODULE := art-libartd-libopenjdkd-target-dependency
+LOCAL_MULTILIB := both
+LOCAL_REQUIRED_MODULES := libopenjdkd
+include $(BUILD_PHONY_PACKAGE)
+endif
+
########################################################################
# "m build-art" for quick minimal build
.PHONY: build-art
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 3d16c49..af64470 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -441,7 +441,7 @@
$(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
$$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
$$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
- $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libopenjdk.so \
+ $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libopenjdkd.so \
$$(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar \
$$(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
@@ -485,7 +485,7 @@
# Dependencies for all host gtests.
gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
$$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
- $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$$(ART_HOST_SHLIB_EXTENSION) \
+ $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$$(ART_HOST_SHLIB_EXTENSION) \
$$(gtest_exe) \
$$(ART_GTEST_$(1)_HOST_DEPS) \
$(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX))
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index 624abb9..a4e16ae 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -429,7 +429,7 @@
CHECK_EQ(0, dlclose(handle));
}
{
- void* handle = dlopen("libopenjdk.so", RTLD_LAZY);
+ void* handle = dlopen("libopenjdkd.so", RTLD_LAZY);
dlclose(handle);
CHECK_EQ(0, dlclose(handle));
}
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index 57d623e..52da28b 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -27,7 +27,6 @@
#include "base/unix_file/fd_file.h"
#include "elf_file_impl.h"
#include "elf_utils.h"
-#include "jit/debugger_interface.h"
#include "leb128.h"
#include "utils.h"
@@ -53,8 +52,6 @@
hash_section_start_(nullptr),
symtab_symbol_table_(nullptr),
dynsym_symbol_table_(nullptr),
- jit_elf_image_(nullptr),
- jit_gdb_entry_(nullptr),
requested_base_(requested_base) {
CHECK(file != nullptr);
}
@@ -273,10 +270,6 @@
STLDeleteElements(&segments_);
delete symtab_symbol_table_;
delete dynsym_symbol_table_;
- delete jit_elf_image_;
- if (jit_gdb_entry_) {
- DeleteJITCodeEntry(jit_gdb_entry_);
- }
}
template <typename ElfTypes>
@@ -1300,11 +1293,6 @@
return false;
}
- // Use GDB JIT support to do stack backtrace, etc.
- if (executable) {
- GdbJITSupport();
- }
-
return true;
}
@@ -1395,50 +1383,6 @@
}
template <typename ElfTypes>
-void ElfFileImpl<ElfTypes>::GdbJITSupport() {
- // We only get here if we only are mapping the program header.
- DCHECK(program_header_only_);
-
- // Well, we need the whole file to do this.
- std::string error_msg;
- // Make it MAP_PRIVATE so we can just give it to gdb if all the necessary
- // sections are there.
- std::unique_ptr<ElfFileImpl<ElfTypes>> all_ptr(
- Open(const_cast<File*>(file_), PROT_READ | PROT_WRITE, MAP_PRIVATE, &error_msg));
- if (all_ptr.get() == nullptr) {
- return;
- }
- ElfFileImpl<ElfTypes>& all = *all_ptr;
-
- // We need the eh_frame for gdb but debug info might be present without it.
- const Elf_Shdr* eh_frame = all.FindSectionByName(".eh_frame");
- if (eh_frame == nullptr) {
- return;
- }
-
- // Do we have interesting sections?
- // We need to add in a strtab and symtab to the image.
- // all is MAP_PRIVATE so it can be written to freely.
- // We also already have strtab and symtab so we are fine there.
- Elf_Ehdr& elf_hdr = all.GetHeader();
- elf_hdr.e_entry = 0;
- elf_hdr.e_phoff = 0;
- elf_hdr.e_phnum = 0;
- elf_hdr.e_phentsize = 0;
- elf_hdr.e_type = ET_EXEC;
-
- // Since base_address_ is 0 if we are actually loaded at a known address (i.e. this is boot.oat)
- // and the actual address stuff starts at in regular files this is good.
- if (!all.FixupDebugSections(reinterpret_cast<intptr_t>(base_address_))) {
- LOG(ERROR) << "Failed to load GDB data";
- return;
- }
-
- jit_gdb_entry_ = CreateJITCodeEntry(all.Begin(), all.Size());
- gdb_file_mapping_.reset(all_ptr.release());
-}
-
-template <typename ElfTypes>
bool ElfFileImpl<ElfTypes>::Strip(std::string* error_msg) {
// ELF files produced by MCLinker look roughly like this
//
diff --git a/runtime/elf_file_impl.h b/runtime/elf_file_impl.h
index 0f466bd..2af31dc 100644
--- a/runtime/elf_file_impl.h
+++ b/runtime/elf_file_impl.h
@@ -213,12 +213,6 @@
SymbolTable* symtab_symbol_table_;
SymbolTable* dynsym_symbol_table_;
- // Support for GDB JIT
- uint8_t* jit_elf_image_;
- JITCodeEntry* jit_gdb_entry_;
- std::unique_ptr<ElfFileImpl<ElfTypes>> gdb_file_mapping_;
- void GdbJITSupport();
-
// Override the 'base' p_vaddr in the first LOAD segment with this value (if non-null).
uint8_t* requested_base_;
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6b8f17d..87681cf 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1272,11 +1272,14 @@
}
}
{
+ constexpr const char* kOpenJdkLibrary = kIsDebugBuild
+ ? "libopenjdkd.so"
+ : "libopenjdk.so";
std::string error_msg;
- if (!java_vm_->LoadNativeLibrary(env, "libopenjdk.so", nullptr,
+ if (!java_vm_->LoadNativeLibrary(env, kOpenJdkLibrary, nullptr,
/* is_shared_namespace */ false,
nullptr, nullptr, &error_msg)) {
- LOG(FATAL) << "LoadNativeLibrary failed for \"libopenjdk.so\": " << error_msg;
+ LOG(FATAL) << "LoadNativeLibrary failed for \"" << kOpenJdkLibrary << "\": " << error_msg;
}
}
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 569a021..53d0f10 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -682,7 +682,8 @@
$(ART_HOST_OUT_SHARED_LIBRARIES)/libarttestd$(ART_HOST_SHLIB_EXTENSION) \
$(ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
$(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
- $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION)
+ $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
+ $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION)
ifneq ($(HOST_PREFER_32_BIT),true)
ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
@@ -690,7 +691,8 @@
$(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libarttestd$(ART_HOST_SHLIB_EXTENSION) \
$(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
$(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
- $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION)
+ $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
+ $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION)
endif
# Create a rule to build and run a tests following the form: