summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-04-15 14:04:38 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-04-16 09:25:42 +0000
commit253075f929835d5b86b62840459e1b4f63e31aa1 (patch)
tree48048755bb4459ef55e29b4b6d41176e9a79d0ae
parent3293b63fd384bbe7e9c143e8b80761345d507536 (diff)
Rename `.data.bimg.rel.ro` to `.data.img.rel.ro`.
Prepare for adding app image patches to the same section. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 38313278 Change-Id: Ib552f005b3a2859152d0de9fa6b2fcd48a0f3feb
-rw-r--r--compiler/linker/linker_patch.h16
-rw-r--r--compiler/optimizing/code_generator.h6
-rw-r--r--compiler/optimizing/code_generator_arm64.cc6
-rw-r--r--compiler/optimizing/code_generator_arm64.h2
-rw-r--r--compiler/optimizing/code_generator_arm_vixl.cc2
-rw-r--r--compiler/optimizing/code_generator_arm_vixl.h6
-rw-r--r--compiler/optimizing/code_generator_riscv64.cc2
-rw-r--r--compiler/optimizing/code_generator_riscv64.h2
-rw-r--r--compiler/optimizing/code_generator_x86.cc2
-rw-r--r--compiler/optimizing/code_generator_x86_64.cc2
-rw-r--r--compiler/optimizing/nodes.h6
-rw-r--r--compiler/optimizing/pc_relative_fixups_x86.cc4
-rw-r--r--compiler/optimizing/sharpening.cc2
-rw-r--r--dex2oat/dex2oat.cc12
-rw-r--r--dex2oat/linker/arm64/relative_patcher_arm64.cc4
-rw-r--r--dex2oat/linker/elf_writer.h6
-rw-r--r--dex2oat/linker/elf_writer_quick.cc32
-rw-r--r--dex2oat/linker/image_test.h12
-rw-r--r--dex2oat/linker/oat_writer.cc86
-rw-r--r--dex2oat/linker/oat_writer.h38
-rw-r--r--dex2oat/linker/oat_writer_test.cc10
-rw-r--r--libelffile/elf/elf_builder.h38
-rw-r--r--oatdump/oatdump.cc10
-rw-r--r--runtime/class_linker.cc2
-rw-r--r--runtime/oat/oat.h4
-rw-r--r--runtime/oat/oat_file.cc54
-rw-r--r--runtime/oat/oat_file.h18
-rw-r--r--runtime/read_barrier_option.h2
-rw-r--r--test/683-clinit-inline-static-invoke/src/Main.java2
-rw-r--r--test/ProfileTestMultiDex/Second.java2
30 files changed, 195 insertions, 195 deletions
diff --git a/compiler/linker/linker_patch.h b/compiler/linker/linker_patch.h
index 133088240b..6e09ea8954 100644
--- a/compiler/linker/linker_patch.h
+++ b/compiler/linker/linker_patch.h
@@ -45,7 +45,7 @@ class LinkerPatch {
// Note: Actual patching is instruction_set-dependent.
enum class Type : uint8_t {
kIntrinsicReference, // Boot image reference for an intrinsic, see IntrinsicObjects.
- kDataBimgRelRo,
+ kBootImageRelRo,
kMethodRelative,
kMethodBssEntry,
kJniEntrypointRelative,
@@ -70,10 +70,10 @@ class LinkerPatch {
return patch;
}
- static LinkerPatch DataBimgRelRoPatch(size_t literal_offset,
- uint32_t pc_insn_offset,
- uint32_t boot_image_offset) {
- LinkerPatch patch(literal_offset, Type::kDataBimgRelRo, /* target_dex_file= */ nullptr);
+ static LinkerPatch BootImageRelRoPatch(size_t literal_offset,
+ uint32_t pc_insn_offset,
+ uint32_t boot_image_offset) {
+ LinkerPatch patch(literal_offset, Type::kBootImageRelRo, /* target_dex_file= */ nullptr);
patch.boot_image_offset_ = boot_image_offset;
patch.pc_insn_offset_ = pc_insn_offset;
return patch;
@@ -224,7 +224,7 @@ class LinkerPatch {
}
uint32_t BootImageOffset() const {
- DCHECK(patch_type_ == Type::kDataBimgRelRo);
+ DCHECK(patch_type_ == Type::kBootImageRelRo);
return boot_image_offset_;
}
@@ -276,7 +276,7 @@ class LinkerPatch {
uint32_t PcInsnOffset() const {
DCHECK(patch_type_ == Type::kIntrinsicReference ||
- patch_type_ == Type::kDataBimgRelRo ||
+ patch_type_ == Type::kBootImageRelRo ||
patch_type_ == Type::kMethodRelative ||
patch_type_ == Type::kMethodBssEntry ||
patch_type_ == Type::kJniEntrypointRelative ||
@@ -322,7 +322,7 @@ class LinkerPatch {
Type patch_type_ : 8;
union {
uint32_t cmp1_; // Used for relational operators.
- uint32_t boot_image_offset_; // Data to write to the .data.bimg.rel.ro entry.
+ uint32_t boot_image_offset_; // Data to write to the boot image .data.img.rel.ro entry.
uint32_t method_idx_; // Method index for Call/Method patches.
uint32_t type_idx_; // Type index for Type patches.
uint32_t string_idx_; // String index for String patches.
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 94831cab9f..4a6a229098 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -735,15 +735,15 @@ class CodeGenerator : public DeletableArenaObject<kArenaAllocCodeGenerator> {
protected:
// Patch info used for recording locations of required linker patches and their targets,
// i.e. target method, string, type or code identified by their dex file and index,
- // or .data.bimg.rel.ro entries identified by the boot image offset.
+ // or boot image .data.img.rel.ro entries identified by the boot image offset.
template <typename LabelType>
struct PatchInfo {
PatchInfo(const DexFile* dex_file, uint32_t off_or_idx)
: target_dex_file(dex_file), offset_or_index(off_or_idx), label() { }
- // Target dex file or null for .data.bmig.rel.ro patches.
+ // Target dex file or null for boot image .data.img.rel.ro patches.
const DexFile* target_dex_file;
- // Either the boot image offset (to write to .data.bmig.rel.ro) or string/type/method index.
+ // Either the boot image offset (to write to .data.img.rel.ro) or string/type/method index.
uint32_t offset_or_index;
// Label for the instruction to patch.
LabelType label;
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index f3cd87b588..4b4cafe378 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -5226,10 +5226,10 @@ void CodeGeneratorARM64::EmitLdrOffsetPlaceholder(vixl::aarch64::Label* fixup_la
void CodeGeneratorARM64::LoadBootImageRelRoEntry(vixl::aarch64::Register reg,
uint32_t boot_image_offset) {
DCHECK(reg.IsW());
- // Add ADRP with its PC-relative .data.bimg.rel.ro patch.
+ // Add ADRP with its PC-relative boot image .data.img.rel.ro patch.
vixl::aarch64::Label* adrp_label = NewBootImageRelRoPatch(boot_image_offset);
EmitAdrpPlaceholder(adrp_label, reg.X());
- // Add LDR with its PC-relative .data.bimg.rel.ro patch.
+ // Add LDR with its PC-relative boot image .data.img.rel.ro patch.
vixl::aarch64::Label* ldr_label = NewBootImageRelRoPatch(boot_image_offset, adrp_label);
EmitLdrOffsetPlaceholder(ldr_label, reg.W(), reg.X());
}
@@ -5346,7 +5346,7 @@ void CodeGeneratorARM64::EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* lin
EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::IntrinsicReferencePatch>>(
boot_image_other_patches_, linker_patches);
} else {
- EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::DataBimgRelRoPatch>>(
+ EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::BootImageRelRoPatch>>(
boot_image_other_patches_, linker_patches);
}
EmitPcRelativeLinkerPatches<linker::LinkerPatch::MethodBssEntryPatch>(
diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h
index d10fb3018b..32a69a9df7 100644
--- a/compiler/optimizing/code_generator_arm64.h
+++ b/compiler/optimizing/code_generator_arm64.h
@@ -1099,7 +1099,7 @@ class CodeGeneratorARM64 : public CodeGenerator {
/*out*/ std::string* debug_name);
// The PcRelativePatchInfo is used for PC-relative addressing of methods/strings/types,
- // whether through .data.bimg.rel.ro, .bss, or directly in the boot image.
+ // whether through .data.img.rel.ro, .bss, or directly in the boot image.
struct PcRelativePatchInfo : PatchInfo<vixl::aarch64::Label> {
PcRelativePatchInfo(const DexFile* dex_file, uint32_t off_or_idx)
: PatchInfo<vixl::aarch64::Label>(dex_file, off_or_idx), pc_insn_label() { }
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index ebbf2f322d..14687bbe14 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -9853,7 +9853,7 @@ void CodeGeneratorARMVIXL::EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* l
EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::IntrinsicReferencePatch>>(
boot_image_other_patches_, linker_patches);
} else {
- EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::DataBimgRelRoPatch>>(
+ EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::BootImageRelRoPatch>>(
boot_image_other_patches_, linker_patches);
}
EmitPcRelativeLinkerPatches<linker::LinkerPatch::MethodBssEntryPatch>(
diff --git a/compiler/optimizing/code_generator_arm_vixl.h b/compiler/optimizing/code_generator_arm_vixl.h
index a6cc07d212..a62097d08f 100644
--- a/compiler/optimizing/code_generator_arm_vixl.h
+++ b/compiler/optimizing/code_generator_arm_vixl.h
@@ -684,7 +684,7 @@ class CodeGeneratorARMVIXL : public CodeGenerator {
void MoveFromReturnRegister(Location trg, DataType::Type type) override;
// The PcRelativePatchInfo is used for PC-relative addressing of methods/strings/types,
- // whether through .data.bimg.rel.ro, .bss, or directly in the boot image.
+ // whether through .data.img.rel.ro, .bss, or directly in the boot image.
//
// The PC-relative address is loaded with three instructions,
// MOVW+MOVT to load the offset to base_reg and then ADD base_reg, PC. The offset
@@ -695,9 +695,9 @@ class CodeGeneratorARMVIXL : public CodeGenerator {
PcRelativePatchInfo(const DexFile* dex_file, uint32_t off_or_idx)
: target_dex_file(dex_file), offset_or_index(off_or_idx) { }
- // Target dex file or null for .data.bmig.rel.ro patches.
+ // Target dex file or null for boot image .data.img.rel.ro patches.
const DexFile* target_dex_file;
- // Either the boot image offset (to write to .data.bmig.rel.ro) or string/type/method index.
+ // Either the boot image offset (to write to .data.img.rel.ro) or string/type/method index.
uint32_t offset_or_index;
vixl::aarch32::Label movw_label;
vixl::aarch32::Label movt_label;
diff --git a/compiler/optimizing/code_generator_riscv64.cc b/compiler/optimizing/code_generator_riscv64.cc
index 4a96623cda..5a237ca785 100644
--- a/compiler/optimizing/code_generator_riscv64.cc
+++ b/compiler/optimizing/code_generator_riscv64.cc
@@ -6621,7 +6621,7 @@ void CodeGeneratorRISCV64::EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* l
EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::IntrinsicReferencePatch>>(
boot_image_other_patches_, linker_patches);
} else {
- EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::DataBimgRelRoPatch>>(
+ EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::BootImageRelRoPatch>>(
boot_image_other_patches_, linker_patches);
}
EmitPcRelativeLinkerPatches<linker::LinkerPatch::MethodBssEntryPatch>(
diff --git a/compiler/optimizing/code_generator_riscv64.h b/compiler/optimizing/code_generator_riscv64.h
index b86b30e889..c49e2b4771 100644
--- a/compiler/optimizing/code_generator_riscv64.h
+++ b/compiler/optimizing/code_generator_riscv64.h
@@ -544,7 +544,7 @@ class CodeGeneratorRISCV64 : public CodeGenerator {
const HInvokeStaticOrDirect::DispatchInfo& desired_dispatch_info, ArtMethod* method) override;
// The PcRelativePatchInfo is used for PC-relative addressing of methods/strings/types,
- // whether through .data.bimg.rel.ro, .bss, or directly in the boot image.
+ // whether through .data.img.rel.ro, .bss, or directly in the boot image.
//
// The 20-bit and 12-bit parts of the 32-bit PC-relative offset are patched separately,
// necessitating two patches/infos. There can be more than two patches/infos if the
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index e45719bfb9..098356ce00 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -5868,7 +5868,7 @@ void CodeGeneratorX86::EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* linke
EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::IntrinsicReferencePatch>>(
boot_image_other_patches_, linker_patches);
} else {
- EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::DataBimgRelRoPatch>>(
+ EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::BootImageRelRoPatch>>(
boot_image_other_patches_, linker_patches);
}
EmitPcRelativeLinkerPatches<linker::LinkerPatch::MethodBssEntryPatch>(
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 94ec6accff..a03ce0a9b2 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -1473,7 +1473,7 @@ void CodeGeneratorX86_64::EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* li
EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::IntrinsicReferencePatch>>(
boot_image_other_patches_, linker_patches);
} else {
- EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::DataBimgRelRoPatch>>(
+ EmitPcRelativeLinkerPatches<NoDexFileAdapter<linker::LinkerPatch::BootImageRelRoPatch>>(
boot_image_other_patches_, linker_patches);
}
EmitPcRelativeLinkerPatches<linker::LinkerPatch::MethodBssEntryPatch>(
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 37d17478ff..6a5213c932 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -4703,7 +4703,7 @@ enum class MethodLoadKind {
// Used for boot image methods referenced by boot image code.
kBootImageLinkTimePcRelative,
- // Load from an entry in the .data.bimg.rel.ro using a PC-relative load.
+ // Load from a boot image entry in the .data.img.rel.ro using a PC-relative load.
// Used for app->boot calls with relocatable image.
kBootImageRelRo,
@@ -6739,7 +6739,7 @@ class HLoadClass final : public HInstruction {
// Used for boot image classes referenced by boot image code.
kBootImageLinkTimePcRelative,
- // Load from an entry in the .data.bimg.rel.ro using a PC-relative load.
+ // Load from a boot image entry in the .data.img.rel.ro using a PC-relative load.
// Used for boot image classes referenced by apps in AOT-compiled code.
kBootImageRelRo,
@@ -6994,7 +6994,7 @@ class HLoadString final : public HInstruction {
// Used for boot image strings referenced by boot image code.
kBootImageLinkTimePcRelative,
- // Load from an entry in the .data.bimg.rel.ro using a PC-relative load.
+ // Load from a boot image entry in the .data.img.rel.ro using a PC-relative load.
// Used for boot image strings referenced by apps in AOT-compiled code.
kBootImageRelRo,
diff --git a/compiler/optimizing/pc_relative_fixups_x86.cc b/compiler/optimizing/pc_relative_fixups_x86.cc
index c2d5ec7b60..cfb3a0bf5d 100644
--- a/compiler/optimizing/pc_relative_fixups_x86.cc
+++ b/compiler/optimizing/pc_relative_fixups_x86.cc
@@ -196,7 +196,7 @@ class PCRelativeHandlerVisitor final : public HGraphVisitor {
HInvokeStaticOrDirect* invoke_static_or_direct = invoke->AsInvokeStaticOrDirectOrNull();
// If this is an invoke-static/-direct with PC-relative addressing (within boot image
- // or using .bss or .data.bimg.rel.ro), we need the PC-relative address base.
+ // or using .bss or .data.img.rel.ro), we need the PC-relative address base.
bool base_added = false;
if (invoke_static_or_direct != nullptr &&
invoke_static_or_direct->HasPcRelativeMethodLoadKind() &&
@@ -240,7 +240,7 @@ class PCRelativeHandlerVisitor final : public HGraphVisitor {
case Intrinsics::kCharacterValueOf:
case Intrinsics::kIntegerValueOf:
// This intrinsic can be call free if it loads the address of the boot image object.
- // If we're compiling PIC, we need the address base for loading from .data.bimg.rel.ro.
+ // If we're compiling PIC, we need the address base for loading from .data.img.rel.ro.
if (!codegen_->GetCompilerOptions().GetCompilePic()) {
break;
}
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc
index a6f86ff496..63929089ca 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -127,7 +127,7 @@ HInvokeStaticOrDirect::DispatchInfo HSharpening::SharpenLoadMethod(
code_ptr_location = CodePtrLocation::kCallArtMethod;
}
} else if (IsInBootImage(callee)) {
- // Use PC-relative access to the .data.bimg.rel.ro methods array.
+ // Use PC-relative access to the .data.img.rel.ro boot image methods array.
method_load_kind = MethodLoadKind::kBootImageRelRo;
code_ptr_location = CodePtrLocation::kCallArtMethod;
} else if (!has_method_id) {
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 36c8662e50..c2c4fb27a1 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -2126,7 +2126,7 @@ class Dex2Oat final {
oat_writer->PrepareLayout(&patcher);
elf_writer->PrepareDynamicSection(oat_writer->GetOatHeader().GetExecutableOffset(),
oat_writer->GetCodeSize(),
- oat_writer->GetDataBimgRelRoSize(),
+ oat_writer->GetDataImgRelRoSize(),
oat_writer->GetBssSize(),
oat_writer->GetBssMethodsOffset(),
oat_writer->GetBssRootsOffset(),
@@ -2168,14 +2168,14 @@ class Dex2Oat final {
}
elf_writer->EndText(text);
- if (oat_writer->GetDataBimgRelRoSize() != 0u) {
- OutputStream* data_bimg_rel_ro = elf_writer->StartDataBimgRelRo();
- if (!oat_writer->WriteDataBimgRelRo(data_bimg_rel_ro)) {
- LOG(ERROR) << "Failed to write .data.bimg.rel.ro section to the ELF file "
+ if (oat_writer->GetDataImgRelRoSize() != 0u) {
+ OutputStream* data_img_rel_ro = elf_writer->StartDataImgRelRo();
+ if (!oat_writer->WriteDataImgRelRo(data_img_rel_ro)) {
+ LOG(ERROR) << "Failed to write .data.img.rel.ro section to the ELF file "
<< oat_file->GetPath();
return false;
}
- elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
+ elf_writer->EndDataImgRelRo(data_img_rel_ro);
}
if (!oat_writer->WriteHeader(elf_writer->GetStream())) {
diff --git a/dex2oat/linker/arm64/relative_patcher_arm64.cc b/dex2oat/linker/arm64/relative_patcher_arm64.cc
index e7431e4e1b..8772974c4b 100644
--- a/dex2oat/linker/arm64/relative_patcher_arm64.cc
+++ b/dex2oat/linker/arm64/relative_patcher_arm64.cc
@@ -61,7 +61,7 @@ inline bool IsAdrpPatch(const LinkerPatch& patch) {
case LinkerPatch::Type::kBakerReadBarrierBranch:
return false;
case LinkerPatch::Type::kIntrinsicReference:
- case LinkerPatch::Type::kDataBimgRelRo:
+ case LinkerPatch::Type::kBootImageRelRo:
case LinkerPatch::Type::kMethodRelative:
case LinkerPatch::Type::kMethodBssEntry:
case LinkerPatch::Type::kJniEntrypointRelative:
@@ -271,7 +271,7 @@ void Arm64RelativePatcher::PatchPcRelativeReference(std::vector<uint8_t>* code,
shift = 0u; // No shift for ADD.
} else {
// LDR/STR 32-bit or 64-bit with imm12 == 0 (unset).
- DCHECK(patch.GetType() == LinkerPatch::Type::kDataBimgRelRo ||
+ DCHECK(patch.GetType() == LinkerPatch::Type::kBootImageRelRo ||
patch.GetType() == LinkerPatch::Type::kMethodBssEntry ||
patch.GetType() == LinkerPatch::Type::kJniEntrypointRelative ||
patch.GetType() == LinkerPatch::Type::kTypeBssEntry ||
diff --git a/dex2oat/linker/elf_writer.h b/dex2oat/linker/elf_writer.h
index e41377e275..a1d0ece9de 100644
--- a/dex2oat/linker/elf_writer.h
+++ b/dex2oat/linker/elf_writer.h
@@ -60,7 +60,7 @@ class ElfWriter {
// This method must be called before calling GetLoadedSize().
virtual void PrepareDynamicSection(size_t rodata_size,
size_t text_size,
- size_t data_bimg_rel_ro_size,
+ size_t data_img_rel_ro_size,
size_t bss_size,
size_t bss_methods_offset,
size_t bss_roots_offset,
@@ -70,8 +70,8 @@ class ElfWriter {
virtual void EndRoData(OutputStream* rodata) = 0;
virtual OutputStream* StartText() = 0;
virtual void EndText(OutputStream* text) = 0;
- virtual OutputStream* StartDataBimgRelRo() = 0;
- virtual void EndDataBimgRelRo(OutputStream* data_bimg_rel_ro) = 0;
+ virtual OutputStream* StartDataImgRelRo() = 0;
+ virtual void EndDataImgRelRo(OutputStream* data_img_rel_ro) = 0;
virtual void WriteDynamicSection() = 0;
virtual void WriteDebugInfo(const debug::DebugInfo& debug_info) = 0;
virtual bool StripDebugInfo() = 0;
diff --git a/dex2oat/linker/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc
index 10dc23e2e7..373c46ce2c 100644
--- a/dex2oat/linker/elf_writer_quick.cc
+++ b/dex2oat/linker/elf_writer_quick.cc
@@ -91,7 +91,7 @@ class ElfWriterQuick final : public ElfWriter {
void Start() override;
void PrepareDynamicSection(size_t rodata_size,
size_t text_size,
- size_t data_bimg_rel_ro_size,
+ size_t data_img_rel_ro_size,
size_t bss_size,
size_t bss_methods_offset,
size_t bss_roots_offset,
@@ -101,8 +101,8 @@ class ElfWriterQuick final : public ElfWriter {
void EndRoData(OutputStream* rodata) override;
OutputStream* StartText() override;
void EndText(OutputStream* text) override;
- OutputStream* StartDataBimgRelRo() override;
- void EndDataBimgRelRo(OutputStream* data_bimg_rel_ro) override;
+ OutputStream* StartDataImgRelRo() override;
+ void EndDataImgRelRo(OutputStream* data_img_rel_ro) override;
void WriteDynamicSection() override;
void WriteDebugInfo(const debug::DebugInfo& debug_info) override;
bool StripDebugInfo() override;
@@ -120,7 +120,7 @@ class ElfWriterQuick final : public ElfWriter {
File* const elf_file_;
size_t rodata_size_;
size_t text_size_;
- size_t data_bimg_rel_ro_size_;
+ size_t data_img_rel_ro_size_;
size_t bss_size_;
size_t dex_section_size_;
std::unique_ptr<BufferedOutputStream> output_stream_;
@@ -149,7 +149,7 @@ ElfWriterQuick<ElfTypes>::ElfWriterQuick(const CompilerOptions& compiler_options
elf_file_(elf_file),
rodata_size_(0u),
text_size_(0u),
- data_bimg_rel_ro_size_(0u),
+ data_img_rel_ro_size_(0u),
bss_size_(0u),
dex_section_size_(0u),
output_stream_(
@@ -172,7 +172,7 @@ void ElfWriterQuick<ElfTypes>::Start() {
template <typename ElfTypes>
void ElfWriterQuick<ElfTypes>::PrepareDynamicSection(size_t rodata_size,
size_t text_size,
- size_t data_bimg_rel_ro_size,
+ size_t data_img_rel_ro_size,
size_t bss_size,
size_t bss_methods_offset,
size_t bss_roots_offset,
@@ -181,8 +181,8 @@ void ElfWriterQuick<ElfTypes>::PrepareDynamicSection(size_t rodata_size,
rodata_size_ = rodata_size;
DCHECK_EQ(text_size_, 0u);
text_size_ = text_size;
- DCHECK_EQ(data_bimg_rel_ro_size_, 0u);
- data_bimg_rel_ro_size_ = data_bimg_rel_ro_size;
+ DCHECK_EQ(data_img_rel_ro_size_, 0u);
+ data_img_rel_ro_size_ = data_img_rel_ro_size;
DCHECK_EQ(bss_size_, 0u);
bss_size_ = bss_size;
DCHECK_EQ(dex_section_size_, 0u);
@@ -190,7 +190,7 @@ void ElfWriterQuick<ElfTypes>::PrepareDynamicSection(size_t rodata_size,
builder_->PrepareDynamicSection(elf_file_->GetPath(),
rodata_size_,
text_size_,
- data_bimg_rel_ro_size_,
+ data_img_rel_ro_size_,
bss_size_,
bss_methods_offset,
bss_roots_offset,
@@ -224,16 +224,16 @@ void ElfWriterQuick<ElfTypes>::EndText(OutputStream* text) {
}
template <typename ElfTypes>
-OutputStream* ElfWriterQuick<ElfTypes>::StartDataBimgRelRo() {
- auto* data_bimg_rel_ro = builder_->GetDataBimgRelRo();
- data_bimg_rel_ro->Start();
- return data_bimg_rel_ro;
+OutputStream* ElfWriterQuick<ElfTypes>::StartDataImgRelRo() {
+ auto* data_img_rel_ro = builder_->GetDataImgRelRo();
+ data_img_rel_ro->Start();
+ return data_img_rel_ro;
}
template <typename ElfTypes>
-void ElfWriterQuick<ElfTypes>::EndDataBimgRelRo(OutputStream* data_bimg_rel_ro) {
- CHECK_EQ(builder_->GetDataBimgRelRo(), data_bimg_rel_ro);
- builder_->GetDataBimgRelRo()->End();
+void ElfWriterQuick<ElfTypes>::EndDataImgRelRo(OutputStream* data_img_rel_ro) {
+ CHECK_EQ(builder_->GetDataImgRelRo(), data_img_rel_ro);
+ builder_->GetDataImgRelRo()->End();
}
template <typename ElfTypes>
diff --git a/dex2oat/linker/image_test.h b/dex2oat/linker/image_test.h
index b82f54b079..9f553c1c74 100644
--- a/dex2oat/linker/image_test.h
+++ b/dex2oat/linker/image_test.h
@@ -308,7 +308,7 @@ inline void ImageTest::DoCompile(ImageHeader::StorageMode storage_mode,
oat_writer->PrepareLayout(&patcher);
elf_writer->PrepareDynamicSection(oat_writer->GetOatHeader().GetExecutableOffset(),
oat_writer->GetCodeSize(),
- oat_writer->GetDataBimgRelRoSize(),
+ oat_writer->GetDataImgRelRoSize(),
oat_writer->GetBssSize(),
oat_writer->GetBssMethodsOffset(),
oat_writer->GetBssRootsOffset(),
@@ -328,11 +328,11 @@ inline void ImageTest::DoCompile(ImageHeader::StorageMode storage_mode,
ASSERT_TRUE(text_ok);
elf_writer->EndText(text);
- if (oat_writer->GetDataBimgRelRoSize() != 0u) {
- OutputStream* data_bimg_rel_ro = elf_writer->StartDataBimgRelRo();
- bool data_bimg_rel_ro_ok = oat_writer->WriteDataBimgRelRo(data_bimg_rel_ro);
- ASSERT_TRUE(data_bimg_rel_ro_ok);
- elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
+ if (oat_writer->GetDataImgRelRoSize() != 0u) {
+ OutputStream* data_img_rel_ro = elf_writer->StartDataImgRelRo();
+ bool data_img_rel_ro_ok = oat_writer->WriteDataImgRelRo(data_img_rel_ro);
+ ASSERT_TRUE(data_img_rel_ro_ok);
+ elf_writer->EndDataImgRelRo(data_img_rel_ro);
}
bool header_ok = oat_writer->WriteHeader(elf_writer->GetStream());
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index 7ce1876f51..03305d9faf 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -371,13 +371,13 @@ OatWriter::OatWriter(const CompilerOptions& compiler_options,
oat_checksum_(adler32(0L, Z_NULL, 0)),
code_size_(0u),
oat_size_(0u),
- data_bimg_rel_ro_start_(0u),
- data_bimg_rel_ro_size_(0u),
+ data_img_rel_ro_start_(0u),
+ data_img_rel_ro_size_(0u),
bss_start_(0u),
bss_size_(0u),
bss_methods_offset_(0u),
bss_roots_offset_(0u),
- data_bimg_rel_ro_entries_(),
+ boot_image_rel_ro_entries_(),
bss_method_entry_references_(),
bss_method_entries_(),
bss_type_entries_(),
@@ -645,8 +645,8 @@ void OatWriter::PrepareLayout(MultiOatRelativePatcher* relative_patcher) {
code_size_ = offset - GetOatHeader().GetExecutableOffset();
}
{
- TimingLogger::ScopedTiming split("InitDataBimgRelRoLayout", timings_);
- offset = InitDataBimgRelRoLayout(offset);
+ TimingLogger::ScopedTiming split("InitDataImgRelRoLayout", timings_);
+ offset = InitDataImgRelRoLayout(offset);
}
oat_size_ = offset; // .bss does not count towards oat_size_.
bss_start_ = (bss_size_ != 0u) ? RoundUp(oat_size_, kElfSegmentAlignment) : 0u;
@@ -745,9 +745,9 @@ class OatWriter::InitBssLayoutMethodVisitor : public DexMethodVisitor {
MethodReference(dex_file_, method.GetIndex()));
if (HasCompiledCode(compiled_method)) {
for (const LinkerPatch& patch : compiled_method->GetPatches()) {
- if (patch.GetType() == LinkerPatch::Type::kDataBimgRelRo) {
- writer_->data_bimg_rel_ro_entries_.Overwrite(patch.BootImageOffset(),
- /* placeholder */ 0u);
+ if (patch.GetType() == LinkerPatch::Type::kBootImageRelRo) {
+ writer_->boot_image_rel_ro_entries_.Overwrite(patch.BootImageOffset(),
+ /* placeholder */ 0u);
} else if (patch.GetType() == LinkerPatch::Type::kMethodBssEntry) {
MethodReference target_method = patch.TargetMethod();
AddBssReference(target_method,
@@ -1648,10 +1648,10 @@ class OatWriter::WriteCodeMethodVisitor : public OrderedMethodVisitor {
target_offset);
break;
}
- case LinkerPatch::Type::kDataBimgRelRo: {
+ case LinkerPatch::Type::kBootImageRelRo: {
uint32_t target_offset =
- writer_->data_bimg_rel_ro_start_ +
- writer_->data_bimg_rel_ro_entries_.Get(patch.BootImageOffset());
+ writer_->data_img_rel_ro_start_ +
+ writer_->boot_image_rel_ro_entries_.Get(patch.BootImageOffset());
writer_->relative_patcher_->PatchPcRelativeReference(&patched_code_,
patch,
offset_ + literal_offset,
@@ -2352,22 +2352,22 @@ size_t OatWriter::InitOatCodeDexFiles(size_t offset) {
return offset;
}
-size_t OatWriter::InitDataBimgRelRoLayout(size_t offset) {
- DCHECK_EQ(data_bimg_rel_ro_size_, 0u);
- if (data_bimg_rel_ro_entries_.empty()) {
- // Nothing to put to the .data.bimg.rel.ro section.
+size_t OatWriter::InitDataImgRelRoLayout(size_t offset) {
+ DCHECK_EQ(data_img_rel_ro_size_, 0u);
+ if (boot_image_rel_ro_entries_.empty()) {
+ // Nothing to put to the .data.img.rel.ro section.
return offset;
}
- data_bimg_rel_ro_start_ = RoundUp(offset, kElfSegmentAlignment);
+ data_img_rel_ro_start_ = RoundUp(offset, kElfSegmentAlignment);
- for (auto& entry : data_bimg_rel_ro_entries_) {
+ for (auto& entry : boot_image_rel_ro_entries_) {
size_t& entry_offset = entry.second;
- entry_offset = data_bimg_rel_ro_size_;
- data_bimg_rel_ro_size_ += sizeof(uint32_t);
+ entry_offset = data_img_rel_ro_size_;
+ data_img_rel_ro_size_ += sizeof(uint32_t);
}
- offset = data_bimg_rel_ro_start_ + data_bimg_rel_ro_size_;
+ offset = data_img_rel_ro_start_ + data_img_rel_ro_size_;
return offset;
}
@@ -2549,8 +2549,8 @@ bool OatWriter::WriteCode(OutputStream* out) {
return false;
}
- if (data_bimg_rel_ro_size_ != 0u) {
- write_state_ = WriteState::kWriteDataBimgRelRo;
+ if (data_img_rel_ro_size_ != 0u) {
+ write_state_ = WriteState::kWriteDataImgRelRo;
} else {
if (!CheckOatSize(out, file_offset, relative_offset)) {
return false;
@@ -2560,25 +2560,25 @@ bool OatWriter::WriteCode(OutputStream* out) {
return true;
}
-bool OatWriter::WriteDataBimgRelRo(OutputStream* out) {
- CHECK(write_state_ == WriteState::kWriteDataBimgRelRo);
+bool OatWriter::WriteDataImgRelRo(OutputStream* out) {
+ CHECK(write_state_ == WriteState::kWriteDataImgRelRo);
// Wrap out to update checksum with each write.
ChecksumUpdatingOutputStream checksum_updating_out(out, this);
out = &checksum_updating_out;
const size_t file_offset = oat_data_offset_;
- size_t relative_offset = data_bimg_rel_ro_start_;
+ size_t relative_offset = data_img_rel_ro_start_;
- // Record the padding before the .data.bimg.rel.ro section.
+ // Record the padding before the .data.img.rel.ro section.
// Do not write anything, this zero-filled part was skipped (Seek()) when starting the section.
size_t code_end = GetOatHeader().GetExecutableOffset() + code_size_;
DCHECK_EQ(RoundUp(code_end, kElfSegmentAlignment), relative_offset);
size_t padding_size = relative_offset - code_end;
- DCHECK_EQ(size_data_bimg_rel_ro_alignment_, 0u);
- size_data_bimg_rel_ro_alignment_ = padding_size;
+ DCHECK_EQ(size_data_img_rel_ro_alignment_, 0u);
+ size_data_img_rel_ro_alignment_ = padding_size;
- relative_offset = WriteDataBimgRelRo(out, file_offset, relative_offset);
+ relative_offset = WriteDataImgRelRo(out, file_offset, relative_offset);
if (relative_offset == 0) {
LOG(ERROR) << "Failed to write boot image relocations to " << out->GetLocation();
return false;
@@ -2628,8 +2628,8 @@ bool OatWriter::CheckOatSize(OutputStream* out, size_t file_offset, size_t relat
DO_STAT(size_method_header_);
DO_STAT(size_code_);
DO_STAT(size_code_alignment_);
- DO_STAT(size_data_bimg_rel_ro_);
- DO_STAT(size_data_bimg_rel_ro_alignment_);
+ DO_STAT(size_data_img_rel_ro_);
+ DO_STAT(size_data_img_rel_ro_alignment_);
DO_STAT(size_relative_call_thunks_);
DO_STAT(size_misc_thunks_);
DO_STAT(size_vmap_table_);
@@ -3152,29 +3152,29 @@ size_t OatWriter::WriteCodeDexFiles(OutputStream* out,
return relative_offset;
}
-size_t OatWriter::WriteDataBimgRelRo(OutputStream* out,
- size_t file_offset,
- size_t relative_offset) {
- if (data_bimg_rel_ro_entries_.empty()) {
+size_t OatWriter::WriteDataImgRelRo(OutputStream* out,
+ size_t file_offset,
+ size_t relative_offset) {
+ if (boot_image_rel_ro_entries_.empty()) {
return relative_offset;
}
- // Write the entire .data.bimg.rel.ro with a single WriteFully().
+ // Write the entire .data.img.rel.ro with a single WriteFully().
std::vector<uint32_t> data;
- data.reserve(data_bimg_rel_ro_entries_.size());
- for (const auto& entry : data_bimg_rel_ro_entries_) {
+ data.reserve(boot_image_rel_ro_entries_.size());
+ for (const auto& entry : boot_image_rel_ro_entries_) {
uint32_t boot_image_offset = entry.first;
data.push_back(boot_image_offset);
}
- DCHECK_EQ(data.size(), data_bimg_rel_ro_entries_.size());
+ DCHECK_EQ(data.size(), boot_image_rel_ro_entries_.size());
DCHECK_OFFSET();
if (!out->WriteFully(data.data(), data.size() * sizeof(data[0]))) {
- PLOG(ERROR) << "Failed to write .data.bimg.rel.ro in " << out->GetLocation();
+ PLOG(ERROR) << "Failed to write .data.img.rel.ro in " << out->GetLocation();
return 0u;
}
- DCHECK_EQ(size_data_bimg_rel_ro_, 0u);
- size_data_bimg_rel_ro_ = data.size() * sizeof(data[0]);
- relative_offset += size_data_bimg_rel_ro_;
+ DCHECK_EQ(size_data_img_rel_ro_, 0u);
+ size_data_img_rel_ro_ = data.size() * sizeof(data[0]);
+ relative_offset += size_data_img_rel_ro_;
return relative_offset;
}
diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h
index 9d83bcb2f9..d2e761acae 100644
--- a/dex2oat/linker/oat_writer.h
+++ b/dex2oat/linker/oat_writer.h
@@ -133,7 +133,7 @@ class OatWriter {
// - PrepareLayout(),
// - WriteRodata(),
// - WriteCode(),
- // - WriteDataBimgRelRo() iff GetDataBimgRelRoSize() != 0,
+ // - WriteDataImgRelRo() iff GetDataImgRelRoSize() != 0,
// - WriteHeader().
// Add dex file source(s) from a file, either a plain dex file or
@@ -185,8 +185,8 @@ class OatWriter {
bool WriteRodata(OutputStream* out);
// Write the code to the .text section.
bool WriteCode(OutputStream* out);
- // Write the boot image relocation data to the .data.bimg.rel.ro section.
- bool WriteDataBimgRelRo(OutputStream* out);
+ // Write the image relocation data to the .data.img.rel.ro section.
+ bool WriteDataImgRelRo(OutputStream* out);
// Check the size of the written oat file.
bool CheckOatSize(OutputStream* out, size_t file_offset, size_t relative_offset);
// Write the oat header. This finalizes the oat file.
@@ -211,8 +211,8 @@ class OatWriter {
return oat_size_;
}
- size_t GetDataBimgRelRoSize() const {
- return data_bimg_rel_ro_size_;
+ size_t GetDataImgRelRoSize() const {
+ return data_img_rel_ro_size_;
}
size_t GetBssSize() const {
@@ -301,7 +301,7 @@ class OatWriter {
size_t InitBcpBssInfo(size_t offset);
size_t InitOatCode(size_t offset);
size_t InitOatCodeDexFiles(size_t offset);
- size_t InitDataBimgRelRoLayout(size_t offset);
+ size_t InitDataImgRelRoLayout(size_t offset);
void InitBssLayout(InstructionSet instruction_set);
size_t WriteClassOffsets(OutputStream* out, size_t file_offset, size_t relative_offset);
@@ -312,7 +312,7 @@ class OatWriter {
size_t WriteBcpBssInfo(OutputStream* out, size_t file_offset, size_t relative_offset);
size_t WriteCode(OutputStream* out, size_t file_offset, size_t relative_offset);
size_t WriteCodeDexFiles(OutputStream* out, size_t file_offset, size_t relative_offset);
- size_t WriteDataBimgRelRo(OutputStream* out, size_t file_offset, size_t relative_offset);
+ size_t WriteDataImgRelRo(OutputStream* out, size_t file_offset, size_t relative_offset);
// These helpers extract common code from BCP and non-BCP DexFiles from its corresponding methods.
size_t WriteIndexBssMappingsHelper(OutputStream* out,
size_t file_offset,
@@ -362,7 +362,7 @@ class OatWriter {
kPrepareLayout,
kWriteRoData,
kWriteText,
- kWriteDataBimgRelRo,
+ kWriteDataImgRelRo,
kWriteHeader,
kDone
};
@@ -413,16 +413,16 @@ class OatWriter {
// Size required for Oat data structures.
size_t oat_size_;
- // The start of the required .data.bimg.rel.ro section.
- size_t data_bimg_rel_ro_start_;
+ // The start of the optional .data.img.rel.ro section.
+ size_t data_img_rel_ro_start_;
- // The size of the required .data.bimg.rel.ro section holding the boot image relocations.
- size_t data_bimg_rel_ro_size_;
+ // The size of the optional .data.img.rel.ro section holding the image relocations.
+ size_t data_img_rel_ro_size_;
- // The start of the required .bss section.
+ // The start of the optional .bss section.
size_t bss_start_;
- // The size of the required .bss section holding the DexCache data and GC roots.
+ // The size of the optional .bss section holding the DexCache data and GC roots.
size_t bss_size_;
// The offset of the methods in .bss section.
@@ -434,9 +434,9 @@ class OatWriter {
// OatFile's information regarding the bss metadata for BCP DexFiles. Empty for multi-image.
std::vector<BssMappingInfo> bcp_bss_info_;
- // Map for allocating .data.bimg.rel.ro entries. Indexed by the boot image offset of the
- // relocation. The value is the assigned offset within the .data.bimg.rel.ro section.
- SafeMap<uint32_t, size_t> data_bimg_rel_ro_entries_;
+ // Map for allocating boot image .data.img.rel.ro entries. Indexed by the boot image offset
+ // of the relocation. The value is the assigned offset within the .data.img.rel.ro section.
+ SafeMap<uint32_t, size_t> boot_image_rel_ro_entries_;
// Map for recording references to ArtMethod entries in .bss.
SafeMap<const DexFile*, BitVector> bss_method_entry_references_;
@@ -530,8 +530,8 @@ class OatWriter {
uint32_t size_method_header_ = 0;
uint32_t size_code_ = 0;
uint32_t size_code_alignment_ = 0;
- uint32_t size_data_bimg_rel_ro_ = 0;
- uint32_t size_data_bimg_rel_ro_alignment_ = 0;
+ uint32_t size_data_img_rel_ro_ = 0;
+ uint32_t size_data_img_rel_ro_alignment_ = 0;
uint32_t size_relative_call_thunks_ = 0;
uint32_t size_misc_thunks_ = 0;
uint32_t size_vmap_table_ = 0;
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index c33528c63d..0972e5d14a 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -210,7 +210,7 @@ class OatTest : public CommonCompilerDriverTest {
oat_writer.PrepareLayout(&patcher);
elf_writer->PrepareDynamicSection(oat_writer.GetOatHeader().GetExecutableOffset(),
oat_writer.GetCodeSize(),
- oat_writer.GetDataBimgRelRoSize(),
+ oat_writer.GetDataImgRelRoSize(),
oat_writer.GetBssSize(),
oat_writer.GetBssMethodsOffset(),
oat_writer.GetBssRootsOffset(),
@@ -228,12 +228,12 @@ class OatTest : public CommonCompilerDriverTest {
}
elf_writer->EndText(text);
- if (oat_writer.GetDataBimgRelRoSize() != 0u) {
- OutputStream* data_bimg_rel_ro = elf_writer->StartDataBimgRelRo();
- if (!oat_writer.WriteDataBimgRelRo(data_bimg_rel_ro)) {
+ if (oat_writer.GetDataImgRelRoSize() != 0u) {
+ OutputStream* data_img_rel_ro = elf_writer->StartDataImgRelRo();
+ if (!oat_writer.WriteDataImgRelRo(data_img_rel_ro)) {
return false;
}
- elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
+ elf_writer->EndDataImgRelRo(data_img_rel_ro);
}
if (!oat_writer.WriteHeader(elf_writer->GetStream())) {
diff --git a/libelffile/elf/elf_builder.h b/libelffile/elf/elf_builder.h
index 309417e4d8..908ad5cb89 100644
--- a/libelffile/elf/elf_builder.h
+++ b/libelffile/elf/elf_builder.h
@@ -463,7 +463,7 @@ class ElfBuilder final {
rodata_(this, ".rodata", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, kElfSegmentAlignment, 0),
text_(this, ".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR, nullptr, 0,
kElfSegmentAlignment, 0),
- data_bimg_rel_ro_(this, ".data.bimg.rel.ro", SHT_PROGBITS, SHF_ALLOC, nullptr, 0,
+ data_img_rel_ro_(this, ".data.img.rel.ro", SHT_PROGBITS, SHF_ALLOC, nullptr, 0,
kElfSegmentAlignment, 0),
bss_(this, ".bss", SHT_NOBITS, SHF_ALLOC, nullptr, 0, kElfSegmentAlignment, 0),
dex_(this, ".dex", SHT_NOBITS, SHF_ALLOC, nullptr, 0, kElfSegmentAlignment, 0),
@@ -488,7 +488,7 @@ class ElfBuilder final {
loaded_size_(0u),
virtual_address_(0) {
text_.phdr_flags_ = PF_R | PF_X;
- data_bimg_rel_ro_.phdr_flags_ = PF_R | PF_W; // Shall be made read-only at run time.
+ data_img_rel_ro_.phdr_flags_ = PF_R | PF_W; // Shall be made read-only at run time.
bss_.phdr_flags_ = PF_R | PF_W;
dex_.phdr_flags_ = PF_R;
dynamic_.phdr_flags_ = PF_R | PF_W;
@@ -501,7 +501,7 @@ class ElfBuilder final {
BuildIdSection* GetBuildId() { return &build_id_; }
Section* GetRoData() { return &rodata_; }
Section* GetText() { return &text_; }
- Section* GetDataBimgRelRo() { return &data_bimg_rel_ro_; }
+ Section* GetDataImgRelRo() { return &data_img_rel_ro_; }
Section* GetBss() { return &bss_; }
Section* GetDex() { return &dex_; }
StringSection* GetStrTab() { return &strtab_; }
@@ -640,7 +640,7 @@ class ElfBuilder final {
void PrepareDynamicSection(const std::string& elf_file_path,
Elf_Word rodata_size,
Elf_Word text_size,
- Elf_Word data_bimg_rel_ro_size,
+ Elf_Word data_img_rel_ro_size,
Elf_Word bss_size,
Elf_Word bss_methods_offset,
Elf_Word bss_roots_offset,
@@ -654,8 +654,8 @@ class ElfBuilder final {
// Allocate all pre-dynamic sections.
rodata_.AllocateVirtualMemory(rodata_size);
text_.AllocateVirtualMemory(text_size);
- if (data_bimg_rel_ro_size != 0) {
- data_bimg_rel_ro_.AllocateVirtualMemory(data_bimg_rel_ro_size);
+ if (data_img_rel_ro_size != 0) {
+ data_img_rel_ro_.AllocateVirtualMemory(data_img_rel_ro_size);
}
if (bss_size != 0) {
bss_.AllocateVirtualMemory(bss_size);
@@ -682,20 +682,20 @@ class ElfBuilder final {
Elf_Word oatlastword_address = rodata_.GetAddress() + rodata_size - 4;
dynsym_.Add(oatlastword, &rodata_, oatlastword_address, 4, STB_GLOBAL, STT_OBJECT);
}
- if (data_bimg_rel_ro_size != 0u) {
- Elf_Word oatdatabimgrelro = dynstr_.Add("oatdatabimgrelro");
- dynsym_.Add(oatdatabimgrelro,
- &data_bimg_rel_ro_,
- data_bimg_rel_ro_.GetAddress(),
- data_bimg_rel_ro_size,
+ if (data_img_rel_ro_size != 0u) {
+ Elf_Word oatdataimgrelro = dynstr_.Add("oatdataimgrelro");
+ dynsym_.Add(oatdataimgrelro,
+ &data_img_rel_ro_,
+ data_img_rel_ro_.GetAddress(),
+ data_img_rel_ro_size,
STB_GLOBAL,
STT_OBJECT);
- Elf_Word oatdatabimgrelrolastword = dynstr_.Add("oatdatabimgrelrolastword");
- Elf_Word oatdatabimgrelrolastword_address =
- data_bimg_rel_ro_.GetAddress() + data_bimg_rel_ro_size - 4;
- dynsym_.Add(oatdatabimgrelrolastword,
- &data_bimg_rel_ro_,
- oatdatabimgrelrolastword_address,
+ Elf_Word oatdataimgrelrolastword = dynstr_.Add("oatdataimgrelrolastword");
+ Elf_Word oatdataimgrelrolastword_address =
+ data_img_rel_ro_.GetAddress() + data_img_rel_ro_size - 4;
+ dynsym_.Add(oatdataimgrelrolastword,
+ &data_img_rel_ro_,
+ oatdataimgrelrolastword_address,
4,
STB_GLOBAL,
STT_OBJECT);
@@ -974,7 +974,7 @@ class ElfBuilder final {
Section rodata_;
Section text_;
- Section data_bimg_rel_ro_;
+ Section data_img_rel_ro_;
Section bss_;
Section dex_;
CachedStringSection dynstr_;
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 0c362d9c1a..5e41982bd3 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -182,7 +182,7 @@ class OatSymbolizer final {
builder_->PrepareDynamicSection(elf_file->GetPath(),
rodata_size,
text_size,
- oat_file_->DataBimgRelRoSize(),
+ oat_file_->DataImgRelRoSize(),
oat_file_->BssSize(),
oat_file_->BssMethodsOffset(),
oat_file_->BssRootsOffset(),
@@ -512,8 +512,8 @@ class OatDumper {
os << StringPrintf("0x%08x\n\n", resolved_addr2instr_);
}
- // Dump .data.bimg.rel.ro entries.
- DumpDataBimgRelRoEntries(os);
+ // Dump .data.img.rel.ro entries.
+ DumpDataImgRelRoEntries(os);
// Dump .bss summary, individual entries are dumped per dex file.
os << ".bss: ";
@@ -1630,8 +1630,8 @@ class OatDumper {
boot_image_live_objects_address + end_offset);
}
- void DumpDataBimgRelRoEntries(std::ostream& os) {
- os << ".data.bimg.rel.ro: ";
+ void DumpDataImgRelRoEntries(std::ostream& os) {
+ os << ".data.img.rel.ro: ";
if (oat_file_.GetBootImageRelocations().empty()) {
os << "empty.\n\n";
return;
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index d7c0582e7b..050896041b 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4214,7 +4214,7 @@ void ClassLinker::RegisterDexFileLocked(const DexFile& dex_file,
CHECK_EQ(dex_cache_location, dex_file_suffix);
}
- // Check if we need to initialize OatFile data (.data.bimg.rel.ro and .bss
+ // Check if we need to initialize OatFile data (.data.img.rel.ro and .bss
// sections) needed for code execution and register the oat code range.
const OatFile* oat_file =
(dex_file.GetOatDexFile() != nullptr) ? dex_file.GetOatDexFile()->GetOatFile() : nullptr;
diff --git a/runtime/oat/oat.h b/runtime/oat/oat.h
index 1d6a71a560..99ac12f9ec 100644
--- a/runtime/oat/oat.h
+++ b/runtime/oat/oat.h
@@ -44,8 +44,8 @@ std::ostream& operator<<(std::ostream& stream, StubType stub_type);
class EXPORT PACKED(4) OatHeader {
public:
static constexpr std::array<uint8_t, 4> kOatMagic { { 'o', 'a', 't', '\n' } };
- // Last oat version changed reason: store resolved MethodType-s in .bss.
- static constexpr std::array<uint8_t, 4> kOatVersion{{'2', '4', '1', '\0'}};
+ // Last oat version changed reason: Rename `.data.bimg.rel.ro` to `.data.img.rel.ro`.
+ static constexpr std::array<uint8_t, 4> kOatVersion{{'2', '4', '2', '\0'}};
static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
static constexpr const char* kDebuggableKey = "debuggable";
diff --git a/runtime/oat/oat_file.cc b/runtime/oat/oat_file.cc
index 6d1b85ec67..e0d7aa79a3 100644
--- a/runtime/oat/oat_file.cc
+++ b/runtime/oat/oat_file.cc
@@ -346,17 +346,17 @@ bool OatFileBase::ComputeFields(const std::string& file_path, std::string* error
// Readjust to be non-inclusive upper bound.
end_ += sizeof(uint32_t);
- data_bimg_rel_ro_begin_ = FindDynamicSymbolAddress("oatdatabimgrelro", &symbol_error_msg);
- if (data_bimg_rel_ro_begin_ != nullptr) {
- data_bimg_rel_ro_end_ =
- FindDynamicSymbolAddress("oatdatabimgrelrolastword", &symbol_error_msg);
- if (data_bimg_rel_ro_end_ == nullptr) {
+ data_img_rel_ro_begin_ = FindDynamicSymbolAddress("oatdataimgrelro", &symbol_error_msg);
+ if (data_img_rel_ro_begin_ != nullptr) {
+ data_img_rel_ro_end_ =
+ FindDynamicSymbolAddress("oatdataimgrelrolastword", &symbol_error_msg);
+ if (data_img_rel_ro_end_ == nullptr) {
*error_msg =
- StringPrintf("Failed to find oatdatabimgrelrolastword symbol in '%s'", file_path.c_str());
+ StringPrintf("Failed to find oatdataimgrelrolastword symbol in '%s'", file_path.c_str());
return false;
}
// Readjust to be non-inclusive upper bound.
- data_bimg_rel_ro_end_ += sizeof(uint32_t);
+ data_img_rel_ro_end_ += sizeof(uint32_t);
}
bss_begin_ = const_cast<uint8_t*>(FindDynamicSymbolAddress("oatbss", &symbol_error_msg));
@@ -610,14 +610,14 @@ bool OatFileBase::Setup(int zip_fd,
}
const uint8_t* oat = Begin() + oat_dex_files_offset; // Jump to the OatDexFile records.
- if (!IsAligned<sizeof(uint32_t)>(data_bimg_rel_ro_begin_) ||
- !IsAligned<sizeof(uint32_t)>(data_bimg_rel_ro_end_) ||
- data_bimg_rel_ro_begin_ > data_bimg_rel_ro_end_) {
+ if (!IsAligned<sizeof(uint32_t)>(data_img_rel_ro_begin_) ||
+ !IsAligned<sizeof(uint32_t)>(data_img_rel_ro_end_) ||
+ data_img_rel_ro_begin_ > data_img_rel_ro_end_) {
*error_msg = StringPrintf("In oat file '%s' found unaligned or unordered databimgrelro "
"symbol(s): begin = %p, end = %p",
GetLocation().c_str(),
- data_bimg_rel_ro_begin_,
- data_bimg_rel_ro_end_);
+ data_img_rel_ro_begin_,
+ data_img_rel_ro_end_);
return false;
}
@@ -1122,13 +1122,13 @@ bool OatFileBase::Setup(int zip_fd,
return false;
}
- if (DataBimgRelRoBegin() != nullptr) {
- // Make .data.bimg.rel.ro read only. ClassLinker shall temporarily make it writable for
+ if (DataImgRelRoBegin() != nullptr) {
+ // Make .data.img.rel.ro read only. ClassLinker shall temporarily make it writable for
// relocation when we register a dex file from this oat file. We do not do the relocation
// here to avoid dirtying the pages if the code is never actually ready to be executed.
- uint8_t* reloc_begin = const_cast<uint8_t*>(DataBimgRelRoBegin());
- CheckedCall(mprotect, "protect relocations", reloc_begin, DataBimgRelRoSize(), PROT_READ);
- // Make sure the file lists a boot image dependency, otherwise the .data.bimg.rel.ro
+ uint8_t* reloc_begin = const_cast<uint8_t*>(DataImgRelRoBegin());
+ CheckedCall(mprotect, "protect relocations", reloc_begin, DataImgRelRoSize(), PROT_READ);
+ // Make sure the file lists a boot image dependency, otherwise the .data.img.rel.ro
// section is bogus. The full dependency is checked before the code is executed.
// We cannot do this check if we do not have a key-value store, i.e. for secondary
// oat files for boot image extensions.
@@ -1137,7 +1137,7 @@ bool OatFileBase::Setup(int zip_fd,
GetOatHeader().GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey);
if (boot_class_path_checksum == nullptr ||
boot_class_path_checksum[0] != gc::space::ImageSpace::kImageChecksumPrefix) {
- *error_msg = StringPrintf("Oat file '%s' contains .data.bimg.rel.ro section "
+ *error_msg = StringPrintf("Oat file '%s' contains .data.img.rel.ro section "
"without boot image dependency.",
GetLocation().c_str());
return false;
@@ -2056,8 +2056,8 @@ OatFile::OatFile(const std::string& location, bool is_executable)
vdex_(nullptr),
begin_(nullptr),
end_(nullptr),
- data_bimg_rel_ro_begin_(nullptr),
- data_bimg_rel_ro_end_(nullptr),
+ data_img_rel_ro_begin_(nullptr),
+ data_img_rel_ro_end_(nullptr),
bss_begin_(nullptr),
bss_end_(nullptr),
bss_methods_(nullptr),
@@ -2096,9 +2096,9 @@ const uint8_t* OatFile::DexEnd() const {
}
ArrayRef<const uint32_t> OatFile::GetBootImageRelocations() const {
- if (data_bimg_rel_ro_begin_ != nullptr) {
- const uint32_t* relocations = reinterpret_cast<const uint32_t*>(data_bimg_rel_ro_begin_);
- const uint32_t* relocations_end = reinterpret_cast<const uint32_t*>(data_bimg_rel_ro_end_);
+ if (data_img_rel_ro_begin_ != nullptr) {
+ const uint32_t* relocations = reinterpret_cast<const uint32_t*>(data_img_rel_ro_begin_);
+ const uint32_t* relocations_end = reinterpret_cast<const uint32_t*>(data_img_rel_ro_end_);
return ArrayRef<const uint32_t>(relocations, relocations_end - relocations);
} else {
return ArrayRef<const uint32_t>();
@@ -2528,13 +2528,13 @@ static void DCheckIndexToBssMapping(const OatFile* oat_file,
void OatFile::InitializeRelocations() const {
DCHECK(IsExecutable());
- // Initialize the .data.bimg.rel.ro section.
+ // Initialize the .data.img.rel.ro section.
if (!GetBootImageRelocations().empty()) {
- uint8_t* reloc_begin = const_cast<uint8_t*>(DataBimgRelRoBegin());
+ uint8_t* reloc_begin = const_cast<uint8_t*>(DataImgRelRoBegin());
CheckedCall(mprotect,
"un-protect boot image relocations",
reloc_begin,
- DataBimgRelRoSize(),
+ DataImgRelRoSize(),
PROT_READ | PROT_WRITE);
uint32_t boot_image_begin = Runtime::Current()->GetHeap()->GetBootImagesStartAddress();
for (const uint32_t& relocation : GetBootImageRelocations()) {
@@ -2543,7 +2543,7 @@ void OatFile::InitializeRelocations() const {
CheckedCall(mprotect,
"protect boot image relocations",
reloc_begin,
- DataBimgRelRoSize(),
+ DataImgRelRoSize(),
PROT_READ);
}
diff --git a/runtime/oat/oat_file.h b/runtime/oat/oat_file.h
index fd1686aa65..5c29a8d439 100644
--- a/runtime/oat/oat_file.h
+++ b/runtime/oat/oat_file.h
@@ -325,8 +325,8 @@ class OatFile {
return p >= Begin() && p < End();
}
- size_t DataBimgRelRoSize() const {
- return DataBimgRelRoEnd() - DataBimgRelRoBegin();
+ size_t DataImgRelRoSize() const {
+ return DataImgRelRoEnd() - DataImgRelRoBegin();
}
size_t BssSize() const {
@@ -354,8 +354,8 @@ class OatFile {
EXPORT const uint8_t* Begin() const;
EXPORT const uint8_t* End() const;
- const uint8_t* DataBimgRelRoBegin() const { return data_bimg_rel_ro_begin_; }
- const uint8_t* DataBimgRelRoEnd() const { return data_bimg_rel_ro_end_; }
+ const uint8_t* DataImgRelRoBegin() const { return data_img_rel_ro_begin_; }
+ const uint8_t* DataImgRelRoEnd() const { return data_img_rel_ro_end_; }
const uint8_t* BssBegin() const { return bss_begin_; }
const uint8_t* BssEnd() const { return bss_end_; }
@@ -370,7 +370,7 @@ class OatFile {
EXPORT ArrayRef<ArtMethod*> GetBssMethods() const;
EXPORT ArrayRef<GcRoot<mirror::Object>> GetBssGcRoots() const;
- // Initialize relocation sections (.data.bimg.rel.ro and .bss).
+ // Initialize relocation sections (.data.img.rel.ro and .bss).
void InitializeRelocations() const;
// Finds the associated oat class for a dex_file and descriptor. Returns an invalid OatClass on
@@ -423,11 +423,11 @@ class OatFile {
// Pointer to end of oat region for bounds checking.
const uint8_t* end_;
- // Pointer to the .data.bimg.rel.ro section, if present, otherwise null.
- const uint8_t* data_bimg_rel_ro_begin_;
+ // Pointer to the .data.img.rel.ro section, if present, otherwise null.
+ const uint8_t* data_img_rel_ro_begin_;
- // Pointer to the end of the .data.bimg.rel.ro section, if present, otherwise null.
- const uint8_t* data_bimg_rel_ro_end_;
+ // Pointer to the end of the .data.img.rel.ro section, if present, otherwise null.
+ const uint8_t* data_img_rel_ro_end_;
// Pointer to the .bss section, if present, otherwise null.
uint8_t* bss_begin_;
diff --git a/runtime/read_barrier_option.h b/runtime/read_barrier_option.h
index ad8297394b..fd2d6025f9 100644
--- a/runtime/read_barrier_option.h
+++ b/runtime/read_barrier_option.h
@@ -30,7 +30,7 @@ namespace art HIDDEN {
//
// 1. We're reading a reference known to point to an un-reclaimable immune space object.
// (For example boot image class and string references, read by compiled code from
-// .data.bimg.rel.ro . Similarly, such references constructed using position independent
+// .data.img.rel.ro . Similarly, such references constructed using position independent
// code in the compiled boot image code do not need a read barrier.)
// 2. We're reading the reference for comparison involving a non-moving space reference.
// (Whether the non-moving space reference is the one we're reading or the one we shall
diff --git a/test/683-clinit-inline-static-invoke/src/Main.java b/test/683-clinit-inline-static-invoke/src/Main.java
index d2225397b5..f9e3488ffc 100644
--- a/test/683-clinit-inline-static-invoke/src/Main.java
+++ b/test/683-clinit-inline-static-invoke/src/Main.java
@@ -21,7 +21,7 @@ public class Main {
// When we inline this getter, we're left with HLoadClass+HClinitCheck which cannot
// be merged back to the InvokeStaticOrDirect for implicit class init check.
// The declaring class is in the boot image, so the LoadClass can load it using the
- // .data.bimg.rel.ro section. However, the ClinitCheck entrypoint was previously
+ // .data.img.rel.ro section. However, the ClinitCheck entrypoint was previously
// taking a type index of the declaring class and since we did not have a valid
// TypeId in the current DexFile, we erroneously provided the type index from the
// declaring DexFile and that caused a crash. This was fixed by changing the
diff --git a/test/ProfileTestMultiDex/Second.java b/test/ProfileTestMultiDex/Second.java
index c9b3c0be04..c0e6ee1442 100644
--- a/test/ProfileTestMultiDex/Second.java
+++ b/test/ProfileTestMultiDex/Second.java
@@ -34,7 +34,7 @@ class SubC extends Super {
class TestIntrinsicOatdump {
Integer valueOf(int i) {
// ProfileTestMultiDex is used also for testing oatdump for apps.
- // This is a regression test that oatdump can handle .data.bimg.rel.ro
+ // This is a regression test that oatdump can handle .data.img.rel.ro
// entries pointing to the middle of the "boot image live objects" array.
return Integer.valueOf(i);
}