mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-05-14 08:12:19 +00:00
Revert "Add the concept of unaligned relocs"
This reverts commit 75a51d2491
.
This commit is contained in:
parent
75a51d2491
commit
2326b7b24f
5 changed files with 4 additions and 11 deletions
|
@ -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 {
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace N64Recomp {
|
|||
uint16_t target_section;
|
||||
RelocType type;
|
||||
bool reference_symbol;
|
||||
bool unaligned;
|
||||
};
|
||||
|
||||
// Special section indices.
|
||||
|
|
|
@ -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<int>(context.reloc_type)));
|
||||
}
|
||||
|
|
|
@ -569,7 +569,6 @@ bool N64Recomp::Context::from_symbol_file(const std::filesystem::path& symbol_fi
|
|||
std::optional<uint32_t> vram = reloc_el["vram"].template value<uint32_t>();
|
||||
std::optional<uint32_t> target_vram = reloc_el["target_vram"].template value<uint32_t>();
|
||||
std::optional<std::string> type_string = reloc_el["type"].template value<std::string>();
|
||||
std::optional<bool> unaligned = reloc_el["unaligned"].template value<bool>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue