Use StringBssEntry for testing PC-relative patching.
Prepares for removal of LinkerPatch::Type::kDexCacheArray.
Test: m test-art-host-gtest
Bug: 30627598
Change-Id: I69104892447a3b210228fceacf4bfdfd856d5866
diff --git a/compiler/linker/mips64/relative_patcher_mips64_test.cc b/compiler/linker/mips64/relative_patcher_mips64_test.cc
index c317058..9c9e24a 100644
--- a/compiler/linker/mips64/relative_patcher_mips64_test.cc
+++ b/compiler/linker/mips64/relative_patcher_mips64_test.cc
@@ -39,7 +39,7 @@
}
void CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches, uint32_t target_offset);
- void TestDexCacheReference(uint32_t dex_cache_arrays_begin, uint32_t element_offset);
+ void TestStringBssEntry(uint32_t bss_begin, uint32_t string_entry_offset);
void TestStringReference(uint32_t string_offset);
};
@@ -76,18 +76,19 @@
EXPECT_TRUE(CheckLinkedMethod(MethodRef(1u), ArrayRef<const uint8_t>(expected_code)));
}
-void Mips64RelativePatcherTest::TestDexCacheReference(uint32_t dex_cache_arrays_begin,
- uint32_t element_offset) {
- dex_cache_arrays_begin_ = dex_cache_arrays_begin;
+void Mips64RelativePatcherTest::TestStringBssEntry(uint32_t bss_begin,
+ uint32_t string_entry_offset) {
+ constexpr uint32_t kStringIndex = 1u;
+ string_index_to_offset_map_.Put(kStringIndex, string_entry_offset);
+ bss_begin_ = bss_begin;
LinkerPatch patches[] = {
- LinkerPatch::DexCacheArrayPatch(kLiteralOffset, nullptr, kAnchorOffset, element_offset)
+ LinkerPatch::StringBssEntryPatch(kLiteralOffset, nullptr, kAnchorOffset, kStringIndex)
};
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches),
- dex_cache_arrays_begin_ + element_offset);
+ CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), bss_begin_ + string_entry_offset);
}
-TEST_F(Mips64RelativePatcherTest, DexCacheReference) {
- TestDexCacheReference(/* dex_cache_arrays_begin */ 0x12345678, /* element_offset */ 0x1234);
+TEST_F(Mips64RelativePatcherTest, StringBssEntry) {
+ TestStringBssEntry(/* bss_begin */ 0x12345678, /* string_entry_offset */ 0x1234);
}
TEST_F(Mips64RelativePatcherTest, CallOther) {