Fix lcf generation for missing .sbss2
This commit is contained in:
parent
bd0422e92a
commit
26a3021f45
|
@ -11,8 +11,8 @@ SECTIONS
|
|||
.stack ALIGN(0x100):{}
|
||||
} > text
|
||||
|
||||
_stack_addr = (_f_sbss2 + SIZEOF(.sbss2) + $STACKSIZE + 0x7) & ~0x7;
|
||||
_stack_end = _f_sbss2 + SIZEOF(.sbss2);
|
||||
_stack_end = $LAST_SECTION_SYMBOL + SIZEOF($LAST_SECTION_NAME);
|
||||
_stack_addr = (_stack_end + $STACKSIZE + 0x7) & ~0x7;
|
||||
_db_stack_addr = (_stack_addr + 0x2000);
|
||||
_db_stack_end = _stack_addr;
|
||||
__ArenaLo = (_db_stack_addr + 0x1f) & ~0x1f;
|
||||
|
|
|
@ -23,8 +23,14 @@ pub fn generate_ldscript(obj: &ObjInfo) -> Result<String> {
|
|||
force_files.push(obj_path.file_name().unwrap().to_str().unwrap().to_string());
|
||||
}
|
||||
|
||||
// Hack to handle missing .sbss2 section... what's the proper way?
|
||||
let last_section_name = obj.sections.last().unwrap().name.clone();
|
||||
let last_section_symbol = format!("_f_{}", last_section_name.trim_start_matches('.'));
|
||||
|
||||
let out = include_str!("../../assets/ldscript.lcf")
|
||||
.replacen("$SECTIONS", §ion_defs, 1)
|
||||
.replace("$LAST_SECTION_SYMBOL", &last_section_symbol)
|
||||
.replace("$LAST_SECTION_NAME", &last_section_name)
|
||||
.replacen("$STACKSIZE", &format!("{:#X}", stack_size), 1)
|
||||
.replacen("$FORCEFILES", &force_files.join("\n "), 1);
|
||||
Ok(out)
|
||||
|
|
Loading…
Reference in New Issue