Support section 241 (extabindex) in RSOs

This commit is contained in:
Luke Street 2023-10-10 12:32:56 -04:00
parent 95c779b105
commit 41a69441da
2 changed files with 8 additions and 3 deletions

View File

@ -48,7 +48,7 @@ use crate::{
lcf::{asm_path_for_unit, generate_ldscript, obj_path_for_unit}, lcf::{asm_path_for_unit, generate_ldscript, obj_path_for_unit},
map::apply_map_file, map::apply_map_file,
rel::{process_rel, process_rel_header, update_rel_section_alignment}, rel::{process_rel, process_rel_header, update_rel_section_alignment},
rso::{process_rso, DOL_SECTION_ABS, DOL_SECTION_NAMES}, rso::{process_rso, DOL_SECTION_ABS, DOL_SECTION_ETI, DOL_SECTION_NAMES},
split::{is_linker_generated_object, split_obj, update_splits}, split::{is_linker_generated_object, split_obj, update_splits},
IntoCow, ToCow, IntoCow, ToCow,
}, },
@ -320,10 +320,13 @@ fn apply_selfile(obj: &mut ObjInfo, buf: &[u8]) -> Result<()> {
let (section, address, section_kind) = if dol_section_index == DOL_SECTION_ABS as usize { let (section, address, section_kind) = if dol_section_index == DOL_SECTION_ABS as usize {
(None, symbol.address as u32, None) (None, symbol.address as u32, None)
} else { } else {
let dol_section_name = let dol_section_name = if dol_section_index == DOL_SECTION_ETI as usize {
"extabindex"
} else {
DOL_SECTION_NAMES.get(dol_section_index).and_then(|&opt| opt).ok_or_else(|| { DOL_SECTION_NAMES.get(dol_section_index).and_then(|&opt| opt).ok_or_else(|| {
anyhow!("Can't add symbol for unknown DOL section {}", dol_section_index) anyhow!("Can't add symbol for unknown DOL section {}", dol_section_index)
})?; })?
};
let (dol_section_index, dol_section) = obj let (dol_section_index, dol_section) = obj
.sections .sections
.iter() .iter()

View File

@ -29,6 +29,8 @@ pub const DOL_SECTION_NAMES: [Option<&str>; 14] = [
Some(".sbss2"), Some(".sbss2"),
None, // s_zero2 None, // s_zero2
]; ];
/// extabindex section index.
pub const DOL_SECTION_ETI: u32 = 241;
/// ABS symbol section index. /// ABS symbol section index.
pub const DOL_SECTION_ABS: u32 = 65521; pub const DOL_SECTION_ABS: u32 = 65521;