diff --git a/arch/loongarch64/bits/alltypes.h.in b/arch/loongarch64/bits/alltypes.h.in index 06db4096..d1807aca 100644 --- a/arch/loongarch64/bits/alltypes.h.in +++ b/arch/loongarch64/bits/alltypes.h.in @@ -1,15 +1,15 @@ -#define _Addr long +#define _Addr long #define _Int64 long -#define _Reg long +#define _Reg long -#define __BYTE_ORDER 1234 -#define __LONG_MAX 0x7fffffffffffffffL +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffffffffffL #ifndef __cplusplus TYPEDEF int wchar_t; #endif -TYPEDEF float float_t; +TYPEDEF float float_t; TYPEDEF double double_t; TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/arch/loongarch64/bits/fenv.h b/arch/loongarch64/bits/fenv.h index 99e916e1..264cafb5 100644 --- a/arch/loongarch64/bits/fenv.h +++ b/arch/loongarch64/bits/fenv.h @@ -14,7 +14,7 @@ typedef unsigned fexcept_t; typedef struct { - unsigned int __cw; + unsigned __cw; } fenv_t; #define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/arch/loongarch64/bits/float.h b/arch/loongarch64/bits/float.h index 63e86d44..719c7908 100644 --- a/arch/loongarch64/bits/float.h +++ b/arch/loongarch64/bits/float.h @@ -1,16 +1,16 @@ #define FLT_EVAL_METHOD 0 -#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L -#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L -#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L -#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L -#define LDBL_MANT_DIG 113 -#define LDBL_MIN_EXP (-16381) -#define LDBL_MAX_EXP 16384 +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 -#define LDBL_DIG 33 +#define LDBL_DIG 33 #define LDBL_MIN_10_EXP (-4931) #define LDBL_MAX_10_EXP 4932 -#define DECIMAL_DIG 36 +#define DECIMAL_DIG 36 diff --git a/arch/loongarch64/bits/posix.h b/arch/loongarch64/bits/posix.h index c37b94c1..8068ce98 100644 --- a/arch/loongarch64/bits/posix.h +++ b/arch/loongarch64/bits/posix.h @@ -1,2 +1,2 @@ -#define _POSIX_V6_LP64_OFF64 1 -#define _POSIX_V7_LP64_OFF64 1 +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1 diff --git a/arch/loongarch64/bits/setjmp.h b/arch/loongarch64/bits/setjmp.h index 4bfa374d..3b15e87b 100644 --- a/arch/loongarch64/bits/setjmp.h +++ b/arch/loongarch64/bits/setjmp.h @@ -1 +1 @@ -typedef unsigned long __jmp_buf[23]; +typedef unsigned long __jmp_buf[23]; diff --git a/arch/loongarch64/bits/signal.h b/arch/loongarch64/bits/signal.h index e1d256e7..8e0e605c 100644 --- a/arch/loongarch64/bits/signal.h +++ b/arch/loongarch64/bits/signal.h @@ -3,7 +3,7 @@ #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MINSIGSTKSZ 4096 -#define SIGSTKSZ 16384 +#define SIGSTKSZ 16384 #endif #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) @@ -12,81 +12,79 @@ typedef unsigned long greg_t, gregset_t[32]; struct sigcontext { unsigned long sc_pc; unsigned long sc_regs[32]; - unsigned int sc_flags; + unsigned sc_flags; unsigned long sc_extcontext[] __attribute__((__aligned__(16))); }; +#endif typedef struct { unsigned long __pc; unsigned long __gregs[32]; - unsigned int __flags; + unsigned __flags; unsigned long __extcontext[] __attribute__((__aligned__(16))); } mcontext_t; -#else -typedef struct { - unsigned long __space[34]; -} mcontext_t; -#endif struct sigaltstack { - void *ss_sp; - int ss_flags; + void *ss_sp; + int ss_flags; size_t ss_size; }; typedef struct __ucontext { - unsigned long __uc_flags; - struct __ucontext *uc_link; - stack_t uc_stack; - sigset_t uc_sigmask; - long __uc_pad; - mcontext_t uc_mcontext; + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + long __uc_pad; + mcontext_t uc_mcontext; } ucontext_t; -#define SA_NOCLDSTOP 1 -#define SA_NOCLDWAIT 2 -#define SA_SIGINFO 4 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 -#define SA_RESTORER 0x0 +#define __uc_flags uc_flags + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 #endif -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT SIGABRT -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED SIGSYS -#define _NSIG 65 +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/arch/loongarch64/bits/stdint.h b/arch/loongarch64/bits/stdint.h index 60c12499..1bb147f2 100644 --- a/arch/loongarch64/bits/stdint.h +++ b/arch/loongarch64/bits/stdint.h @@ -1,5 +1,5 @@ -typedef int32_t int_fast16_t; -typedef int32_t int_fast32_t; +typedef int32_t int_fast16_t; +typedef int32_t int_fast32_t; typedef uint32_t uint_fast16_t; typedef uint32_t uint_fast32_t; diff --git a/arch/loongarch64/pthread_arch.h b/arch/loongarch64/pthread_arch.h index 28fbfcd1..365f6ca8 100644 --- a/arch/loongarch64/pthread_arch.h +++ b/arch/loongarch64/pthread_arch.h @@ -1,7 +1,7 @@ static inline uintptr_t __get_tp() { - uintptr_t tp; - __asm__ __volatile__("move %0, $tp" : "=r"(tp)); + register uintptr_t tp __asm__("tp"); + __asm__ ("" : "=r" (tp) ); return tp; } diff --git a/arch/loongarch64/reloc.h b/arch/loongarch64/reloc.h index a4482b48..61eaca9e 100644 --- a/arch/loongarch64/reloc.h +++ b/arch/loongarch64/reloc.h @@ -1,10 +1,12 @@ #ifdef __loongarch_soft_float #define FP_SUFFIX "-sf" +#elif defined __loongarch_single_float +#define FP_SUFFIX "-sp" #else #define FP_SUFFIX "" #endif -#define LDSO_ARCH "loongarch64" FP_SUFFIX +#define LDSO_ARCH "loongarch64" FP_SUFFIX #define TPOFF_K 0 diff --git a/configure b/configure index 55d179f1..940b3eaf 100755 --- a/configure +++ b/configure @@ -674,7 +674,8 @@ fi if test "$ARCH" = "loongarch64" ; then trycppif __loongarch_soft_float "$t" && SUBARCH=${SUBARCH}-sf -printf "checking whether compiler support FCSRs... " +trycppif __loongarch_single_float "$t" && SUBARCH=${SUBARCH}-sp +printf "checking whether assembler support FCSRs... " echo "__asm__(\"movfcsr2gr \$t0,\$fcsr0\");" > "$tmpc" if $CC -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then printf "yes\n"