diff --git a/src/cmd/dol.rs b/src/cmd/dol.rs index d6c7c19..e48ac40 100644 --- a/src/cmd/dol.rs +++ b/src/cmd/dol.rs @@ -1654,6 +1654,9 @@ fn apply(args: ApplyArgs) -> Result<()> { if linked_scope != ObjSymbolScope::Unknown && !is_globalized && linked_scope != orig_sym.flags.scope() + // Don't overwrite unknown scope with global + && (linked_scope != ObjSymbolScope::Global + || orig_sym.flags.scope() != ObjSymbolScope::Unknown) { log::info!( "Changing scope of {} (type {:?}) from {:?} to {:?}", @@ -1683,6 +1686,7 @@ fn apply(args: ApplyArgs) -> Result<()> { // Add symbols from the linked object that aren't in the original for linked_sym in linked_obj.symbols.iter() { if matches!(linked_sym.kind, ObjSymbolKind::Section) + || is_auto_symbol(linked_sym) || is_linker_generated_object(&linked_sym.name) // skip ABS for now || linked_sym.section.is_none() diff --git a/src/util/config.rs b/src/util/config.rs index 630bb7e..b18e446 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -178,6 +178,8 @@ pub fn is_auto_symbol(symbol: &ObjSymbol) -> bool { symbol.name.starts_with("lbl_") || symbol.name.starts_with("fn_") || symbol.name.starts_with("jumptable_") + || symbol.name.starts_with("gap_") + || symbol.name.starts_with("pad_") } fn write_if_unchanged(path: P, cb: Cb, cached_file: Option) -> Result<()>