Remove Overlayhader and support loading overlays

This commit is contained in:
2023-04-10 17:01:28 +02:00
parent 7a373a38ff
commit 1a0d175779
8 changed files with 47 additions and 65 deletions

View File

@@ -58,13 +58,23 @@ fn write_section(output: &mut Output, sections: &Vec<OverlaySection>, add_end_na
for section in sections {
writeln!(output, "\t\t.{} {{", section.name)?;
writeln!(output, "\t\t\t__{}_start = .;", section.name)?;
section.file_pattern.iter().try_for_each(|patr| writeln!(output, "\t\t\tKEEP({}(.header))", patr))?;
writeln!(output, "\t\t\t__{}_lbas = .;", section.name)?;
section.file_pattern.iter().try_for_each(|patr| writeln!(output, "\t\t\tKEEP({}(.header.lbas))", patr))?;
writeln!(output, "\t\t\t__{}_ctor = .;", section.name)?;
for section_type in [".text.startup._GLOBAL__*", ".ctors", ".text.*", ".rodata*", ".sdata*", ".data*", ".sbss*", ".bss*"] {
section.file_pattern.iter().try_for_each(|patr| writeln!(output, "\t\t\t{}({})", patr, section_type))?;
for (section_type, keep) in [(".text.startup._GLOBAL__*", false), (".ctors", false), (".text.*", false), (".rodata*", false), (".sdata*", false), (".data*", false), (".sbss*", false), (".bss*", false), (".keep.dummy", true)] {
section.file_pattern.iter().try_for_each(|patr| {
let section_entry = format!("{}({})", patr, section_type);
write!(output, "\t\t\t")?;
if keep {
writeln!(output, "KEEP({})", section_entry)
}
else {
writeln!(output, "{}", section_entry)
}
})?;
}
if add_end_name {