From 93000b28bdd991d641ac00f8cd4f32d242401531 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 27 Jan 2025 17:07:30 -0700 Subject: [PATCH] Check for conflicting splits with different file extensions Resolves #81 --- src/cmd/dol.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cmd/dol.rs b/src/cmd/dol.rs index f21e2bb..62a656c 100644 --- a/src/cmd/dol.rs +++ b/src/cmd/dol.rs @@ -971,9 +971,19 @@ fn split_write_obj( entry, extract: Vec::with_capacity(module.config.extract.len()), }; + let mut object_paths = BTreeMap::new(); for (unit, split_obj) in module.obj.link_order.iter().zip(&split_objs) { let out_obj = write_elf(split_obj, config.export_all)?; - let out_path = obj_dir.join(obj_path_for_unit(&unit.name)); + let obj_path = obj_path_for_unit(&unit.name); + let out_path = obj_dir.join(&obj_path); + if let Some(existing) = object_paths.insert(obj_path, unit) { + bail!( + "Duplicate object path: {} and {} both resolve to {}", + existing.name, + unit.name, + out_path, + ); + } out_config.units.push(OutputUnit { object: out_path.with_unix_encoding(), name: unit.name.clone(),