mirror of
https://github.com/encounter/decomp-toolkit.git
synced 2025-12-12 14:46:17 +00:00
@@ -629,17 +629,17 @@ fn update_symbols(
|
|||||||
.filter(|(_, r)| r.module_id == obj.module_id)
|
.filter(|(_, r)| r.module_id == obj.module_id)
|
||||||
{
|
{
|
||||||
if source_module_id == obj.module_id {
|
if source_module_id == obj.module_id {
|
||||||
// Skip if already resolved
|
let Some((_, source_section)) =
|
||||||
let (_, source_section) =
|
obj.sections.get_elf_index(rel_reloc.section as SectionIndex)
|
||||||
obj.sections.get_elf_index(rel_reloc.section as SectionIndex).ok_or_else(|| {
|
else {
|
||||||
anyhow!(
|
log::warn!(
|
||||||
"Failed to locate REL section {} in module ID {}: source module {}, {:?}",
|
"Missing relocation module {}, section {}; skipping",
|
||||||
rel_reloc.section,
|
obj.module_id,
|
||||||
obj.module_id,
|
rel_reloc.section
|
||||||
source_module_id,
|
);
|
||||||
rel_reloc
|
continue;
|
||||||
)
|
};
|
||||||
})?;
|
|
||||||
if source_section.relocations.contains(rel_reloc.address) {
|
if source_section.relocations.contains(rel_reloc.address) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -710,15 +710,16 @@ fn create_relocations(
|
|||||||
// Resolve all relocations in this module
|
// Resolve all relocations in this module
|
||||||
for rel_reloc in take(&mut obj.unresolved_relocations) {
|
for rel_reloc in take(&mut obj.unresolved_relocations) {
|
||||||
// Skip if already resolved
|
// Skip if already resolved
|
||||||
let (_, source_section) =
|
let Some((_, source_section)) =
|
||||||
obj.sections.get_elf_index(rel_reloc.section as SectionIndex).ok_or_else(|| {
|
obj.sections.get_elf_index(rel_reloc.section as SectionIndex)
|
||||||
anyhow!(
|
else {
|
||||||
"Failed to locate REL section {} in module ID {}: {:?}",
|
log::warn!(
|
||||||
rel_reloc.section,
|
"Missing relocation module {}, section {}; skipping",
|
||||||
obj.module_id,
|
obj.module_id,
|
||||||
rel_reloc
|
rel_reloc.section
|
||||||
)
|
);
|
||||||
})?;
|
continue;
|
||||||
|
};
|
||||||
if source_section.relocations.contains(rel_reloc.address) {
|
if source_section.relocations.contains(rel_reloc.address) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -775,8 +776,16 @@ fn create_relocations(
|
|||||||
Some(rel_reloc.module_id)
|
Some(rel_reloc.module_id)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let (_, source_section) =
|
let Some((_, source_section)) =
|
||||||
obj.sections.get_elf_index_mut(rel_reloc.section as SectionIndex).unwrap();
|
obj.sections.get_elf_index_mut(rel_reloc.section as SectionIndex)
|
||||||
|
else {
|
||||||
|
log::warn!(
|
||||||
|
"Missing relocation module {}, section {}; skipping",
|
||||||
|
obj.module_id,
|
||||||
|
rel_reloc.section
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
};
|
||||||
source_section.relocations.insert(rel_reloc.address, reloc)?;
|
source_section.relocations.insert(rel_reloc.address, reloc)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user