diff options
author | caiyinyu <caiyinyu@loongson.cn> | 2022-08-22 16:00:51 +0800 |
---|---|---|
committer | caiyinyu <caiyinyu@loongson.cn> | 2022-09-01 09:10:08 +0800 |
commit | 930993921f2f381b545ea1b1f2d9c534b2b72b08 (patch) | |
tree | 1015c0f98c4232af277f7dc56286c5dbc1b652b6 /sysdeps/unix | |
parent | 1e903124cec4492463d075c6c061a2a772db77bf (diff) | |
download | glibc-930993921f2f381b545ea1b1f2d9c534b2b72b08.zip glibc-930993921f2f381b545ea1b1f2d9c534b2b72b08.tar.gz glibc-930993921f2f381b545ea1b1f2d9c534b2b72b08.tar.bz2 |
LoongArch: Add soft float support.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/loongarch/Makefile | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/loongarch/configure | 51 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/loongarch/configure.ac | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/loongarch/shlib-versions | 2 |
5 files changed, 79 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/loongarch/Makefile b/sysdeps/unix/sysv/linux/loongarch/Makefile index 91bd358..c84a176 100644 --- a/sysdeps/unix/sysv/linux/loongarch/Makefile +++ b/sysdeps/unix/sysv/linux/loongarch/Makefile @@ -1,3 +1,12 @@ ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif + +abi-variants := lp64s lp64d + +ifeq (,$(filter $(default-abi),$(abi-variants))) +$(error Unknown ABI $(default-abi), must be one of $(abi-variants)) +endif + +abi-lp64s-condition := __WORDSIZE == 64 && defined __loongarch_soft_float +abi-lp64d-condition := __WORDSIZE == 64 && defined __loongarch_double_float diff --git a/sysdeps/unix/sysv/linux/loongarch/configure b/sysdeps/unix/sysv/linux/loongarch/configure index 60a4103..28216c1 100644 --- a/sysdeps/unix/sysv/linux/loongarch/configure +++ b/sysdeps/unix/sysv/linux/loongarch/configure @@ -151,11 +151,56 @@ if test $libc_cv_loongarch_int_abi = no; then as_fn_error $? "Unable to determine integer ABI" "$LINENO" 5 fi +libc_cv_loongarch_float_abi=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __loongarch_double_float + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + libc_cv_loongarch_float_abi=d +fi +rm -f conftest* + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __loongarch_soft_float + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + libc_cv_loongarch_float_abi=s +fi +rm -f conftest* + +if test "$libc_cv_loongarch_float_abi" = no; then + as_fn_error $? "Unable to determine floating-point ABI" "$LINENO" 5 +fi + config_vars="$config_vars -default-abi = $libc_cv_loongarch_int_abi" +default-abi = $libc_cv_loongarch_int_abi$libc_cv_loongarch_float_abi" -case $libc_cv_loongarch_int_abi in -lp64) +case $libc_cv_loongarch_int_abi$libc_cv_loongarch_float_abi in +lp64s) + test -n "$libc_cv_slibdir" || +case "$prefix" in +/usr | /usr/) + libc_cv_slibdir='/lib64/sf' + libc_cv_rtlddir='/lib64' + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64/sf'; + # Locale data can be shared between 32-bit and 64-bit libraries. + libc_cv_complocaledir='${exec_prefix}/lib/locale' + fi + ;; +esac + ;; +lp64d) test -n "$libc_cv_slibdir" || case "$prefix" in /usr | /usr/) diff --git a/sysdeps/unix/sysv/linux/loongarch/configure.ac b/sysdeps/unix/sysv/linux/loongarch/configure.ac index 7de1e95..04e9150 100644 --- a/sysdeps/unix/sysv/linux/loongarch/configure.ac +++ b/sysdeps/unix/sysv/linux/loongarch/configure.ac @@ -11,10 +11,26 @@ if test $libc_cv_loongarch_int_abi = no; then AC_MSG_ERROR([Unable to determine integer ABI]) fi -LIBC_CONFIG_VAR([default-abi], [$libc_cv_loongarch_int_abi]) +libc_cv_loongarch_float_abi=no +AC_EGREP_CPP(yes, [#ifdef __loongarch_double_float + yes + #endif + ],libc_cv_loongarch_float_abi=d) +AC_EGREP_CPP(yes, [#ifdef __loongarch_soft_float + yes + #endif + ],libc_cv_loongarch_float_abi=s) +if test "$libc_cv_loongarch_float_abi" = no; then + AC_MSG_ERROR([Unable to determine floating-point ABI]) +fi + +LIBC_CONFIG_VAR([default-abi], [$libc_cv_loongarch_int_abi$libc_cv_loongarch_float_abi]) -case $libc_cv_loongarch_int_abi in -lp64) +case $libc_cv_loongarch_int_abi$libc_cv_loongarch_float_abi in +lp64s) + LIBC_SLIBDIR_RTLDDIR([lib64/sf], [lib64]) + ;; +lp64d) LIBC_SLIBDIR_RTLDDIR([lib64], [lib64]) ;; esac diff --git a/sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed index f8976fd..cdbe5c3 100644 --- a/sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed @@ -1 +1 @@ -s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|32\)\(/[^/]*\)\(-loongarch\)\(64\|32\)\(\.so\.[0-9.]*\)[[:blank:]]*$_\1"\2\4\7 \264\4-loongarch64\7 \232\4-loongarch32\7"_ +s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|32\)\(/ld-linux-loongarch-\)\(lp\|ilp\)\(64\|32\)\(d\|s\)\(\.so\.[0-9.]*\)[[:blank:]]*$_\1"\264\4lp64d\8 \264\4lp64s\8"_ diff --git a/sysdeps/unix/sysv/linux/loongarch/shlib-versions b/sysdeps/unix/sysv/linux/loongarch/shlib-versions index dc2220b..5f40e7f 100644 --- a/sysdeps/unix/sysv/linux/loongarch/shlib-versions +++ b/sysdeps/unix/sysv/linux/loongarch/shlib-versions @@ -2,6 +2,8 @@ DEFAULT GLIBC_2.36 %if LOONGARCH_ABI_GRLEN == 64 && LOONGARCH_ABI_FRLEN == 64 ld=ld-linux-loongarch-lp64d.so.1 +%elif LOONGARCH_ABI_GRLEN == 64 && LOONGARCH_ABI_FRLEN == 0 +ld=ld-linux-loongarch-lp64s.so.1 %else %error cannot determine ABI %endif |