libc: fix build issues
This commit is contained in:
@@ -4,14 +4,14 @@ pub type __jmp_buf = [usize; 8];
|
||||
pub type __sigjmp_buf = [usize; 8];
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn sigsetjmp(buf: *mut __sigjmp_buf, savesigs: c_int) -> c_int {
|
||||
// TODO: I don't yet have signal masking
|
||||
core::arch::naked_asm!("jmp setjmp")
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn setjmp(buf: *mut __jmp_buf) -> c_int {
|
||||
// %rdi -- jmp_buf pointer
|
||||
core::arch::naked_asm!(
|
||||
@@ -37,13 +37,13 @@ unsafe extern "C" fn setjmp(buf: *mut __jmp_buf) -> c_int {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn _setjmp(buf: *mut __jmp_buf) -> c_int {
|
||||
core::arch::naked_asm!("jmp setjmp", options(att_syntax))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn longjmp(buf: *mut __jmp_buf, val: c_int) -> ! {
|
||||
// %rdi -- jmp_buf pointer
|
||||
// %rsi -- return value
|
||||
@@ -70,13 +70,13 @@ unsafe extern "C" fn longjmp(buf: *mut __jmp_buf, val: c_int) -> ! {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn siglongjmp(buf: *mut __sigjmp_buf, val: c_int) -> ! {
|
||||
core::arch::naked_asm!("jmp longjmp")
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn _longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int {
|
||||
core::arch::naked_asm!("jmp longjmp", options(att_syntax))
|
||||
}
|
||||
|
||||
@@ -89,8 +89,10 @@ impl FmtRadix {
|
||||
impl FmtSize {
|
||||
fn arg_int(&self, ap: &mut VaList) -> i64 {
|
||||
match self {
|
||||
Self::ShortShort => unsafe { ap.arg::<c_char>() as _ },
|
||||
Self::Short => unsafe { ap.arg::<c_short>() as _ },
|
||||
Self::ShortShort => unsafe { ap.arg::<c_int>() as _ },
|
||||
// Self::ShortShort => unsafe { ap.arg::<c_char>() as _ },
|
||||
Self::Short => unsafe { ap.arg::<c_int>() as _ },
|
||||
// Self::Short => unsafe { ap.arg::<c_short>() as _ },
|
||||
Self::Normal => unsafe { ap.arg::<c_int>() as _ },
|
||||
Self::Long => unsafe { ap.arg::<c_long>() as _ },
|
||||
Self::LongLong => unsafe { ap.arg::<c_longlong>() as _ },
|
||||
@@ -101,8 +103,10 @@ impl FmtSize {
|
||||
|
||||
fn arg_uint(&self, ap: &mut VaList) -> u64 {
|
||||
match self {
|
||||
Self::ShortShort => unsafe { ap.arg::<c_uchar>() as _ },
|
||||
Self::Short => unsafe { ap.arg::<c_ushort>() as _ },
|
||||
Self::ShortShort => unsafe { ap.arg::<c_uint>() as _ },
|
||||
// Self::ShortShort => unsafe { ap.arg::<c_uchar>() as _ },
|
||||
Self::Short => unsafe { ap.arg::<c_uint>() as _ },
|
||||
// Self::Short => unsafe { ap.arg::<c_ushort>() as _ },
|
||||
Self::Normal => unsafe { ap.arg::<c_uint>() as _ },
|
||||
Self::Long => unsafe { ap.arg::<c_ulong>() as _ },
|
||||
Self::LongLong => unsafe { ap.arg::<c_ulonglong>() as _ },
|
||||
@@ -238,7 +242,8 @@ impl FmtOpts {
|
||||
}
|
||||
}
|
||||
FmtSpec::Char if self.size == FmtSize::Normal => {
|
||||
let ch = unsafe { ap.arg::<c_char>() } as u8;
|
||||
// let ch = unsafe { ap.arg::<c_char>() } as u8;
|
||||
let ch = unsafe { ap.arg::<c_int>() } as u8;
|
||||
buffer[0] = ch;
|
||||
1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user