diff options
author | Samuel Huang <huangs@chromium.org> | 2021-08-04 00:58:50 +0000 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2021-08-03 18:07:42 -0700 |
commit | 3e1f64d1395c53a730475d930b663d5f6006099e (patch) | |
tree | b8ebaace02a34c080bbcfec6fa3c89379d6d6ce4 /reloc_elf_unittest.cc | |
parent | cc55358d0d888c102638c2937e73f6a2e52518ca (diff) | |
download | zucchini-3e1f64d1395c53a730475d930b663d5f6006099e.tar.gz |
[Zucchini] Disassemblers: Fix abs32 width for ELF; cleanup Traits template param.
Previously DisassemblerElfIntel<TRAITS>::ParseExecSection() passes a
hard-coded 4 to Abs32GapFinder's |abs32_width| CTOR param. This is
wrong for X64, which has abs32 pointer width of 8 bytes. This can lead
to lower quality rel32 extraction.
This CL fixes the above by replacing 4 with Traits::kVAWidth, and also
cleans up TRAITS / Traits template parameter for Disassembler:
* For template param, "template <class TRAITS>" is used throughout.
* This means function params needs to use TRAITS.
* For usage, each Disassembler class with TRAITS declares
using Traits = TRAITS;
(and variant) and uses Traits in the body of all functions. Reason:
Specialized derive classes won't have TRAITS available , so:
* Function params can use DisassemblerBase::Traits.
* Function bodies can use Traits.
* For consistency, even if TRAITS is available, still use Traits.
Bug: 1233831
Change-Id: Ie796c867fb238eca462b2fb6b4e68a965996c25a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3063919
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#908261}
NOKEYCHECK=True
GitOrigin-RevId: 294860c47cd3678c46422ce57da366724e1dc629
Diffstat (limited to 'reloc_elf_unittest.cc')
-rw-r--r-- | reloc_elf_unittest.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/reloc_elf_unittest.cc b/reloc_elf_unittest.cc index b03f403..8a1b932 100644 --- a/reloc_elf_unittest.cc +++ b/reloc_elf_unittest.cc @@ -48,9 +48,10 @@ SectionDimensionsElf MakeSectionDimensions(const BufferRegion& region, } // Helper to manipulate an image with one or more relocation tables. -template <class ElfIntelTraits> +template <class ELF_INTEL_TRAITS> class FakeImageWithReloc { public: + using ElfIntelTraits = ELF_INTEL_TRAITS; struct RelocSpec { offset_t start; std::vector<uint8_t> data; |