From 2326b7b24f31df30c2e97ea140733e6602187ee1 Mon Sep 17 00:00:00 2001 From: Ethan Lafrenais Date: Sat, 9 Nov 2024 00:37:09 -0500 Subject: [PATCH] Revert "Add the concept of unaligned relocs" This reverts commit 75a51d2491fed228debf3c919b34fb431651953e. --- include/generator.h | 1 - include/n64recomp.h | 1 - src/cgenerator.cpp | 8 ++++---- src/config.cpp | 2 -- src/recompilation.cpp | 3 --- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/generator.h b/include/generator.h index 44d6c94..5afcc57 100644 --- a/include/generator.h +++ b/include/generator.h @@ -23,7 +23,6 @@ namespace N64Recomp { RelocType reloc_type; uint32_t reloc_section_index; uint32_t reloc_target_section_offset; - bool reloc_unaligned; }; class Generator { diff --git a/include/n64recomp.h b/include/n64recomp.h index ee1b63b..273a20a 100644 --- a/include/n64recomp.h +++ b/include/n64recomp.h @@ -56,7 +56,6 @@ namespace N64Recomp { uint16_t target_section; RelocType type; bool reference_symbol; - bool unaligned; }; // Special section indices. diff --git a/src/cgenerator.cpp b/src/cgenerator.cpp index 13fa7a3..7751568 100644 --- a/src/cgenerator.cpp +++ b/src/cgenerator.cpp @@ -103,11 +103,11 @@ std::string fpr_u64_to_string(int fpr_index) { std::string unsigned_reloc(const N64Recomp::InstructionContext& context) { switch (context.reloc_type) { case N64Recomp::RelocType::R_MIPS_HI16: - return fmt::format("{}RELOC_HI16{}({}, {:#X})", - context.reloc_tag_as_reference ? "REF_" : "", context.reloc_unaligned ? "_UNALIGNED" : "", context.reloc_section_index, context.reloc_target_section_offset); + return fmt::format("{}RELOC_HI16({}, {:#X})", + context.reloc_tag_as_reference ? "REF_" : "", context.reloc_section_index, context.reloc_target_section_offset); case N64Recomp::RelocType::R_MIPS_LO16: - return fmt::format("{}RELOC_LO16{}({}, {:#X})", - context.reloc_tag_as_reference ? "REF_" : "", context.reloc_unaligned ? "_UNALIGNED" : "", context.reloc_section_index, context.reloc_target_section_offset); + return fmt::format("{}RELOC_LO16({}, {:#X})", + context.reloc_tag_as_reference ? "REF_" : "", context.reloc_section_index, context.reloc_target_section_offset); default: throw std::runtime_error(fmt::format("Unexpected reloc type {}\n", static_cast(context.reloc_type))); } diff --git a/src/config.cpp b/src/config.cpp index 9a23f63..5cc7108 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -569,7 +569,6 @@ bool N64Recomp::Context::from_symbol_file(const std::filesystem::path& symbol_fi std::optional vram = reloc_el["vram"].template value(); std::optional target_vram = reloc_el["target_vram"].template value(); std::optional type_string = reloc_el["type"].template value(); - std::optional unaligned = reloc_el["unaligned"].template value(); if (!vram.has_value() || !target_vram.has_value() || !type_string.has_value()) { throw toml::parse_error("Reloc entry missing required field(s)", reloc_el.source()); @@ -587,7 +586,6 @@ bool N64Recomp::Context::from_symbol_file(const std::filesystem::path& symbol_fi cur_reloc.symbol_index = (uint32_t)-1; cur_reloc.target_section = section_index; cur_reloc.type = reloc_type; - cur_reloc.unaligned = unaligned.value_or(false); section.relocs.emplace_back(cur_reloc); } diff --git a/src/recompilation.cpp b/src/recompilation.cpp index 51e17a0..3c08943 100644 --- a/src/recompilation.cpp +++ b/src/recompilation.cpp @@ -148,7 +148,6 @@ bool process_instruction(const N64Recomp::Context& context, const N64Recomp::Fun uint32_t reloc_section = 0; uint32_t reloc_target_section_offset = 0; size_t reloc_reference_symbol = (size_t)-1; - bool reloc_unaligned = false; uint32_t func_vram_end = func.vram + func.words.size() * sizeof(func.words[0]); @@ -172,7 +171,6 @@ bool process_instruction(const N64Recomp::Context& context, const N64Recomp::Fun // Record the reloc's data. reloc_type = reloc.type; reloc_target_section_offset = reloc.target_section_offset; - reloc_unaligned = reloc.unaligned; // Ignore all relocs that aren't MIPS_HI16, MIPS_LO16 or MIPS_26. if (reloc_type == N64Recomp::RelocType::R_MIPS_HI16 || reloc_type == N64Recomp::RelocType::R_MIPS_LO16 || reloc_type == N64Recomp::RelocType::R_MIPS_26) { if (reloc.reference_symbol) { @@ -589,7 +587,6 @@ bool process_instruction(const N64Recomp::Context& context, const N64Recomp::Fun instruction_context.reloc_type = reloc_type; instruction_context.reloc_section_index = reloc_section; instruction_context.reloc_target_section_offset = reloc_target_section_offset; - instruction_context.reloc_unaligned = reloc_unaligned; auto do_check_fr = [](std::ostream& output_file, const CGenerator& generator, const InstructionContext& ctx, Operand operand) { switch (operand) {