1 Commits

Author SHA1 Message Date
24c38957f4 Add *(.bss.*) to link.x; fixes #8
Const var, which is used for allocator, is .bss.alloc..., and because
there was no that pattern in link scrypt, FILE_END didn't count the var,
that's why initial zero value was overwritten by application name (see
MENUET01 header description for more info)
2024-05-26 02:19:11 +03:00
2 changed files with 4 additions and 10 deletions

5
link.x
View File

@@ -30,7 +30,10 @@ SECTIONS {
*(data)
}
.bss ALIGN(16) : {*(.bss)}
.bss ALIGN(16) : {
*(.bss)
*(.bss.*)
}
FILE_END = .;
}

View File

@@ -31,12 +31,3 @@ pub unsafe extern "C" fn memcmp(s1: *mut u8, s2: *const u8, n: usize) -> i32 {
0
}
#[no_mangle]
pub unsafe extern "C" fn strlen(str: *mut u8) -> usize {
let mut len = 0usize;
loop {
if *str.add(len) == 0 { return len; }
len += 1;
}
}