From 41a69441dab6d5d22d1089abfe89c696fa0a1db6 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 10 Oct 2023 12:32:56 -0400 Subject: [PATCH] Support section 241 (extabindex) in RSOs --- src/cmd/dol.rs | 9 ++++++--- src/util/rso.rs | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cmd/dol.rs b/src/cmd/dol.rs index e66ed57..dd46542 100644 --- a/src/cmd/dol.rs +++ b/src/cmd/dol.rs @@ -48,7 +48,7 @@ use crate::{ lcf::{asm_path_for_unit, generate_ldscript, obj_path_for_unit}, map::apply_map_file, 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}, 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 { (None, symbol.address as u32, None) } 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(|| { anyhow!("Can't add symbol for unknown DOL section {}", dol_section_index) - })?; + })? + }; let (dol_section_index, dol_section) = obj .sections .iter() diff --git a/src/util/rso.rs b/src/util/rso.rs index 5956bc5..5fcaf30 100644 --- a/src/util/rso.rs +++ b/src/util/rso.rs @@ -29,6 +29,8 @@ pub const DOL_SECTION_NAMES: [Option<&str>; 14] = [ Some(".sbss2"), None, // s_zero2 ]; +/// extabindex section index. +pub const DOL_SECTION_ETI: u32 = 241; /// ABS symbol section index. pub const DOL_SECTION_ABS: u32 = 65521;