mbox series

[v2,00/14] GLIBC LoongArch PATCHES

Message ID 20211231064455.1030051-1-caiyinyu@loongson.cn
Headers show
Series GLIBC LoongArch PATCHES | expand

Message

caiyinyu Dec. 31, 2021, 6:44 a.m. UTC
Hello, the answers are as follows, and we really need your futher suggestions:

LoongArch patches v1: https://sourceware.org/pipermail/libc-alpha/2021-August/130262.html

1. Is there ABI documentation for the function-calling ABI?  The ELF ABI
document you link to says essentially nothing about that.

LoongArch-Doc:  https://github.com/loongson/LoongArch-Documentation

We add new section: procedure calling convention.
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_procedure_calling_convention

2. Please provide details of the test results for the port with the glibc
testsuite and the binutils / GCC / Linux kernel ports as submitted
upstream (the exact versions of those components proposed for upstream,
not some other version).  You might need to work around some of the issues
currently present building glibc with GCC mainline; if so, please state
the exact patches you are using for that workaround on top of the proposed
port version (you might need to use
<https://sourceware.org/pipermail/libc-alpha/2021-August/130244.html>, for
example).  It's required that the compilation parts of the testsuite must
have fully clean results.  For any test failures in the rest of the
testsuite, make the .out and .test-result files available, along with any
analysis you have done of why those tests are failing.

Source code:
linux:		https://github.com/loongson/linux/tree/loongarch-next
binutils:     	https://github.com/loongson/binutils-gdb/tree/upstream_v3.1
glibc:	      	https://github.com/loongson/glibc/tree/loongarch_2_34_for_upstream_v2.0
gcc:	      	https://github.com/loongson/gcc/tree/loongarch_upstream_v4

test result:

a.
XPASS: conform/UNIX98/ndbm.h/linknamespace
XPASS: conform/XOPEN2K/ndbm.h/linknamespace
XPASS: conform/XOPEN2K8/ndbm.h/linknamespace
XPASS: conform/XPG42/ndbm.h/linknamespace
UNSUPPORTED: crypt/cert
FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1staticpic
FAIL: elf/ifuncmain1staticpie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain3
FAIL: elf/ifuncmain4
FAIL: elf/ifuncmain6pie
FAIL: elf/ifuncmain7
FAIL: elf/ifuncmain7pic
FAIL: elf/ifuncmain7pie
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
FAIL: elf/tst-ifunc-fault-bindnow
FAIL: elf/tst-ifunc-fault-lazy
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: math/test-double-acos
FAIL: math/test-double-asin
FAIL: math/test-float32x-acos
FAIL: math/test-float32x-asin
FAIL: math/test-float64-acos
FAIL: math/test-float64-asin
UNSUPPORTED: misc/tst-adjtimex
UNSUPPORTED: misc/tst-clock_adjtime
UNSUPPORTED: misc/tst-ntp_adjtime
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: misc/tst-rseq
UNSUPPORTED: misc/tst-rseq-disable
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
UNSUPPORTED: nptl/tst-rseq-nptl
UNSUPPORTED: stdlib/tst-secure-getenv
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
Summary of test results:
     22 FAIL
   4488 PASS
     19 UNSUPPORTED
     12 XFAIL
      6 XPASS

b.
FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1staticpic
FAIL: elf/ifuncmain1staticpie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain3
FAIL: elf/ifuncmain4
FAIL: elf/ifuncmain6pie
FAIL: elf/ifuncmain7
FAIL: elf/ifuncmain7pic
FAIL: elf/ifuncmain7pie
FAIL: elf/tst-ifunc-fault-bindnow
FAIL: elf/tst-ifunc-fault-lazy

ifunc functions are not support yet

c.
FAIL: math/test-double-acos
FAIL: math/test-double-asin
FAIL: math/test-float32x-acos
FAIL: math/test-float32x-asin
FAIL: math/test-float64-acos
FAIL: math/test-float64-asin

These fails are caused by gcc optimizations. if we use -O0 options, these fails
will pass.

sysdeps/ieee754/dbl-64/e_asin.c: 343
===================================================================
337	  if (k>0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0)) return x + x;
   0x00007ffff7f4daac <+1388>:	lu12i.w     	$t0, 524032(0x7ff00)
   0x00007ffff7f4dab0 <+1392>:	blt         	$t0, $t2, 20(0x14)	# 0x7ffff7f4dac4 <__ieee754_acos+1412>
   0x00007ffff7f4dab4 <+1396>:	bne         	$t2, $t0, 36(0x24)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
   0x00007ffff7f4dab8 <+1400>:	ld.d        	$t0, $sp, 8(0x8)
   0x00007ffff7f4dabc <+1404>:	slli.w      	$t0, $t0, 0x0
   0x00007ffff7f4dac0 <+1408>:	beqz        	$t0, 24(0x18)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
   0x00007ffff7f4dac4 <+1412>:	fld.d       	$fa0, $sp, 8(0x8)
   0x00007ffff7f4dac8 <+1416>:	fadd.d      	$fa0, $fa0, $fa0
   0x00007ffff7f4dacc <+1420>:	b           	-788(0xffffcec)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>

338	  else {
339	    u.i[HIGH_HALF]=0x7ff00000;
340	    v.i[HIGH_HALF]=0x7ff00000;
341	    u.i[LOW_HALF]=0;
342	    v.i[LOW_HALF]=0;
343	    return u.x/v.x;			/////////  optimized out

   0x00007ffff7f4dad8 <+1432>:	pcaddu12i   	$t0, 63(0x3f)
   0x00007ffff7f4dadc <+1436>:	addi.d      	$t0, $t0, -1248(0xb20)
   0x00007ffff7f4dae0 <+1440>:	fld.d       	$fa0, $t0, 0
   0x00007ffff7f4dae4 <+1444>:	b           	-812(0xffffcd4)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>

344	  }
345	}
   0x00007ffff7f4d7b8 <+632>:	addi.d      	$sp, $sp, 16(0x10)
   0x00007ffff7f4d7bc <+636>:	jirl        	$zero, $ra, 0
   0x00007ffff7f4d7cc <+652>:	addi.d      	$sp, $sp, 16(0x10)
   0x00007ffff7f4d7d0 <+656>:	jirl        	$zero, $ra, 0
   0x00007ffff7f4d8bc <+892>:	addi.d      	$sp, $sp, 16(0x10)
   0x00007ffff7f4d8c0 <+896>:	jirl        	$zero, $ra, 0
===================================================================


3. I see there's an upstream submission (not yet committed upstream) of
QEMU support for LoongArch, could you describe the status of that?  (See
"There is no requirement for a CPU simulator (free software, e.g. QEMU, or
otherwise) to be available, but if one is available, it is useful to
mention in the summary message (along with any information on available OS
etc. that might help people set up an environment for testing things about
the port)." on the NewPorts page.)

We are donating machine to the GCC Compile Farm Project

4. What ABIs are supported for the port?  You mention 32-bit doesn't work
(so it would be best to remove that code until it's ready), so only 64-bit
ABIs are supported.  Is a soft-float ABI supported, or only hard-float?
You have __loongarch_soft_float or __loongarch_hard_float conditionals in
some places, but other things suggest only hard float is supported (the
lack of any with_fp_cond definition in your preconfigure fragment, in
particular).  Apart from conventional 32-bit and 64-bit ABIs, there's the
question of whether you have or intend to have an ILP32 ABI that uses
64-bit registers and the 64-bit instruction set (like x32 for x86_64);
there's no need to have such an ABI, but if you do plan to have one, you
need to be very careful about what you mean when you say "32-bit" or
"64-bit", to make it clear whether such an ILP32 ABI is included or not.
add loongarch 5. There needs to be at least one entry added to build-many-glibcs.py for
each ABI supported by the port.

Now we only support 64-bit hard-float ABI.

6. You're making local changes to config.sub and config.guess.  Don't do
that; the latest versions from config.git should be imported instead, with
no local changes, outside of the patch series adding the port.

corrected

7. This patch series is missing NEWS and README updates.

corrected

8. We don't use "Contributed by" any more in new source files.  You can
put such information in the NEWS entry for the addition of the port, and
in contrib.texi (the latter listing relevant individuals, not companies),
instead.

corrected

9. Note that new source files should have a one-line description above the
copyright notice.

corrected

10. Note the need for a manual/math.texi update in the list of
configurations supporting _Float128.

not support yet

11. Florian has already noted that GLIBC_2.35 should be the minimum ABI
version for the port.  This has other implications beyond the DEFAULT
setting in shlib-versions.  You're adding some entries to
sysdeps/unix/sysv/linux/loongarch/Versions with old symbol versions; those
should not be present (some of the GLIBC_2.0 entries are for libgcc
functions only relevant for extremely old glibc ports).  If you need any
Versions entries at all, they should be either GLIBC_PRIVATE or
GLIBC_2.35, and you should be able to give an explicit justification for
why such an entry is needed (i.e. the function would not be exported at
all without the entry, and either is part of the architecture-independent
glibc API, or is needed as an architecture-specific function or a
GLIBC_PRIVATE function).

corrected

12. For each ABI supported by the port (see point 4 above) you need a
unique dynamic linker name (not used by any existing ABI listed at
<https://sourceware.org/glibc/wiki/ABIList>; probably mentioning the
architecture name somewhere in the dynamic linker name), as specified with
ld= in shlib-versions.  You have an ldd_rewrite_script setting that only
makes sense with such names (and only makes sense when multiple ABIs are
supported in the same root filesystem, see
<https://sourceware.org/legacy-ml/libc-alpas specified with
ld= in shlib-versionsha/2018-01/msg00008.html> for
more details of what's needed for such support), but I don't see anything
to actually implement such names.  Note the need for the dynamic linker
names to be consistent in GCC and glibc.

corrected

13. arch_minimum_kernel should be set to 10.0.0 until the actual upstream
kernel version that gets the port is known, and then to the actual
upstream version (so 5.14.0 or later).  Accordingly, kernel-features.h
should not have any "before 4.20" conditionals in it (so you don't need an
architecture-specific kernel-features.h at all).

corrected

14. Regarding the optimized functions in patches 12 to 14, see the last
point on the NewPorts page regarding considering carefully (possibly with
benchmarking) whether such functions are actually beneficial compared to
the current generic C versions - and, if beneficial compared to the
current generic C versions, whether helping to get the improved generic
functions linked from that page into glibc would avoid the need for some
or all of the architecture-specific implementations.

optimized function string/memset/memcpy/memmove/sinf/cosf removed


Source code:
LoongArch-Doc:	https://github.com/loongson/LoongArch-Documentation
linux:		https://github.com/loongson/linux/tree/loongarch-next
binutils:     	https://github.com/loongson/binutils-gdb/tree/upstream_v3.1
glibc:	      	https://github.com/loongson/glibc/tree/loongarch_2_34_for_upstream_v2.0
gcc:	      	https://github.com/loongson/gcc/tree/loongarch_upstream_v4


caiyinyu (14):
  LoongArch: Update NEWS and README for the LoongArch port.
  LoongArch: Add LoongArch entries to config.h.in
  LoongArch: Add relocations and ELF flags to elf.h
  LoongArch: ABI Implementation
  LoongArch: Thread-Local Storage Support
  LoongArch: Generic <math.h> and soft-fp Routines
  LoongArch: Atomic and Locking Routines
  LoongArch: Linux Syscall Interface
  LoongArch: Linux ABI
  LoongArch: Linux Startup and Dynamic Loading Code
  LoongArch: Add ABI Lists
  LoongArch: Build Infastructure
  LoongArch: Hard Float Support
  LoongArch: Update build-many-glibcs.py for the LoongArch Port.

 NEWS                                          |    2 +
 README                                        |    1 +
 config.h.in                                   |    6 +
 elf/elf.h                                     |   72 +-
 scripts/build-many-glibcs.py                  |    5 +
 sysdeps/loongarch/Implies                     |    5 +
 sysdeps/loongarch/Makefile                    |   15 +
 sysdeps/loongarch/__longjmp.S                 |   52 +
 sysdeps/loongarch/abort-instr.h               |    2 +
 sysdeps/loongarch/bits/endianness.h           |   11 +
 sysdeps/loongarch/bits/fenv.h                 |   90 +
 sysdeps/loongarch/bits/link.h                 |   58 +
 sysdeps/loongarch/bits/setjmp.h               |   42 +
 sysdeps/loongarch/bits/wordsize.h             |   25 +
 sysdeps/loongarch/bsd-_setjmp.c               |    1 +
 sysdeps/loongarch/bsd-setjmp.c                |    1 +
 sysdeps/loongarch/configure                   |    4 +
 sysdeps/loongarch/configure.ac                |    6 +
 sysdeps/loongarch/dl-irel.h                   |   48 +
 sysdeps/loongarch/dl-machine.h                |  368 +++
 sysdeps/loongarch/dl-tls.h                    |   46 +
 sysdeps/loongarch/dl-trampoline.S             |  103 +
 sysdeps/loongarch/e_sqrtl.c                   |   38 +
 sysdeps/loongarch/fpu/e_sqrt.c                |   26 +
 sysdeps/loongarch/fpu/e_sqrtf.c               |   26 +
 sysdeps/loongarch/fpu/fclrexcpt.c             |   46 +
 sysdeps/loongarch/fpu/fedisblxcpt.c           |   39 +
 sysdeps/loongarch/fpu/feenablxcpt.c           |   39 +
 sysdeps/loongarch/fpu/fegetenv.c              |   31 +
 sysdeps/loongarch/fpu/fegetexcept.c           |   32 +
 sysdeps/loongarch/fpu/fegetmode.c             |   27 +
 sysdeps/loongarch/fpu/fegetround.c            |   33 +
 sysdeps/loongarch/fpu/feholdexcpt.c           |   40 +
 sysdeps/loongarch/fpu/fenv_libc.h             |   30 +
 sysdeps/loongarch/fpu/fesetenv.c              |   42 +
 sysdeps/loongarch/fpu/fesetexcept.c           |   32 +
 sysdeps/loongarch/fpu/fesetmode.c             |   38 +
 sysdeps/loongarch/fpu/fesetround.c            |   44 +
 sysdeps/loongarch/fpu/feupdateenv.c           |   43 +
 sysdeps/loongarch/fpu/fgetexcptflg.c          |   38 +
 sysdeps/loongarch/fpu/fraiseexcpt.c           |   75 +
 sysdeps/loongarch/fpu/fsetexcptflg.c          |   41 +
 sysdeps/loongarch/fpu/ftestexcept.c           |   32 +
 sysdeps/loongarch/fpu_control.h               |  102 +
 sysdeps/loongarch/gccframe.h                  |   21 +
 sysdeps/loongarch/hp-timing.h                 |   42 +
 sysdeps/loongarch/jmpbuf-offsets.h            |   22 +
 sysdeps/loongarch/jmpbuf-unwind.h             |   45 +
 sysdeps/loongarch/ldsodefs.h                  |   41 +
 sysdeps/loongarch/libc-start.h                |   25 +
 sysdeps/loongarch/libc-tls.c                  |   32 +
 sysdeps/loongarch/linkmap.h                   |    4 +
 sysdeps/loongarch/lp64/Implies-after          |    1 +
 sysdeps/loongarch/lp64/libm-test-ulps         | 1411 +++++++++++
 sysdeps/loongarch/lp64/libm-test-ulps-name    |    1 +
 sysdeps/loongarch/machine-gmon.h              |   37 +
 sysdeps/loongarch/math_private.h              |  248 ++
 sysdeps/loongarch/memusage.h                  |   25 +
 sysdeps/loongarch/nptl/Makefile               |   26 +
 .../loongarch/nptl/bits/pthreadtypes-arch.h   |   41 +
 sysdeps/loongarch/nptl/bits/semaphore.h       |   32 +
 sysdeps/loongarch/nptl/bits/struct_rwlock.h   |   44 +
 sysdeps/loongarch/nptl/libc-lowlevellock.c    |    8 +
 sysdeps/loongarch/nptl/nptl-sysdep.S          |    2 +
 sysdeps/loongarch/nptl/pthread-offsets.h      |   15 +
 sysdeps/loongarch/nptl/pthreaddef.h           |   32 +
 sysdeps/loongarch/nptl/tcb-offsets.sym        |    6 +
 sysdeps/loongarch/nptl/tls.h                  |  138 ++
 sysdeps/loongarch/preconfigure                |   47 +
 sysdeps/loongarch/setjmp.S                    |   66 +
 sysdeps/loongarch/sfp-machine.h               |  102 +
 sysdeps/loongarch/sotruss-lib.c               |   50 +
 sysdeps/loongarch/stackinfo.h                 |   33 +
 sysdeps/loongarch/start.S                     |   70 +
 sysdeps/loongarch/sys/asm.h                   |   58 +
 sysdeps/loongarch/sys/regdef.h                |   98 +
 sysdeps/loongarch/tininess.h                  |    1 +
 sysdeps/loongarch/tls-macros.h                |   49 +
 sysdeps/loongarch/tst-audit.h                 |   23 +
 sysdeps/unix/sysv/linux/loongarch/Implies     |    1 +
 sysdeps/unix/sysv/linux/loongarch/Makefile    |   11 +
 .../unix/sysv/linux/loongarch/arch-syscall.h  |  302 +++
 .../sysv/linux/loongarch/atomic-machine.h     |  196 ++
 .../unix/sysv/linux/loongarch/bits/fcntl.h    |   61 +
 sysdeps/unix/sysv/linux/loongarch/bits/mman.h |   42 +
 .../linux/loongarch/bits/pthread_stack_min.h  |   20 +
 .../sysv/linux/loongarch/bits/sigcontext.h    |   54 +
 .../unix/sysv/linux/loongarch/bits/signum.h   |   58 +
 .../unix/sysv/linux/loongarch/bits/sigstack.h |   32 +
 sysdeps/unix/sysv/linux/loongarch/clone.S     |  100 +
 sysdeps/unix/sysv/linux/loongarch/clone3.S    |   87 +
 sysdeps/unix/sysv/linux/loongarch/configure   |  199 ++
 .../unix/sysv/linux/loongarch/configure.ac    |   27 +
 sysdeps/unix/sysv/linux/loongarch/dl-static.c |   80 +
 .../unix/sysv/linux/loongarch/getcontext.S    |   74 +
 sysdeps/unix/sysv/linux/loongarch/ipc_priv.h  |   22 +
 sysdeps/unix/sysv/linux/loongarch/ldconfig.h  |   30 +
 .../unix/sysv/linux/loongarch/ldd-rewrite.sed |    3 +
 sysdeps/unix/sysv/linux/loongarch/ldsodefs.h  |   33 +
 .../unix/sysv/linux/loongarch/localplt.data   |   12 +
 .../unix/sysv/linux/loongarch/lp64/Implies    |    3 +
 .../sysv/linux/loongarch/lp64/c++-types.data  |   67 +
 .../linux/loongarch/lp64/fpu/jmp_buf-macros.h |   44 +
 .../unix/sysv/linux/loongarch/lp64/ld.abilist |    8 +
 .../loongarch/lp64/libBrokenLocale.abilist    |    1 +
 .../sysv/linux/loongarch/lp64/libanl.abilist  |    1 +
 .../sysv/linux/loongarch/lp64/libc.abilist    | 2137 +++++++++++++++++
 .../loongarch/lp64/libc_malloc_debug.abilist  |   26 +
 .../linux/loongarch/lp64/libcrypt.abilist     |    2 +
 .../sysv/linux/loongarch/lp64/libdl.abilist   |    0
 .../sysv/linux/loongarch/lp64/libm.abilist    | 1033 ++++++++
 .../sysv/linux/loongarch/lp64/libnsl.abilist  |  120 +
 .../linux/loongarch/lp64/libpthread.abilist   |    0
 .../linux/loongarch/lp64/libresolv.abilist    |   55 +
 .../sysv/linux/loongarch/lp64/librt.abilist   |    0
 .../linux/loongarch/lp64/libthread_db.abilist |   40 +
 .../sysv/linux/loongarch/lp64/libutil.abilist |    1 +
 .../loongarch/lp64/nofpu/jmp_buf-macros.h     |   41 +
 .../unix/sysv/linux/loongarch/makecontext.c   |   79 +
 .../unix/sysv/linux/loongarch/register-dump.h |   61 +
 .../unix/sysv/linux/loongarch/setcontext.S    |  115 +
 .../unix/sysv/linux/loongarch/shlib-versions  |    7 +
 .../sysv/linux/loongarch/sigcontextinfo.h     |   32 +
 .../unix/sysv/linux/loongarch/swapcontext.S   |  123 +
 .../unix/sysv/linux/loongarch/sys/procfs.h    |  134 ++
 .../unix/sysv/linux/loongarch/sys/ucontext.h  |   90 +
 sysdeps/unix/sysv/linux/loongarch/sys/user.h  |   32 +
 sysdeps/unix/sysv/linux/loongarch/syscall.c   |   35 +
 sysdeps/unix/sysv/linux/loongarch/sysdep.S    |   53 +
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  321 +++
 .../sysv/linux/loongarch/ucontext-macros.h    |   42 +
 .../unix/sysv/linux/loongarch/ucontext_i.sym  |   33 +
 sysdeps/unix/sysv/linux/loongarch/vfork.S     |   50 +
 133 files changed, 10982 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/loongarch/Implies
 create mode 100644 sysdeps/loongarch/Makefile
 create mode 100644 sysdeps/loongarch/__longjmp.S
 create mode 100644 sysdeps/loongarch/abort-instr.h
 create mode 100644 sysdeps/loongarch/bits/endianness.h
 create mode 100644 sysdeps/loongarch/bits/fenv.h
 create mode 100644 sysdeps/loongarch/bits/link.h
 create mode 100644 sysdeps/loongarch/bits/setjmp.h
 create mode 100644 sysdeps/loongarch/bits/wordsize.h
 create mode 100644 sysdeps/loongarch/bsd-_setjmp.c
 create mode 100644 sysdeps/loongarch/bsd-setjmp.c
 create mode 100644 sysdeps/loongarch/configure
 create mode 100644 sysdeps/loongarch/configure.ac
 create mode 100644 sysdeps/loongarch/dl-irel.h
 create mode 100644 sysdeps/loongarch/dl-machine.h
 create mode 100644 sysdeps/loongarch/dl-tls.h
 create mode 100644 sysdeps/loongarch/dl-trampoline.S
 create mode 100644 sysdeps/loongarch/e_sqrtl.c
 create mode 100644 sysdeps/loongarch/fpu/e_sqrt.c
 create mode 100644 sysdeps/loongarch/fpu/e_sqrtf.c
 create mode 100644 sysdeps/loongarch/fpu/fclrexcpt.c
 create mode 100644 sysdeps/loongarch/fpu/fedisblxcpt.c
 create mode 100644 sysdeps/loongarch/fpu/feenablxcpt.c
 create mode 100644 sysdeps/loongarch/fpu/fegetenv.c
 create mode 100644 sysdeps/loongarch/fpu/fegetexcept.c
 create mode 100644 sysdeps/loongarch/fpu/fegetmode.c
 create mode 100644 sysdeps/loongarch/fpu/fegetround.c
 create mode 100644 sysdeps/loongarch/fpu/feholdexcpt.c
 create mode 100644 sysdeps/loongarch/fpu/fenv_libc.h
 create mode 100644 sysdeps/loongarch/fpu/fesetenv.c
 create mode 100644 sysdeps/loongarch/fpu/fesetexcept.c
 create mode 100644 sysdeps/loongarch/fpu/fesetmode.c
 create mode 100644 sysdeps/loongarch/fpu/fesetround.c
 create mode 100644 sysdeps/loongarch/fpu/feupdateenv.c
 create mode 100644 sysdeps/loongarch/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/loongarch/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/loongarch/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/loongarch/fpu/ftestexcept.c
 create mode 100644 sysdeps/loongarch/fpu_control.h
 create mode 100644 sysdeps/loongarch/gccframe.h
 create mode 100644 sysdeps/loongarch/hp-timing.h
 create mode 100644 sysdeps/loongarch/jmpbuf-offsets.h
 create mode 100644 sysdeps/loongarch/jmpbuf-unwind.h
 create mode 100644 sysdeps/loongarch/ldsodefs.h
 create mode 100644 sysdeps/loongarch/libc-start.h
 create mode 100644 sysdeps/loongarch/libc-tls.c
 create mode 100644 sysdeps/loongarch/linkmap.h
 create mode 100644 sysdeps/loongarch/lp64/Implies-after
 create mode 100644 sysdeps/loongarch/lp64/libm-test-ulps
 create mode 100644 sysdeps/loongarch/lp64/libm-test-ulps-name
 create mode 100644 sysdeps/loongarch/machine-gmon.h
 create mode 100644 sysdeps/loongarch/math_private.h
 create mode 100644 sysdeps/loongarch/memusage.h
 create mode 100644 sysdeps/loongarch/nptl/Makefile
 create mode 100644 sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/loongarch/nptl/bits/semaphore.h
 create mode 100644 sysdeps/loongarch/nptl/bits/struct_rwlock.h
 create mode 100644 sysdeps/loongarch/nptl/libc-lowlevellock.c
 create mode 100644 sysdeps/loongarch/nptl/nptl-sysdep.S
 create mode 100644 sysdeps/loongarch/nptl/pthread-offsets.h
 create mode 100644 sysdeps/loongarch/nptl/pthreaddef.h
 create mode 100644 sysdeps/loongarch/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/loongarch/nptl/tls.h
 create mode 100644 sysdeps/loongarch/preconfigure
 create mode 100644 sysdeps/loongarch/setjmp.S
 create mode 100644 sysdeps/loongarch/sfp-machine.h
 create mode 100644 sysdeps/loongarch/sotruss-lib.c
 create mode 100644 sysdeps/loongarch/stackinfo.h
 create mode 100644 sysdeps/loongarch/start.S
 create mode 100644 sysdeps/loongarch/sys/asm.h
 create mode 100644 sysdeps/loongarch/sys/regdef.h
 create mode 100644 sysdeps/loongarch/tininess.h
 create mode 100644 sysdeps/loongarch/tls-macros.h
 create mode 100644 sysdeps/loongarch/tst-audit.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/Implies
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/atomic-machine.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/fcntl.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/mman.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/pthread_stack_min.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/sigcontext.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/sigstack.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/clone.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/configure
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/dl-static.c
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ipc_priv.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ldconfig.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ldsodefs.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/localplt.data
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/fpu/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libc_malloc_debug.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libnsl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/nofpu/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/register-dump.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sys/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/syscall.c
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ucontext-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ucontext_i.sym
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/vfork.S

Comments

Joseph Myers Dec. 31, 2021, 5:34 p.m. UTC | #1
On Fri, 31 Dec 2021, caiyinyu wrote:

> b.
> FAIL: elf/ifuncmain1
> FAIL: elf/ifuncmain1pic
> FAIL: elf/ifuncmain1pie
> FAIL: elf/ifuncmain1staticpic
> FAIL: elf/ifuncmain1staticpie
> FAIL: elf/ifuncmain1vis
> FAIL: elf/ifuncmain1vispic
> FAIL: elf/ifuncmain1vispie
> FAIL: elf/ifuncmain3
> FAIL: elf/ifuncmain4
> FAIL: elf/ifuncmain6pie
> FAIL: elf/ifuncmain7
> FAIL: elf/ifuncmain7pic
> FAIL: elf/ifuncmain7pie
> FAIL: elf/tst-ifunc-fault-bindnow
> FAIL: elf/tst-ifunc-fault-lazy
> 
> ifunc functions are not support yet

If IFUNC isn't supported, the configure test 
(libc_cv_ld_gnu_indirect_function) should fail, have-ifunc should be no 
and elf/Makefile should disable the tests.

Those failures suggest you have partial support in the toolchain - enough 
binutils support for the tests to be enabled - but are either missing 
glibc support, or some of the toolchain support is broken.  In that case, 
you should fix/add the broken/missing support so that the tests pass.  (Or 
if it's wrong that the libc_cv_ld_gnu_indirect_function test passes at 
all, maybe that's a binutils bug and you need to fix the binutils port so 
that that configure test fails.)

> c.
> FAIL: math/test-double-acos
> FAIL: math/test-double-asin
> FAIL: math/test-float32x-acos
> FAIL: math/test-float32x-asin
> FAIL: math/test-float64-acos
> FAIL: math/test-float64-asin
> 
> These fails are caused by gcc optimizations. if we use -O0 options, these fails
> will pass.

So that issue needs fixing in GCC upstream.

> 10. Note the need for a manual/math.texi update in the list of
> configurations supporting _Float128.
> 
> not support yet

It's supported by the port (with the same ABI as long double, via the 
ieee754/ldbl-128 inclusion in sysdeps/loongarch/Implies) - the functions 
are in the ABI test baselines.  So you need to update math.texi to reflect 
that.

> 13. arch_minimum_kernel should be set to 10.0.0 until the actual upstream
> kernel version that gets the port is known, and then to the actual
> upstream version (so 5.14.0 or later).  Accordingly, kernel-features.h
> should not have any "before 4.20" conditionals in it (so you don't need an
> architecture-specific kernel-features.h at all).
> 
> corrected

You have arch_minimum_kernel=5.15.0, but the support isn't in 5.15.0, and 
indeed isn't in Linus's git tree for 5.16 either.

Once it's in Linus's git tree, you can set arch_minimum_kernel to the 
actual version that will have the port.  Until then, you should use 10.0.0 
as a placeholder.
Adhemerval Zanella Jan. 4, 2022, 1:27 p.m. UTC | #2
On 31/12/2021 03:44, caiyinyu wrote:
> FAIL: elf/ifuncmain1
> FAIL: elf/ifuncmain1pic
> FAIL: elf/ifuncmain1pie
> FAIL: elf/ifuncmain1staticpic
> FAIL: elf/ifuncmain1staticpie
> FAIL: elf/ifuncmain1vis
> FAIL: elf/ifuncmain1vispic
> FAIL: elf/ifuncmain1vispie
> FAIL: elf/ifuncmain3
> FAIL: elf/ifuncmain4
> FAIL: elf/ifuncmain6pie
> FAIL: elf/ifuncmain7
> FAIL: elf/ifuncmain7pic
> FAIL: elf/ifuncmain7pie
> FAIL: elf/tst-ifunc-fault-bindnow
> FAIL: elf/tst-ifunc-fault-lazy
> 
> ifunc functions are not support yet

If the target does not support ifunc, why libc_cv_ld_gnu_indirect_function is being
set then? I think you will need to disable the usage of %gnu_indirect_function
on static linker.

> 
> c.
> FAIL: math/test-double-acos
> FAIL: math/test-double-asin
> FAIL: math/test-float32x-acos
> FAIL: math/test-float32x-asin
> FAIL: math/test-float64-acos
> FAIL: math/test-float64-asin
> 
> These fails are caused by gcc optimizations. if we use -O0 options, these fails
> will pass.
> 
> sysdeps/ieee754/dbl-64/e_asin.c: 343
> ===================================================================
> 337	  if (k>0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0)) return x + x;
>    0x00007ffff7f4daac <+1388>:	lu12i.w     	$t0, 524032(0x7ff00)
>    0x00007ffff7f4dab0 <+1392>:	blt         	$t0, $t2, 20(0x14)	# 0x7ffff7f4dac4 <__ieee754_acos+1412>
>    0x00007ffff7f4dab4 <+1396>:	bne         	$t2, $t0, 36(0x24)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
>    0x00007ffff7f4dab8 <+1400>:	ld.d        	$t0, $sp, 8(0x8)
>    0x00007ffff7f4dabc <+1404>:	slli.w      	$t0, $t0, 0x0
>    0x00007ffff7f4dac0 <+1408>:	beqz        	$t0, 24(0x18)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
>    0x00007ffff7f4dac4 <+1412>:	fld.d       	$fa0, $sp, 8(0x8)
>    0x00007ffff7f4dac8 <+1416>:	fadd.d      	$fa0, $fa0, $fa0
>    0x00007ffff7f4dacc <+1420>:	b           	-788(0xffffcec)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>
> 
> 338	  else {
> 339	    u.i[HIGH_HALF]=0x7ff00000;
> 340	    v.i[HIGH_HALF]=0x7ff00000;
> 341	    u.i[LOW_HALF]=0;
> 342	    v.i[LOW_HALF]=0;
> 343	    return u.x/v.x;			/////////  optimized out
> 
>    0x00007ffff7f4dad8 <+1432>:	pcaddu12i   	$t0, 63(0x3f)
>    0x00007ffff7f4dadc <+1436>:	addi.d      	$t0, $t0, -1248(0xb20)
>    0x00007ffff7f4dae0 <+1440>:	fld.d       	$fa0, $t0, 0
>    0x00007ffff7f4dae4 <+1444>:	b           	-812(0xffffcd4)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>
> 
> 344	  }
> 345	}
>    0x00007ffff7f4d7b8 <+632>:	addi.d      	$sp, $sp, 16(0x10)
>    0x00007ffff7f4d7bc <+636>:	jirl        	$zero, $ra, 0
>    0x00007ffff7f4d7cc <+652>:	addi.d      	$sp, $sp, 16(0x10)
>    0x00007ffff7f4d7d0 <+656>:	jirl        	$zero, $ra, 0
>    0x00007ffff7f4d8bc <+892>:	addi.d      	$sp, $sp, 16(0x10)
>    0x00007ffff7f4d8c0 <+896>:	jirl        	$zero, $ra, 0
> ===================================================================

Is this being tracked by a GCC bug report? We need to understand if we 
require to use math_force_eval to avoid such issue on other ports as
well.
caiyinyu April 15, 2022, 1:27 a.m. UTC | #3
在 2022/1/1 上午1:34, Joseph Myers 写道:
> On Fri, 31 Dec 2021, caiyinyu wrote:
>
>> b.
>> FAIL: elf/ifuncmain1
>> FAIL: elf/ifuncmain1pic
>> FAIL: elf/ifuncmain1pie
>> FAIL: elf/ifuncmain1staticpic
>> FAIL: elf/ifuncmain1staticpie
>> FAIL: elf/ifuncmain1vis
>> FAIL: elf/ifuncmain1vispic
>> FAIL: elf/ifuncmain1vispie
>> FAIL: elf/ifuncmain3
>> FAIL: elf/ifuncmain4
>> FAIL: elf/ifuncmain6pie
>> FAIL: elf/ifuncmain7
>> FAIL: elf/ifuncmain7pic
>> FAIL: elf/ifuncmain7pie
>> FAIL: elf/tst-ifunc-fault-bindnow
>> FAIL: elf/tst-ifunc-fault-lazy
>>
>> ifunc functions are not support yet
> If IFUNC isn't supported, the configure test
> (libc_cv_ld_gnu_indirect_function) should fail, have-ifunc should be no
> and elf/Makefile should disable the tests.
>
> Those failures suggest you have partial support in the toolchain - enough
> binutils support for the tests to be enabled - but are either missing
> glibc support, or some of the toolchain support is broken.  In that case,
> you should fix/add the broken/missing support so that the tests pass.  (Or
> if it's wrong that the libc_cv_ld_gnu_indirect_function test passes at
> all, maybe that's a binutils bug and you need to fix the binutils port so
> that that configure test fails.)
All ifunc problems are fixed.
>> c.
>> FAIL: math/test-double-acos
>> FAIL: math/test-double-asin
>> FAIL: math/test-float32x-acos
>> FAIL: math/test-float32x-asin
>> FAIL: math/test-float64-acos
>> FAIL: math/test-float64-asin
>>
>> These fails are caused by gcc optimizations. if we use -O0 options, these fails
>> will pass.
> So that issue needs fixing in GCC upstream.

GCC fixed.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115

>> 10. Note the need for a manual/math.texi update in the list of
>> configurations supporting _Float128.
>>
>> not support yet
> It's supported by the port (with the same ABI as long double, via the
> ieee754/ldbl-128 inclusion in sysdeps/loongarch/Implies) - the functions
> are in the ABI test baselines.  So you need to update math.texi to reflect
> that.
Fixed.
>> 13. arch_minimum_kernel should be set to 10.0.0 until the actual upstream
>> kernel version that gets the port is known, and then to the actual
>> upstream version (so 5.14.0 or later).  Accordingly, kernel-features.h
>> should not have any "before 4.20" conditionals in it (so you don't need an
>> architecture-specific kernel-features.h at all).
>>
>> corrected
> You have arch_minimum_kernel=5.15.0, but the support isn't in 5.15.0, and
> indeed isn't in Linus's git tree for 5.16 either.
>
> Once it's in Linus's git tree, you can set arch_minimum_kernel to the
> actual version that will have the port.  Until then, you should use 10.0.0
> as a placeholder.
Fixed.
caiyinyu April 15, 2022, 1:28 a.m. UTC | #4
在 2022/1/4 下午9:27, Adhemerval Zanella 写道:
> On 31/12/2021 03:44, caiyinyu wrote:
>> FAIL: elf/ifuncmain1
>> FAIL: elf/ifuncmain1pic
>> FAIL: elf/ifuncmain1pie
>> FAIL: elf/ifuncmain1staticpic
>> FAIL: elf/ifuncmain1staticpie
>> FAIL: elf/ifuncmain1vis
>> FAIL: elf/ifuncmain1vispic
>> FAIL: elf/ifuncmain1vispie
>> FAIL: elf/ifuncmain3
>> FAIL: elf/ifuncmain4
>> FAIL: elf/ifuncmain6pie
>> FAIL: elf/ifuncmain7
>> FAIL: elf/ifuncmain7pic
>> FAIL: elf/ifuncmain7pie
>> FAIL: elf/tst-ifunc-fault-bindnow
>> FAIL: elf/tst-ifunc-fault-lazy
>>
>> ifunc functions are not support yet
> If the target does not support ifunc, why libc_cv_ld_gnu_indirect_function is being
> set then? I think you will need to disable the usage of %gnu_indirect_function
> on static linker.


All ifunc problems are solved.

>> c.
>> FAIL: math/test-double-acos
>> FAIL: math/test-double-asin
>> FAIL: math/test-float32x-acos
>> FAIL: math/test-float32x-asin
>> FAIL: math/test-float64-acos
>> FAIL: math/test-float64-asin
>>
>> These fails are caused by gcc optimizations. if we use -O0 options, these fails
>> will pass.
>>
>> sysdeps/ieee754/dbl-64/e_asin.c: 343
>> ===================================================================
>> 337	  if (k>0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0)) return x + x;
>>     0x00007ffff7f4daac <+1388>:	lu12i.w     	$t0, 524032(0x7ff00)
>>     0x00007ffff7f4dab0 <+1392>:	blt         	$t0, $t2, 20(0x14)	# 0x7ffff7f4dac4 <__ieee754_acos+1412>
>>     0x00007ffff7f4dab4 <+1396>:	bne         	$t2, $t0, 36(0x24)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
>>     0x00007ffff7f4dab8 <+1400>:	ld.d        	$t0, $sp, 8(0x8)
>>     0x00007ffff7f4dabc <+1404>:	slli.w      	$t0, $t0, 0x0
>>     0x00007ffff7f4dac0 <+1408>:	beqz        	$t0, 24(0x18)	# 0x7ffff7f4dad8 <__ieee754_acos+1432>
>>     0x00007ffff7f4dac4 <+1412>:	fld.d       	$fa0, $sp, 8(0x8)
>>     0x00007ffff7f4dac8 <+1416>:	fadd.d      	$fa0, $fa0, $fa0
>>     0x00007ffff7f4dacc <+1420>:	b           	-788(0xffffcec)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>
>>
>> 338	  else {
>> 339	    u.i[HIGH_HALF]=0x7ff00000;
>> 340	    v.i[HIGH_HALF]=0x7ff00000;
>> 341	    u.i[LOW_HALF]=0;
>> 342	    v.i[LOW_HALF]=0;
>> 343	    return u.x/v.x;			/////////  optimized out
>>
>>     0x00007ffff7f4dad8 <+1432>:	pcaddu12i   	$t0, 63(0x3f)
>>     0x00007ffff7f4dadc <+1436>:	addi.d      	$t0, $t0, -1248(0xb20)
>>     0x00007ffff7f4dae0 <+1440>:	fld.d       	$fa0, $t0, 0
>>     0x00007ffff7f4dae4 <+1444>:	b           	-812(0xffffcd4)	# 0x7ffff7f4d7b8 <__ieee754_acos+632>
>>
>> 344	  }
>> 345	}
>>     0x00007ffff7f4d7b8 <+632>:	addi.d      	$sp, $sp, 16(0x10)
>>     0x00007ffff7f4d7bc <+636>:	jirl        	$zero, $ra, 0
>>     0x00007ffff7f4d7cc <+652>:	addi.d      	$sp, $sp, 16(0x10)
>>     0x00007ffff7f4d7d0 <+656>:	jirl        	$zero, $ra, 0
>>     0x00007ffff7f4d8bc <+892>:	addi.d      	$sp, $sp, 16(0x10)
>>     0x00007ffff7f4d8c0 <+896>:	jirl        	$zero, $ra, 0
>> ===================================================================
> Is this being tracked by a GCC bug report? We need to understand if we
> require to use math_force_eval to avoid such issue on other ports as
> well.

GCC upstream Fixed.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115