Skip to content

Commit

Permalink
[Courgette] Deprecate ARM support.
Browse files Browse the repository at this point in the history
Courgette's ARM support was complex and was never used (except for
helping to prototype Zucchini's ARM flow, which is WIP). Recently the
code is also causing Fuzzer issues. Therefore we deem it better to just
remove the code.

This CL performs superficial removal of ARM code. For compatibility,
the enums

  enum ExecutableType { EXE_ELF_32_ARM = 3; }
  enum EncodedProgram::OP { MAKE_ELF_ARM_RELOCATION_TABLE = 7; }

are deprecated and commented out, without changing other values.

Bug: 1012592
Change-Id: Iad3a3c9e41470eef8ff004591e6ed42ea4315d06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986211
Reviewed-by: Etienne Pierre-Doray <[email protected]>
Commit-Queue: Samuel Huang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#728580}
  • Loading branch information
samuelhuang authored and Commit Bot committed Jan 6, 2020
1 parent c204025 commit f18358c
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 1,005 deletions.
2 changes: 0 additions & 2 deletions courgette/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ static_library("courgette_lib") {
"disassembler.h",
"disassembler_elf_32.cc",
"disassembler_elf_32.h",
"disassembler_elf_32_arm.cc",
"disassembler_elf_32_arm.h",
"disassembler_elf_32_x86.cc",
"disassembler_elf_32_x86.h",
"disassembler_win32.cc",
Expand Down
15 changes: 2 additions & 13 deletions courgette/assembly_program.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class LabelReceptor : public InstructionReceptor {
// InstructionReceptor:
CheckBool EmitPeRelocs() override { return true; }
CheckBool EmitElfRelocation() override { return true; }
CheckBool EmitElfARMRelocation() override { return true; }
CheckBool EmitOrigin(RVA rva) override { return true; }
CheckBool EmitSingleByte(uint8_t byte) override { return true; }
CheckBool EmitMultipleBytes(const uint8_t* bytes, size_t len) override {
Expand All @@ -41,13 +40,6 @@ class LabelReceptor : public InstructionReceptor {
rel32_vector_.push_back(label);
return true;
}
CheckBool EmitRel32ARM(uint16_t op,
Label* label,
const uint8_t* arm_op,
uint16_t op_size) override {
rel32_vector_.push_back(label);
return true;
}
CheckBool EmitAbs32(Label* label) override {
abs32_vector_.push_back(label);
return true;
Expand Down Expand Up @@ -75,18 +67,15 @@ void AssemblyProgram::PrecomputeLabels(RvaVisitor* abs32_visitor,
RvaVisitor* rel32_visitor) {
abs32_label_manager_.Read(abs32_visitor);
rel32_label_manager_.Read(rel32_visitor);
TrimLabels();
// TrimLabels() should be called here if used. Previously this was used only
// for ARM binaries, but ARM support has been deprecated.
}

// Chosen empirically to give the best reduction in payload size for
// an update from daisy_3701.98.0 to daisy_4206.0.0.
const int AssemblyProgram::kLabelLowerLimit = 5;

void AssemblyProgram::TrimLabels() {
// For now only trim for ARM binaries.
if (kind() != EXE_ELF_32_ARM)
return;

int lower_limit = kLabelLowerLimit;

VLOG(1) << "TrimLabels: threshold " << lower_limit;
Expand Down
2 changes: 1 addition & 1 deletion courgette/courgette.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum ExecutableType {
EXE_UNKNOWN = 0,
EXE_WIN_32_X86 = 1,
EXE_ELF_32_X86 = 2,
EXE_ELF_32_ARM = 3,
// EXE_ELF_32_ARM_DEPRECATED = 3, // DEPRECATED.
EXE_WIN_32_X64 = 4,
};

Expand Down
5 changes: 0 additions & 5 deletions courgette/courgette_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ bool Supported(const base::FilePath& input_file) {
result = true;
break;

case courgette::EXE_ELF_32_ARM:
format = "ELF 32 ARM";
result = true;
break;

case courgette::EXE_WIN_32_X64:
format = "Windows 64 PE";
result = true;
Expand Down
1 change: 0 additions & 1 deletion courgette/description.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ <h3>Disassemble</h3>
<ul>
<li><p>disassembler_win32_x86.h defines the PE/COFF x86 disassembler</p></li>
<li><p>disassembler_elf_32_x86.h defines the ELF 32-bit x86 disassembler</p></li>
<li><p>disassembler_elf_32_arm.h defines the ELF 32-bit arm disassembler</p></li>
</ul></li>
<li><p>The Disassembler replaces the relocation table with a Courgette
instruction that can regenerate the relocation table.</p></li>
Expand Down
2 changes: 0 additions & 2 deletions courgette/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Patch Generation

- disassembler\_elf\_32\_x86.h defines the ELF 32-bit x86 disassembler

- disassembler\_elf\_32\_arm.h defines the ELF 32-bit arm disassembler

- The Disassembler replaces the relocation table with a Courgette
instruction that can regenerate the relocation table.

Expand Down
Loading

0 comments on commit f18358c

Please sign in to comment.