Remove use of npic image for gtests.
Test: art gtests on host and target
Bug: 33192586
Change-Id: Ic56e304eb539b4cf353281280a48ce23c74bf218
diff --git a/compiler/elf_writer_test.cc b/compiler/elf_writer_test.cc
index 9669c4a..fa2d78d 100644
--- a/compiler/elf_writer_test.cc
+++ b/compiler/elf_writer_test.cc
@@ -41,7 +41,6 @@
symbol_name, \
build_map)); \
EXPECT_NE(nullptr, addr); \
- EXPECT_LT(static_cast<uintptr_t>(ART_BASE_ADDRESS), reinterpret_cast<uintptr_t>(addr)); \
if ((expected_value) == nullptr) { \
(expected_value) = addr; \
} \
@@ -60,7 +59,7 @@
void* dl_oatlastword = nullptr;
std::unique_ptr<File> file(OS::OpenFileForReading(elf_filename.c_str()));
- ASSERT_TRUE(file.get() != nullptr);
+ ASSERT_TRUE(file.get() != nullptr) << elf_filename;
{
std::string error_msg;
std::unique_ptr<ElfFile> ef(ElfFile::Open(file.get(),
@@ -86,17 +85,22 @@
EXPECT_ELF_FILE_ADDRESS(ef, dl_oatlastword, "oatlastword", true);
}
{
+ uint8_t* base = reinterpret_cast<uint8_t*>(ART_BASE_ADDRESS);
std::string error_msg;
std::unique_ptr<ElfFile> ef(ElfFile::Open(file.get(),
false,
true,
/*low_4gb*/false,
- &error_msg));
+ &error_msg,
+ base));
CHECK(ef.get() != nullptr) << error_msg;
CHECK(ef->Load(file.get(), false, /*low_4gb*/false, &error_msg)) << error_msg;
- EXPECT_EQ(dl_oatdata, ef->FindDynamicSymbolAddress("oatdata"));
- EXPECT_EQ(dl_oatexec, ef->FindDynamicSymbolAddress("oatexec"));
- EXPECT_EQ(dl_oatlastword, ef->FindDynamicSymbolAddress("oatlastword"));
+ EXPECT_EQ(reinterpret_cast<uintptr_t>(dl_oatdata) + reinterpret_cast<uintptr_t>(base),
+ reinterpret_cast<uintptr_t>(ef->FindDynamicSymbolAddress("oatdata")));
+ EXPECT_EQ(reinterpret_cast<uintptr_t>(dl_oatexec) + reinterpret_cast<uintptr_t>(base),
+ reinterpret_cast<uintptr_t>(ef->FindDynamicSymbolAddress("oatexec")));
+ EXPECT_EQ(reinterpret_cast<uintptr_t>(dl_oatlastword) + reinterpret_cast<uintptr_t>(base),
+ reinterpret_cast<uintptr_t>(ef->FindDynamicSymbolAddress("oatlastword")));
}
}