Compare commits

..
1 Commits
Author SHA1 Message Date
Sweetbread 4b5642cc4e fix: Add strlen func 2024-06-10 13:10:05 +03:00
2 changed files with 10 additions and 4 deletions

No files matched your search

+1 -4
View File
@@ -30,10 +30,7 @@ SECTIONS {
*(data)
}
.bss ALIGN(16) : {
*(.bss)
*(.bss.*)
}
.bss ALIGN(16) : {*(.bss)}
FILE_END = .;
}
+9
View File
@@ -31,3 +31,12 @@ 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;
}
}