aboutsummaryrefslogtreecommitdiff
path: root/arm_utils.h
diff options
context:
space:
mode:
authorSamuel Huang <huangs@chromium.org>2021-08-05 16:46:38 +0000
committerCopybara-Service <copybara-worker@google.com>2021-08-05 10:05:02 -0700
commitfa10b05c4854c6d8a603ee47c2a213cbc23f8646 (patch)
tree94ad9d794dedc26bd0e0be4b18511d45026a0b98 /arm_utils.h
parent3e1f64d1395c53a730475d930b663d5f6006099e (diff)
downloadzucchini-fa10b05c4854c6d8a603ee47c2a213cbc23f8646.tar.gz
[Zucchini] Add ARM support for ELF files.
This CL enables ARM-ELF (AArch32 and AArch64) support in Zucchini. * Define ARM {AArch32, AArch64}ReferenceType. * Add Rel32Finder{Arm, AArch32, AArch64} (with tests) to use previously-added ARM disassembly code to extract rel32 references. * Add DisassemblerElf{Arm, AArch32, AArch64} to parse ARM ELF files and create reference readers / writers, and reference groups. * For AArch32: Add heuristic detection of ARM vs. Thumb2 mode. * Add IsTargetOffsetInElfSectionList() (with tests) to help ARM reject false positive references. * Add ReferenceBytesMixerElfArm to remove redundant reference target information from bytewise correction data. Bug: 918867 Change-Id: I1e6d3d8b8d174c85a3d44ca6d642b7ff0bd6a6a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2922822 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#908913} NOKEYCHECK=True GitOrigin-RevId: 85cc8a596f183487b395a59e80b2f654f241ab2c
Diffstat (limited to 'arm_utils.h')
-rw-r--r--arm_utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/arm_utils.h b/arm_utils.h
index 63c7538..8664f3e 100644
--- a/arm_utils.h
+++ b/arm_utils.h
@@ -213,6 +213,8 @@ class AArch32Rel32Translator {
// |instr_rva| as aid.
static ArmAlign DecodeA24(uint32_t code32, arm_disp_t* disp);
static bool EncodeA24(arm_disp_t disp, uint32_t* code32);
+ // TODO(huangs): Refactor the Read*() functions: These are identical
+ // except for Decode*() and Get*TargetRvaFromDisp().
static bool ReadA24(rva_t instr_rva, uint32_t code32, rva_t* target_rva);
static bool WriteA24(rva_t instr_rva, rva_t target_rva, uint32_t* code32);
@@ -362,6 +364,8 @@ class AArch64Rel32Translator {
// to the counterparts in AArch32Rel32Translator.
static ArmAlign DecodeImmd14(uint32_t code32, arm_disp_t* disp);
static bool EncodeImmd14(arm_disp_t disp, uint32_t* code32);
+ // TODO(huangs): Refactor the Read*() functions: These are identical
+ // except for Decode*().
static bool ReadImmd14(rva_t instr_rva, uint32_t code32, rva_t* target_rva);
static bool WriteImmd14(rva_t instr_rva, rva_t target_rva, uint32_t* code32);