[v7,00/13] GLIBC LoongArch PATCHES

Message ID 20220719012056.1461897-1-caiyinyu@loongson.cn
State Not applicable
Headers

Commit Message

caiyinyu July 19, 2022, 1:20 a.m. UTC
  Hello, these are LoongArch patches v7, and we really need your futher suggestions:

There are 6 parts in total.

1. HISTORY:
LoongArch patches v1: https://sourceware.org/pipermail/libc-alpha/2021-August/130262.html
LoongArch patches v2: https://sourceware.org/pipermail/libc-alpha/2021-December/134811.html
LoongArch patches v3: https://sourceware.org/pipermail/libc-alpha/2022-April/137888.html
LoongArch patches v4: https://sourceware.org/pipermail/libc-alpha/2022-May/subject.html
LoongArch patches v5: https://sourceware.org/pipermail/libc-alpha/2022-June/139262.html
LoongArch patches v6: https://sourceware.org/pipermail/libc-alpha/2022-July/140446.html

2. 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


3. Linux kernel, GCC and Binutils Loongarch parts have been into GNU Open Source community.


4. From Adhemerval Zanella Netto:
> I finished my review for the port and it looks ok in general, however there
> some pieces that would require a v7:
>
>   1. Add R_LARCH_NONE handling on bootstrap, binutils 2.38 does generated it
>      and from previous discussion it should be considered a missed
>      optimizations instead of a linker error.

    R_LARCH_NONE handling has been added on bootstrap.
>
>   2. Remove the __loongarch_soft_float parts, since there is no support for
>      soft floating-point.

    All __loongarch_soft_float removed.
>
>   3. Remove sysdeps/unix/sysv/linux/loongarch/ldconfig.h, this file is not
>      required.

    This file has been removed.
>
>   4. Some minor style issues.

    See previous emails.
    https://sourceware.org/pipermail/libc-alpha/2022-July/thread.html
>
>   5. Either remove HAVE_GETTIMEOFDAY_VSYSCALL or add a gettimeofday ifunc
>      optimization.

    Removed now.
>
> The only part really prevent port inclusion is 1.  I am also assuming ifunc
> is support (at least you have added support on the Linux ABI part) with
> binutils 2.38.  If not, you will need to remove support until you fix it on
> binutils.
>
> And also, you need to check and report the test results using the expected
> defined release branches, using out-of-tree branches are not acceptable for
> inclusion.

5. There are some new changes:
>>>>>>>>>>>>>>>>>>>>>>>>>


<<<<<<<<<<<<<<<<<<<<<<<<


6. Test result: all passed (ifunc disable).

Test with:
  Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
  glibc: https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7

Result (ifunc disable):
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
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
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-pthread-gdb-attach
UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
UNSUPPORTED: nptl/tst-rseq-nptl
UNSUPPORTED: stdlib/tst-secure-getenv
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
Summary of test results:
   4535 PASS
     22 UNSUPPORTED
     12 XFAIL
      6 XPASS


caiyinyu (13):
  LoongArch: Add LoongArch entries to config.h.in
  LoongArch: Add relocations and ELF flags to elf.h and
    scripts/glibcelf.py
  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: Add ABI Lists
  LoongArch: Build Infastructure
  LoongArch: Hard Float Support
  LoongArch: Update build-many-glibcs.py for the LoongArch Port.
  LoongArch: Update NEWS and README for the LoongArch port.

 NEWS                                          |    8 +
 README                                        |    1 +
 config.h.in                                   |    6 +
 elf/elf.h                                     |   68 +-
 manual/math.texi                              |    2 +-
 scripts/build-many-glibcs.py                  |    5 +
 scripts/glibcelf.py                           |    3 +-
 sysdeps/loongarch/Implies                     |    3 +
 sysdeps/loongarch/Makefile                    |   15 +
 sysdeps/loongarch/__longjmp.S                 |   50 +
 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               |   39 +
 sysdeps/loongarch/bsd-_setjmp.c               |    1 +
 sysdeps/loongarch/bsd-setjmp.c                |    1 +
 sysdeps/loongarch/configure                   |    5 +
 sysdeps/loongarch/configure.ac                |    6 +
 sysdeps/loongarch/dl-irel.h                   |   54 +
 sysdeps/loongarch/dl-machine.h                |  288 +++
 sysdeps/loongarch/dl-tls.h                    |   46 +
 sysdeps/loongarch/dl-trampoline.S             |   83 +
 sysdeps/loongarch/e_sqrtl.c                   |   39 +
 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           |   80 +
 sysdeps/loongarch/fpu/fsetexcptflg.c          |   41 +
 sysdeps/loongarch/fpu/ftestexcept.c           |   32 +
 .../loongarch/fpu/math-use-builtins-sqrt.h    |    4 +
 sysdeps/loongarch/fpu_control.h               |   90 +
 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-tls.c                  |   32 +
 sysdeps/loongarch/linkmap.h                   |   22 +
 sysdeps/loongarch/lp64/Implies-after          |    1 +
 sysdeps/loongarch/lp64/libm-test-ulps         | 1412 +++++++++++
 sysdeps/loongarch/lp64/libm-test-ulps-name    |    1 +
 sysdeps/loongarch/machine-gmon.h              |   37 +
 sysdeps/loongarch/math_private.h              |  248 ++
 sysdeps/loongarch/nptl/pthreaddef.h           |   32 +
 sysdeps/loongarch/nptl/tls.h                  |  138 ++
 sysdeps/loongarch/preconfigure                |   53 +
 sysdeps/loongarch/preconfigure.ac             |   47 +
 sysdeps/loongarch/setjmp.S                    |   64 +
 sysdeps/loongarch/sfp-machine.h               |  102 +
 sysdeps/loongarch/sotruss-lib.c               |   50 +
 sysdeps/loongarch/stackinfo.h                 |   33 +
 sysdeps/loongarch/start.S                     |   66 +
 sysdeps/loongarch/sys/asm.h                   |   59 +
 sysdeps/loongarch/sys/ifunc.h                 |   30 +
 sysdeps/loongarch/sys/regdef.h                |   93 +
 sysdeps/loongarch/tininess.h                  |    1 +
 sysdeps/loongarch/tst-audit.h                 |   23 +
 sysdeps/unix/sysv/linux/loongarch/Implies     |    1 +
 sysdeps/unix/sysv/linux/loongarch/Makefile    |    4 +
 .../unix/sysv/linux/loongarch/arch-syscall.h  |  301 +++
 .../sysv/linux/loongarch/atomic-machine.h     |  147 ++
 .../unix/sysv/linux/loongarch/bits/fcntl.h    |   61 +
 .../unix/sysv/linux/loongarch/bits/procfs.h   |   52 +
 .../linux/loongarch/bits/pthread_stack_min.h  |   20 +
 .../unix/sysv/linux/loongarch/bits/sigstack.h |   32 +
 sysdeps/unix/sysv/linux/loongarch/clone.S     |   96 +
 sysdeps/unix/sysv/linux/loongarch/clone3.S    |   83 +
 sysdeps/unix/sysv/linux/loongarch/configure   |  174 ++
 .../unix/sysv/linux/loongarch/configure.ac    |   22 +
 .../unix/sysv/linux/loongarch/getcontext.S    |   59 +
 .../unix/sysv/linux/loongarch/ldd-rewrite.sed |    1 +
 .../unix/sysv/linux/loongarch/localplt.data   |   12 +
 .../unix/sysv/linux/loongarch/lp64/Implies    |    3 +
 .../sysv/linux/loongarch/lp64/c++-types.data  |   67 +
 .../unix/sysv/linux/loongarch/lp64/ld.abilist |    8 +
 .../loongarch/lp64/libBrokenLocale.abilist    |    1 +
 .../sysv/linux/loongarch/lp64/libc.abilist    | 2153 +++++++++++++++++
 .../loongarch/lp64/libc_malloc_debug.abilist  |   26 +
 .../linux/loongarch/lp64/libcrypt.abilist     |    2 +
 .../sysv/linux/loongarch/lp64/libm.abilist    | 1030 ++++++++
 .../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 +
 .../unix/sysv/linux/loongarch/makecontext.c   |   81 +
 .../unix/sysv/linux/loongarch/setcontext.S    |  100 +
 .../unix/sysv/linux/loongarch/shlib-versions  |    7 +
 .../sysv/linux/loongarch/sigcontextinfo.h     |   32 +
 .../unix/sysv/linux/loongarch/swapcontext.S   |   95 +
 .../unix/sysv/linux/loongarch/sys/ucontext.h  |   61 +
 sysdeps/unix/sysv/linux/loongarch/sys/user.h  |   42 +
 sysdeps/unix/sysv/linux/loongarch/sysdep.S    |   53 +
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  320 +++
 .../sysv/linux/loongarch/ucontext-macros.h    |   32 +
 .../unix/sysv/linux/loongarch/ucontext_i.sym  |   31 +
 sysdeps/unix/sysv/linux/loongarch/vfork.S     |   50 +
 108 files changed, 9730 insertions(+), 3 deletions(-)
 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/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/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/math-use-builtins-sqrt.h
 create mode 100644 sysdeps/loongarch/fpu_control.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-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/nptl/pthreaddef.h
 create mode 100644 sysdeps/loongarch/nptl/tls.h
 create mode 100644 sysdeps/loongarch/preconfigure
 create mode 100644 sysdeps/loongarch/preconfigure.ac
 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/ifunc.h
 create mode 100644 sysdeps/loongarch/sys/regdef.h
 create mode 100644 sysdeps/loongarch/tininess.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/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/bits/pthread_stack_min.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/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/ldd-rewrite.sed
 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/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/libBrokenLocale.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/libm.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/makecontext.c
 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/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/sys/user.h
 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

Adhemerval Zanella July 20, 2022, 5:19 p.m. UTC | #1
On 18/07/22 22:20, caiyinyu wrote:
> Hello, these are LoongArch patches v7, and we really need your futher suggestions:
> 
> There are 6 parts in total.
> 
> 1. HISTORY:
> LoongArch patches v1: https://sourceware.org/pipermail/libc-alpha/2021-August/130262.html
> LoongArch patches v2: https://sourceware.org/pipermail/libc-alpha/2021-December/134811.html
> LoongArch patches v3: https://sourceware.org/pipermail/libc-alpha/2022-April/137888.html
> LoongArch patches v4: https://sourceware.org/pipermail/libc-alpha/2022-May/subject.html
> LoongArch patches v5: https://sourceware.org/pipermail/libc-alpha/2022-June/139262.html
> LoongArch patches v6: https://sourceware.org/pipermail/libc-alpha/2022-July/140446.html
> 
> 2. 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
> 
> 
> 3. Linux kernel, GCC and Binutils Loongarch parts have been into GNU Open Source community.
> 
> 
> 4. From Adhemerval Zanella Netto:
>> I finished my review for the port and it looks ok in general, however there
>> some pieces that would require a v7:
>>
>>   1. Add R_LARCH_NONE handling on bootstrap, binutils 2.38 does generated it
>>      and from previous discussion it should be considered a missed
>>      optimizations instead of a linker error.
> 
>     R_LARCH_NONE handling has been added on bootstrap.
>>
>>   2. Remove the __loongarch_soft_float parts, since there is no support for
>>      soft floating-point.
> 
>     All __loongarch_soft_float removed.
>>
>>   3. Remove sysdeps/unix/sysv/linux/loongarch/ldconfig.h, this file is not
>>      required.
> 
>     This file has been removed.
>>
>>   4. Some minor style issues.
> 
>     See previous emails.
>     https://sourceware.org/pipermail/libc-alpha/2022-July/thread.html
>>
>>   5. Either remove HAVE_GETTIMEOFDAY_VSYSCALL or add a gettimeofday ifunc
>>      optimization.
> 
>     Removed now.
>>
>> The only part really prevent port inclusion is 1.  I am also assuming ifunc
>> is support (at least you have added support on the Linux ABI part) with
>> binutils 2.38.  If not, you will need to remove support until you fix it on
>> binutils.
>>
>> And also, you need to check and report the test results using the expected
>> defined release branches, using out-of-tree branches are not acceptable for
>> inclusion.
> 
> 5. There are some new changes:

This version looks good to me, everything I have pointed out in previous release
was addressed, build-many-glibcs.py and make check does not trigger any issue,
and some qemu tests show that the generated loader and binaries are corrected
generated.

If you want, I can push it upstream.  Carlos is ok to install it?
  
caiyinyu July 21, 2022, 2:44 a.m. UTC | #2
This version looks good to me, everything I have pointed out in previous 
release
was addressed, build-many-glibcs.py and make check does not trigger any 
issue,
and some qemu tests show that the generated loader and binaries are 
corrected
generated.

If you want, I can push it upstream.  Carlos is ok to install it?

-------------------------------------

Very glad to know that you agreed to install Loongarch ports and I have

submitted application for write access to the Loongarch parts of glibc.

Waiting for Carlos' advice.

Thank everyone for their efforts.



在 2022/7/21 上午1:19, Adhemerval Zanella Netto 写道:
>
> On 18/07/22 22:20, caiyinyu wrote:
>> Hello, these are LoongArch patches v7, and we really need your futher suggestions:
>>
>> There are 6 parts in total.
>>
>> 1. HISTORY:
>> LoongArch patches v1: https://sourceware.org/pipermail/libc-alpha/2021-August/130262.html
>> LoongArch patches v2: https://sourceware.org/pipermail/libc-alpha/2021-December/134811.html
>> LoongArch patches v3: https://sourceware.org/pipermail/libc-alpha/2022-April/137888.html
>> LoongArch patches v4: https://sourceware.org/pipermail/libc-alpha/2022-May/subject.html
>> LoongArch patches v5: https://sourceware.org/pipermail/libc-alpha/2022-June/139262.html
>> LoongArch patches v6: https://sourceware.org/pipermail/libc-alpha/2022-July/140446.html
>>
>> 2. 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
>>
>>
>> 3. Linux kernel, GCC and Binutils Loongarch parts have been into GNU Open Source community.
>>
>>
>> 4. From Adhemerval Zanella Netto:
>>> I finished my review for the port and it looks ok in general, however there
>>> some pieces that would require a v7:
>>>
>>>    1. Add R_LARCH_NONE handling on bootstrap, binutils 2.38 does generated it
>>>       and from previous discussion it should be considered a missed
>>>       optimizations instead of a linker error.
>>      R_LARCH_NONE handling has been added on bootstrap.
>>>    2. Remove the __loongarch_soft_float parts, since there is no support for
>>>       soft floating-point.
>>      All __loongarch_soft_float removed.
>>>    3. Remove sysdeps/unix/sysv/linux/loongarch/ldconfig.h, this file is not
>>>       required.
>>      This file has been removed.
>>>    4. Some minor style issues.
>>      See previous emails.
>>      https://sourceware.org/pipermail/libc-alpha/2022-July/thread.html
>>>    5. Either remove HAVE_GETTIMEOFDAY_VSYSCALL or add a gettimeofday ifunc
>>>       optimization.
>>      Removed now.
>>> The only part really prevent port inclusion is 1.  I am also assuming ifunc
>>> is support (at least you have added support on the Linux ABI part) with
>>> binutils 2.38.  If not, you will need to remove support until you fix it on
>>> binutils.
>>>
>>> And also, you need to check and report the test results using the expected
>>> defined release branches, using out-of-tree branches are not acceptable for
>>> inclusion.
>> 5. There are some new changes:
> This version looks good to me, everything I have pointed out in previous release
> was addressed, build-many-glibcs.py and make check does not trigger any issue,
> and some qemu tests show that the generated loader and binaries are corrected
> generated.
>
> If you want, I can push it upstream.  Carlos is ok to install it?
  
WANG Xuerui July 24, 2022, 9:49 a.m. UTC | #3
Hi,

On 7/19/22 09:20, caiyinyu wrote:
> <snip>
> 6. Test result: all passed (ifunc disable).
>
> Test with:
>    Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
>    glibc: https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7
>
> Result (ifunc disable):
> 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
> UNSUPPORTED: elf/tst-env-setuid
> UNSUPPORTED: elf/tst-env-setuid-tunables
> XPASS: elf/tst-protected1a
> XPASS: elf/tst-protected1b
> UNSUPPORTED: elf/tst-valgrind-smoke
> 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-pthread-gdb-attach
> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
> UNSUPPORTED: nptl/tst-rseq-nptl
> UNSUPPORTED: stdlib/tst-secure-getenv
> UNSUPPORTED: time/tst-clock_settime
> UNSUPPORTED: time/tst-settimeofday
> Summary of test results:
>     4535 PASS
>       22 UNSUPPORTED
>       12 XFAIL
>        6 XPASS

Thanks for your effort these days. I ran the test on Gentoo and this is 
what I have found out:

UNSUPPORTED: crypt/cert
FAIL: elf/check-abi-libc
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/ifuncmain2
FAIL: elf/ifuncmain2pic
FAIL: elf/ifuncmain3
FAIL: elf/ifuncmain4
FAIL: elf/ifuncmain5staticpic
FAIL: elf/ifuncmain6pie
FAIL: elf/ifuncmain7
FAIL: elf/ifuncmain7pic
FAIL: elf/ifuncmain7pie
FAIL: elf/ifuncmain9
FAIL: elf/ifuncmain9pic
FAIL: elf/ifuncmain9pie
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
FAIL: elf/tst-glibc-hwcaps-prepend-cache
FAIL: elf/tst-ifunc-textrel
FAIL: elf/tst-ldconfig-ld_so_conf-update
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
FAIL: malloc/tst-free-errno-malloc-hugetlb1
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
FAIL: nptl/tst-pthread-gdb-attach
FAIL: nptl/tst-pthread-gdb-attach-static
UNSUPPORTED: nptl/tst-rseq-nptl
FAIL: nss/tst-nss-files-hosts-long
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: stdlib/tst-secure-getenv
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday

Of these, the ifunc failures are "expected" by you, the 
elf/check-abi-libc diff is trivial (maybe you just didn't rebase as 
frequently):

--- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 
14:45:57.490029442 +0800
+++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 
13:44:10.416642655 +0800
@@ -496 +496 @@ GLIBC_2.36 _mcount F
-GLIBC_2.36 _nl_default_dirname D 0x12
+GLIBC_2.36 _nl_default_dirname D 0x17
@@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
+GLIBC_2.36 arc4random F
+GLIBC_2.36 arc4random_buf F
+GLIBC_2.36 arc4random_uniform F

The others may need some love. Of course they're possibly because of my 
particular environment (Gentoo is a little bit different than "ordinary" 
distros like Debian/Fedora, and I already have to symlink the 
libgcc_s.so and libstdc++.so to pass the nptl tests at all).

Coming to code quality, there are obviously warts present, like the 
lingering uses of the name "x" for $r21 and apparent lack of assembly 
pseudo-insn sugar usages (e.g. no "move a, b" but always "or a, b, 
zero"; the code must be directly descended from an extremely early time 
when the assembler didn't have such support), but at this point these 
cosmetic concerns are better fixed after 2.36 to minimize churn prior to 
release. At a quick glance the ABI is looking good. (There is a certain 
"__x" in bits/setjmp.h meant to refer to r21, but __jmp_buf is not 
public API so I think we're safe here.)
  
Xi Ruoyao July 24, 2022, 11:51 a.m. UTC | #4
On Sun, 2022-07-24 at 17:49 +0800, WANG Xuerui wrote:

> Of these, the ifunc failures are "expected" by you, the 
> elf/check-abi-libc diff is trivial (maybe you just didn't rebase as 
> frequently):
> 
> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 
> 14:45:57.490029442 +0800
> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 
> 13:44:10.416642655 +0800
> @@ -496 +496 @@ GLIBC_2.36 _mcount F
> -GLIBC_2.36 _nl_default_dirname D 0x12
> +GLIBC_2.36 _nl_default_dirname D 0x17
> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
> +GLIBC_2.36 arc4random F
> +GLIBC_2.36 arc4random_buf F
> +GLIBC_2.36 arc4random_uniform F

arc4random is just merged two days ago.

> The others may need some love. Of course they're possibly because of my 
> particular environment (Gentoo is a little bit different than "ordinary" 
> distros like Debian/Fedora, and I already have to symlink the 
> libgcc_s.so and libstdc++.so to pass the nptl tests at all)

I can tell tst-nss-files-hosts-long is most likely PR24816.  For the
others I'm not sure.

By "symlink libgcc_s.so and libstdc++.so" I guess you are running tests
in a temporary system ("Gentoo stage 1" IIRC).  In LFS we also get some
additional test failures in the temporary system [1] so it's better to
rerun the tests in a full system.

(In earlier LFS releases we also needed to symlink libgcc_s.so and
libstdc++.so for glibc tests, but it's no longer needed now thanks to a
major refactoring [2].)

[1]: https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/glibc.html
[2]: https://lists.linuxfromscratch.org/sympa/arc/lfs-dev/2020-05/msg00000.html

My test result on LFS (fully built) with a patched ld seems clean.  The
patch is originally published at
https://sourceware.org/pipermail/binutils/2022-July/121852.html, but
it's in a large series introducing new relocation types.  I managed to
rebased and adjusted the patch so it can be applied individually for
binutils-gdb master branch.  The patch is attached in this mail.

+Zhensong: is there any possibility to merge this patch for binutils
master and 2.39 release branch (including 2.38 release branch would be
even better) so at least glibc ifunc tests will be happy?

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/check-abi-libc
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
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-pthread-gdb-attach
UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
UNSUPPORTED: nptl/tst-rseq-nptl
UNSUPPORTED: stdlib/tst-secure-getenv
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
Summary of test results:
      1 FAIL
   4576 PASS
     22 UNSUPPORTED
     12 XFAIL
      6 XPASS
  
WANG Xuerui July 24, 2022, 12:02 p.m. UTC | #5
On 7/24/22 19:51, Xi Ruoyao wrote:
> On Sun, 2022-07-24 at 17:49 +0800, WANG Xuerui wrote:
>
>> Of these, the ifunc failures are "expected" by you, the
>> elf/check-abi-libc diff is trivial (maybe you just didn't rebase as
>> frequently):
>>
>> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23
>> 14:45:57.490029442 +0800
>> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24
>> 13:44:10.416642655 +0800
>> @@ -496 +496 @@ GLIBC_2.36 _mcount F
>> -GLIBC_2.36 _nl_default_dirname D 0x12
>> +GLIBC_2.36 _nl_default_dirname D 0x17
>> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
>> +GLIBC_2.36 arc4random F
>> +GLIBC_2.36 arc4random_buf F
>> +GLIBC_2.36 arc4random_uniform F
> arc4random is just merged two days ago.
Yeah; I meant to alert the relevant people (patch author or committer) 
to not forget adjusting this.
>
>> The others may need some love. Of course they're possibly because of my
>> particular environment (Gentoo is a little bit different than "ordinary"
>> distros like Debian/Fedora, and I already have to symlink the
>> libgcc_s.so and libstdc++.so to pass the nptl tests at all)
> I can tell tst-nss-files-hosts-long is most likely PR24816.  For the
> others I'm not sure.
>
> By "symlink libgcc_s.so and libstdc++.so" I guess you are running tests
> in a temporary system ("Gentoo stage 1" IIRC).  In LFS we also get some
> additional test failures in the temporary system [1] so it's better to
> rerun the tests in a full system.
>
> (In earlier LFS releases we also needed to symlink libgcc_s.so and
> libstdc++.so for glibc tests, but it's no longer needed now thanks to a
> major refactoring [2].)

Of course my Gentoo devbox is fully bootstrapped and working :-)

I'm referring to the Gentoo-specific behavior of slotted gcc 
installation, where gcc-provided libraries (including the two mentioned 
here) are NOT present in the usual place, but rather in 
/usr/lib/gcc/<PACKAGE VERSION>. Additional magic is present for the 
"active" gcc to be switchable via the gcc-config tool. Binutils is 
similar; there is a binutils-config too.

But anyway, the nptl tests mostly passed, with the only 2 failures 
related to the botched gdb on LoongArch (I compiled from the upstream 
HEAD and still it doesn't work). The others are worth looking into too 
but don't seem to cause any problem so far.

>
> [1]: https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/glibc.html
> [2]: https://lists.linuxfromscratch.org/sympa/arc/lfs-dev/2020-05/msg00000.html
>
> My test result on LFS (fully built) with a patched ld seems clean.  The
> patch is originally published at
> https://sourceware.org/pipermail/binutils/2022-July/121852.html, but
> it's in a large series introducing new relocation types.  I managed to
> rebased and adjusted the patch so it can be applied individually for
> binutils-gdb master branch.  The patch is attached in this mail.
>
> +Zhensong: is there any possibility to merge this patch for binutils
> master and 2.39 release branch (including 2.38 release branch would be
> even better) so at least glibc ifunc tests will be happy?
>
> 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/check-abi-libc
> UNSUPPORTED: elf/tst-env-setuid
> UNSUPPORTED: elf/tst-env-setuid-tunables
> XPASS: elf/tst-protected1a
> XPASS: elf/tst-protected1b
> UNSUPPORTED: elf/tst-valgrind-smoke
> 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-pthread-gdb-attach
> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
> UNSUPPORTED: nptl/tst-rseq-nptl
> UNSUPPORTED: stdlib/tst-secure-getenv
> UNSUPPORTED: time/tst-clock_settime
> UNSUPPORTED: time/tst-settimeofday
> Summary of test results:
>        1 FAIL
>     4576 PASS
>       22 UNSUPPORTED
>       12 XFAIL
>        6 XPASS
Overall this is looking good. Thanks for your testing.
  
liuzhensong July 25, 2022, 1:58 a.m. UTC | #6
&gt; -----原始邮件-----
&gt; 发件人: "Xi Ruoyao" <xry111@xry111.site>
&gt; 发送时间: 2022-07-24 19:51:51 (星期日)
&gt; 收件人: "WANG Xuerui" <i.swmail@xen0n.name>, caiyinyu <caiyinyu@loongson.cn>, adhemerval.zanella@linaro.org, libc-alpha@sourceware.org, joseph_myers@mentor.com, carlos@redhat.com
&gt; 抄送: liuzhensong@loongson.cn
&gt; 主题: Re: [PATCH v7 00/13] GLIBC LoongArch PATCHES
&gt; 
&gt; On Sun, 2022-07-24 at 17:49 +0800, WANG Xuerui wrote:
&gt; 
&gt; &gt; Of these, the ifunc failures are "expected" by you, the 
&gt; &gt; elf/check-abi-libc diff is trivial (maybe you just didn't rebase as 
&gt; &gt; frequently):
&gt; &gt; 
&gt; &gt; --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 
&gt; &gt; 14:45:57.490029442 +0800
&gt; &gt; +++ /home/xenon/src/glibc/build/libc.symlist&nbsp;&nbsp;&nbsp; 2022-07-24 
&gt; &gt; 13:44:10.416642655 +0800
&gt; &gt; @@ -496 +496 @@ GLIBC_2.36 _mcount F
&gt; &gt; -GLIBC_2.36 _nl_default_dirname D 0x12
&gt; &gt; +GLIBC_2.36 _nl_default_dirname D 0x17
&gt; &gt; @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
&gt; &gt; +GLIBC_2.36 arc4random F
&gt; &gt; +GLIBC_2.36 arc4random_buf F
&gt; &gt; +GLIBC_2.36 arc4random_uniform F
&gt; 
&gt; arc4random is just merged two days ago.
&gt; 
&gt; &gt; The others may need some love. Of course they're possibly because of my 
&gt; &gt; particular environment (Gentoo is a little bit different than "ordinary" 
&gt; &gt; distros like Debian/Fedora, and I already have to symlink the 
&gt; &gt; libgcc_s.so and libstdc++.so to pass the nptl tests at all)
&gt; 
&gt; I can tell tst-nss-files-hosts-long is most likely PR24816.  For the
&gt; others I'm not sure.
&gt; 
&gt; By "symlink libgcc_s.so and libstdc++.so" I guess you are running tests
&gt; in a temporary system ("Gentoo stage 1" IIRC).  In LFS we also get some
&gt; additional test failures in the temporary system [1] so it's better to
&gt; rerun the tests in a full system.
&gt; 
&gt; (In earlier LFS releases we also needed to symlink libgcc_s.so and
&gt; libstdc++.so for glibc tests, but it's no longer needed now thanks to a
&gt; major refactoring [2].)
&gt; 
&gt; [1]: https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/glibc.html
&gt; [2]: https://lists.linuxfromscratch.org/sympa/arc/lfs-dev/2020-05/msg00000.html
&gt; 
&gt; My test result on LFS (fully built) with a patched ld seems clean.  The
&gt; patch is originally published at
&gt; https://sourceware.org/pipermail/binutils/2022-July/121852.html, but
&gt; it's in a large series introducing new relocation types.  I managed to
&gt; rebased and adjusted the patch so it can be applied individually for
&gt; binutils-gdb master branch.  The patch is attached in this mail.
&gt; 
&gt; +Zhensong: is there any possibility to merge this patch for binutils
&gt; master and 2.39 release branch (including 2.38 release branch would be
&gt; even better) so at least glibc ifunc tests will be happy?

This patch alone has not been fully tested, some ifunc implementations rely on new modifications.
If there is no problem with the tests, it can be merged into other branchs.

&gt; 
&gt; XPASS: conform/UNIX98/ndbm.h/linknamespace
&gt; XPASS: conform/XOPEN2K/ndbm.h/linknamespace
&gt; XPASS: conform/XOPEN2K8/ndbm.h/linknamespace
&gt; XPASS: conform/XPG42/ndbm.h/linknamespace
&gt; UNSUPPORTED: crypt/cert
&gt; FAIL: elf/check-abi-libc
&gt; UNSUPPORTED: elf/tst-env-setuid
&gt; UNSUPPORTED: elf/tst-env-setuid-tunables
&gt; XPASS: elf/tst-protected1a
&gt; XPASS: elf/tst-protected1b
&gt; UNSUPPORTED: elf/tst-valgrind-smoke
&gt; UNSUPPORTED: misc/tst-adjtimex
&gt; UNSUPPORTED: misc/tst-clock_adjtime
&gt; UNSUPPORTED: misc/tst-ntp_adjtime
&gt; UNSUPPORTED: misc/tst-pkey
&gt; UNSUPPORTED: misc/tst-rseq
&gt; UNSUPPORTED: misc/tst-rseq-disable
&gt; UNSUPPORTED: nptl/test-cond-printers
&gt; UNSUPPORTED: nptl/test-condattr-printers
&gt; UNSUPPORTED: nptl/test-mutex-printers
&gt; UNSUPPORTED: nptl/test-mutexattr-printers
&gt; UNSUPPORTED: nptl/test-rwlock-printers
&gt; UNSUPPORTED: nptl/test-rwlockattr-printers
&gt; UNSUPPORTED: nptl/tst-pthread-gdb-attach
&gt; UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
&gt; UNSUPPORTED: nptl/tst-rseq-nptl
&gt; UNSUPPORTED: stdlib/tst-secure-getenv
&gt; UNSUPPORTED: time/tst-clock_settime
&gt; UNSUPPORTED: time/tst-settimeofday
&gt; Summary of test results:
&gt;       1 FAIL
&gt;    4576 PASS
&gt;      22 UNSUPPORTED
&gt;      12 XFAIL
&gt;       6 XPASS
&gt; 
&gt; 
&gt; -- 
&gt; Xi Ruoyao <xry111@xry111.site>
&gt; School of Aerospace Science and Technology, Xidian University
</xry111@xry111.site></caiyinyu@loongson.cn></i.swmail@xen0n.name></xry111@xry111.site>

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
  
Xi Ruoyao July 25, 2022, 8:01 a.m. UTC | #7
On Mon, 2022-07-25 at 09:58 +0800, 刘振松 wrote:
> > +Zhensong: is there any possibility to merge this patch for binutils
> > master and 2.39 release branch (including 2.38 release branch would be
> > even better) so at least glibc ifunc tests will be happy?
> 
> This patch alone has not been fully tested, some ifunc implementations rely on new modifications.
> If there is no problem with the tests, it can be merged into other branchs.

Binutils tests OK with the change.

I had to introduce "alt_got" and "alt_off" (not in your original patch)
when I extracted the patch out of the series, with changes like:

-		      bfd_put_NN (output_bfd, relocation, got->contents + off);
+		      bfd_put_NN (output_bfd, relocation, alt_got->contents + alt_off);

It's because if something is not in .got section, referring it with
got->contents + off will cause a heap buffer overflow even if off is
correct.  If the full series of your patch is applied, this seems not
happening.  But with only this patch, we need to prevent it.
  
caiyinyu July 25, 2022, 8:21 a.m. UTC | #8
Summary of test results:
        1 FAIL
     4576 PASS
       22 UNSUPPORTED
       12 XFAIL
        6 XPASS
Overall this is looking good. Thanks for your testing.


So, is it necessary to release another version of v8??


在 2022/7/24 下午8:02, WANG Xuerui 写道:
> On 7/24/22 19:51, Xi Ruoyao wrote:
>> On Sun, 2022-07-24 at 17:49 +0800, WANG Xuerui wrote:
>>
>>> Of these, the ifunc failures are "expected" by you, the
>>> elf/check-abi-libc diff is trivial (maybe you just didn't rebase as
>>> frequently):
>>>
>>> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23
>>> 14:45:57.490029442 +0800
>>> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24
>>> 13:44:10.416642655 +0800
>>> @@ -496 +496 @@ GLIBC_2.36 _mcount F
>>> -GLIBC_2.36 _nl_default_dirname D 0x12
>>> +GLIBC_2.36 _nl_default_dirname D 0x17
>>> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
>>> +GLIBC_2.36 arc4random F
>>> +GLIBC_2.36 arc4random_buf F
>>> +GLIBC_2.36 arc4random_uniform F
>> arc4random is just merged two days ago.
> Yeah; I meant to alert the relevant people (patch author or committer) 
> to not forget adjusting this.
>>
>>> The others may need some love. Of course they're possibly because of my
>>> particular environment (Gentoo is a little bit different than 
>>> "ordinary"
>>> distros like Debian/Fedora, and I already have to symlink the
>>> libgcc_s.so and libstdc++.so to pass the nptl tests at all)
>> I can tell tst-nss-files-hosts-long is most likely PR24816.  For the
>> others I'm not sure.
>>
>> By "symlink libgcc_s.so and libstdc++.so" I guess you are running tests
>> in a temporary system ("Gentoo stage 1" IIRC).  In LFS we also get some
>> additional test failures in the temporary system [1] so it's better to
>> rerun the tests in a full system.
>>
>> (In earlier LFS releases we also needed to symlink libgcc_s.so and
>> libstdc++.so for glibc tests, but it's no longer needed now thanks to a
>> major refactoring [2].)
>
> Of course my Gentoo devbox is fully bootstrapped and working :-)
>
> I'm referring to the Gentoo-specific behavior of slotted gcc 
> installation, where gcc-provided libraries (including the two 
> mentioned here) are NOT present in the usual place, but rather in 
> /usr/lib/gcc/<PACKAGE VERSION>. Additional magic is present for the 
> "active" gcc to be switchable via the gcc-config tool. Binutils is 
> similar; there is a binutils-config too.
>
> But anyway, the nptl tests mostly passed, with the only 2 failures 
> related to the botched gdb on LoongArch (I compiled from the upstream 
> HEAD and still it doesn't work). The others are worth looking into too 
> but don't seem to cause any problem so far.
>
>>
>> [1]: 
>> https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/glibc.html
>> [2]: 
>> https://lists.linuxfromscratch.org/sympa/arc/lfs-dev/2020-05/msg00000.html
>>
>> My test result on LFS (fully built) with a patched ld seems clean.  The
>> patch is originally published at
>> https://sourceware.org/pipermail/binutils/2022-July/121852.html, but
>> it's in a large series introducing new relocation types.  I managed to
>> rebased and adjusted the patch so it can be applied individually for
>> binutils-gdb master branch.  The patch is attached in this mail.
>>
>> +Zhensong: is there any possibility to merge this patch for binutils
>> master and 2.39 release branch (including 2.38 release branch would be
>> even better) so at least glibc ifunc tests will be happy?
>>
>> 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/check-abi-libc
>> UNSUPPORTED: elf/tst-env-setuid
>> UNSUPPORTED: elf/tst-env-setuid-tunables
>> XPASS: elf/tst-protected1a
>> XPASS: elf/tst-protected1b
>> UNSUPPORTED: elf/tst-valgrind-smoke
>> 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-pthread-gdb-attach
>> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
>> UNSUPPORTED: nptl/tst-rseq-nptl
>> UNSUPPORTED: stdlib/tst-secure-getenv
>> UNSUPPORTED: time/tst-clock_settime
>> UNSUPPORTED: time/tst-settimeofday
>> Summary of test results:
>>        1 FAIL
>>     4576 PASS
>>       22 UNSUPPORTED
>>       12 XFAIL
>>        6 XPASS
> Overall this is looking good. Thanks for your testing.
  
Xi Ruoyao July 25, 2022, 8:28 a.m. UTC | #9
On Mon, 2022-07-25 at 16:21 +0800, caiyinyu wrote:
> Summary of test results:
>         1 FAIL
>      4576 PASS
>        22 UNSUPPORTED
>        12 XFAIL
>         6 XPASS
> Overall this is looking good. Thanks for your testing.
> 
> 
> So, is it necessary to release another version of v8??

I guess a v8 is better because the 17th patch (NEWS) needs a rebase
anyway.  But let's wait for Adhemerval's suggestion...
  
Adhemerval Zanella July 25, 2022, 1:27 p.m. UTC | #10
On 24/07/22 06:49, WANG Xuerui wrote:
> Hi,
> 
> On 7/19/22 09:20, caiyinyu wrote:
>> <snip>
>> 6. Test result: all passed (ifunc disable).
>>
>> Test with:
>>    Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
>>    glibc: https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7
>>
>> Result (ifunc disable):
>> 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
>> UNSUPPORTED: elf/tst-env-setuid
>> UNSUPPORTED: elf/tst-env-setuid-tunables
>> XPASS: elf/tst-protected1a
>> XPASS: elf/tst-protected1b
>> UNSUPPORTED: elf/tst-valgrind-smoke
>> 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-pthread-gdb-attach
>> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
>> UNSUPPORTED: nptl/tst-rseq-nptl
>> UNSUPPORTED: stdlib/tst-secure-getenv
>> UNSUPPORTED: time/tst-clock_settime
>> UNSUPPORTED: time/tst-settimeofday
>> Summary of test results:
>>     4535 PASS
>>       22 UNSUPPORTED
>>       12 XFAIL
>>        6 XPASS
> 
> Thanks for your effort these days. I ran the test on Gentoo and this is what I have found out:
> 
> UNSUPPORTED: crypt/cert
> FAIL: elf/check-abi-libc
> 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/ifuncmain2
> FAIL: elf/ifuncmain2pic
> FAIL: elf/ifuncmain3
> FAIL: elf/ifuncmain4
> FAIL: elf/ifuncmain5staticpic
> FAIL: elf/ifuncmain6pie
> FAIL: elf/ifuncmain7
> FAIL: elf/ifuncmain7pic
> FAIL: elf/ifuncmain7pie
> FAIL: elf/ifuncmain9
> FAIL: elf/ifuncmain9pic
> FAIL: elf/ifuncmain9pie
> UNSUPPORTED: elf/tst-env-setuid
> UNSUPPORTED: elf/tst-env-setuid-tunables
> FAIL: elf/tst-glibc-hwcaps-prepend-cache
> FAIL: elf/tst-ifunc-textrel
> FAIL: elf/tst-ldconfig-ld_so_conf-update
> XPASS: elf/tst-protected1a
> XPASS: elf/tst-protected1b
> UNSUPPORTED: elf/tst-valgrind-smoke
> FAIL: malloc/tst-free-errno-malloc-hugetlb1
> 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
> FAIL: nptl/tst-pthread-gdb-attach
> FAIL: nptl/tst-pthread-gdb-attach-static
> UNSUPPORTED: nptl/tst-rseq-nptl
> FAIL: nss/tst-nss-files-hosts-long
> UNSUPPORTED: resolv/tst-resolv-ai_idn
> UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
> UNSUPPORTED: stdlib/tst-secure-getenv
> UNSUPPORTED: time/tst-clock_settime
> UNSUPPORTED: time/tst-settimeofday
> 
> Of these, the ifunc failures are "expected" by you, the elf/check-abi-libc diff is trivial (maybe you just didn't rebase as frequently):
> 
> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 14:45:57.490029442 +0800
> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 13:44:10.416642655 +0800
> @@ -496 +496 @@ GLIBC_2.36 _mcount F
> -GLIBC_2.36 _nl_default_dirname D 0x12
> +GLIBC_2.36 _nl_default_dirname D 0x17
> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
> +GLIBC_2.36 arc4random F
> +GLIBC_2.36 arc4random_buf F
> +GLIBC_2.36 arc4random_uniform F
> 
> The others may need some love. Of course they're possibly because of my particular environment (Gentoo is a little bit different than "ordinary" distros like Debian/Fedora, and I already have to symlink the libgcc_s.so and libstdc++.so to pass the nptl tests at all).

The 'elf/tst-glibc-hwcaps-prepend-cache' and 'elf/tst-ldconfig-ld_so_conf-update',
might worth to take a look, although they are not arch-specific and I think it is
more related to the test environment.

Also, once you add the loongarch entry on release wiki [2], please the configure
options use to state ifunc needs to be explicit disabled.

> 
> Coming to code quality, there are obviously warts present, like the lingering uses of the name "x" for $r21 and apparent lack of assembly pseudo-insn sugar usages (e.g. no "move a, b" but always "or a, b, zero"; the code must be directly descended from an extremely early time when the assembler didn't have such support), but at this point these cosmetic concerns are better fixed after 2.36 to minimize churn prior to release. At a quick glance the ABI is looking good. (There is a certain "__x" in bits/setjmp.h meant to refer to r21, but __jmp_buf is not public API so I think we're safe here.)
> 
I agree that cosmetic issues should not interfere with loongarch64 addition, we
can backport if required (although for such changes I also do not see much
point).

I have create a branch which I think it is suitable for inclusion [1], I 
have fixed the ABI issue due arc4random addition and some style issues 
(trailing lines) that were triggering our pre-commit hooks..

> 
> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
> anyway.  But let's wait for Adhemerval's suggestion...

It is up to your, if you are ok with my fixed branch I can install otherwise
you send a v8.

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/loongarch64
[2] https://sourceware.org/glibc/wiki/Release/2.36
  
caiyinyu July 25, 2022, 2:14 p.m. UTC | #11
> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
> anyway.  But let's wait for Adhemerval's suggestion...

It is up to your, if you are ok with my fixed branch I can install otherwise
you send a v8.

--------------------

I checked and I'm ok with the fixed branch.

Waiting for other suggestions.

Thanks.



在 2022/7/25 下午9:27, Adhemerval Zanella Netto 写道:
>
> On 24/07/22 06:49, WANG Xuerui wrote:
>> Hi,
>>
>> On 7/19/22 09:20, caiyinyu wrote:
>>> <snip>
>>> 6. Test result: all passed (ifunc disable).
>>>
>>> Test with:
>>>     Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
>>>     glibc: https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7
>>>
>>> Result (ifunc disable):
>>> 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
>>> UNSUPPORTED: elf/tst-env-setuid
>>> UNSUPPORTED: elf/tst-env-setuid-tunables
>>> XPASS: elf/tst-protected1a
>>> XPASS: elf/tst-protected1b
>>> UNSUPPORTED: elf/tst-valgrind-smoke
>>> 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-pthread-gdb-attach
>>> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
>>> UNSUPPORTED: nptl/tst-rseq-nptl
>>> UNSUPPORTED: stdlib/tst-secure-getenv
>>> UNSUPPORTED: time/tst-clock_settime
>>> UNSUPPORTED: time/tst-settimeofday
>>> Summary of test results:
>>>      4535 PASS
>>>        22 UNSUPPORTED
>>>        12 XFAIL
>>>         6 XPASS
>> Thanks for your effort these days. I ran the test on Gentoo and this is what I have found out:
>>
>> UNSUPPORTED: crypt/cert
>> FAIL: elf/check-abi-libc
>> 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/ifuncmain2
>> FAIL: elf/ifuncmain2pic
>> FAIL: elf/ifuncmain3
>> FAIL: elf/ifuncmain4
>> FAIL: elf/ifuncmain5staticpic
>> FAIL: elf/ifuncmain6pie
>> FAIL: elf/ifuncmain7
>> FAIL: elf/ifuncmain7pic
>> FAIL: elf/ifuncmain7pie
>> FAIL: elf/ifuncmain9
>> FAIL: elf/ifuncmain9pic
>> FAIL: elf/ifuncmain9pie
>> UNSUPPORTED: elf/tst-env-setuid
>> UNSUPPORTED: elf/tst-env-setuid-tunables
>> FAIL: elf/tst-glibc-hwcaps-prepend-cache
>> FAIL: elf/tst-ifunc-textrel
>> FAIL: elf/tst-ldconfig-ld_so_conf-update
>> XPASS: elf/tst-protected1a
>> XPASS: elf/tst-protected1b
>> UNSUPPORTED: elf/tst-valgrind-smoke
>> FAIL: malloc/tst-free-errno-malloc-hugetlb1
>> 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
>> FAIL: nptl/tst-pthread-gdb-attach
>> FAIL: nptl/tst-pthread-gdb-attach-static
>> UNSUPPORTED: nptl/tst-rseq-nptl
>> FAIL: nss/tst-nss-files-hosts-long
>> UNSUPPORTED: resolv/tst-resolv-ai_idn
>> UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
>> UNSUPPORTED: stdlib/tst-secure-getenv
>> UNSUPPORTED: time/tst-clock_settime
>> UNSUPPORTED: time/tst-settimeofday
>>
>> Of these, the ifunc failures are "expected" by you, the elf/check-abi-libc diff is trivial (maybe you just didn't rebase as frequently):
>>
>> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 14:45:57.490029442 +0800
>> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 13:44:10.416642655 +0800
>> @@ -496 +496 @@ GLIBC_2.36 _mcount F
>> -GLIBC_2.36 _nl_default_dirname D 0x12
>> +GLIBC_2.36 _nl_default_dirname D 0x17
>> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
>> +GLIBC_2.36 arc4random F
>> +GLIBC_2.36 arc4random_buf F
>> +GLIBC_2.36 arc4random_uniform F
>>
>> The others may need some love. Of course they're possibly because of my particular environment (Gentoo is a little bit different than "ordinary" distros like Debian/Fedora, and I already have to symlink the libgcc_s.so and libstdc++.so to pass the nptl tests at all).
> The 'elf/tst-glibc-hwcaps-prepend-cache' and 'elf/tst-ldconfig-ld_so_conf-update',
> might worth to take a look, although they are not arch-specific and I think it is
> more related to the test environment.
>
> Also, once you add the loongarch entry on release wiki [2], please the configure
> options use to state ifunc needs to be explicit disabled.
>
>> Coming to code quality, there are obviously warts present, like the lingering uses of the name "x" for $r21 and apparent lack of assembly pseudo-insn sugar usages (e.g. no "move a, b" but always "or a, b, zero"; the code must be directly descended from an extremely early time when the assembler didn't have such support), but at this point these cosmetic concerns are better fixed after 2.36 to minimize churn prior to release. At a quick glance the ABI is looking good. (There is a certain "__x" in bits/setjmp.h meant to refer to r21, but __jmp_buf is not public API so I think we're safe here.)
>>
> I agree that cosmetic issues should not interfere with loongarch64 addition, we
> can backport if required (although for such changes I also do not see much
> point).
>
> I have create a branch which I think it is suitable for inclusion [1], I
> have fixed the ABI issue due arc4random addition and some style issues
> (trailing lines) that were triggering our pre-commit hooks..
>
>> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
>> anyway.  But let's wait for Adhemerval's suggestion...
> It is up to your, if you are ok with my fixed branch I can install otherwise
> you send a v8.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/loongarch64
> [2] https://sourceware.org/glibc/wiki/Release/2.36
  
caiyinyu July 26, 2022, 12:35 p.m. UTC | #12
Also, once you add the loongarch entry on release wiki [2], please the 
configure
options use to state ifunc needs to be explicit disabled.

---------

I have created an account (caiyinyu@loongson.cn) on glibc wiki and we 
need to participate in the wiki to edit loongarch parts.


在 2022/7/25 下午10:14, caiyinyu 写道:
>> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
>> anyway.  But let's wait for Adhemerval's suggestion...
>
> It is up to your, if you are ok with my fixed branch I can install 
> otherwise
> you send a v8.
>
> --------------------
>
> I checked and I'm ok with the fixed branch.
>
> Waiting for other suggestions.
>
> Thanks.
>
>
>
> 在 2022/7/25 下午9:27, Adhemerval Zanella Netto 写道:
>>
>> On 24/07/22 06:49, WANG Xuerui wrote:
>>> Hi,
>>>
>>> On 7/19/22 09:20, caiyinyu wrote:
>>>> <snip>
>>>> 6. Test result: all passed (ifunc disable).
>>>>
>>>> Test with:
>>>>     Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
>>>>     glibc: 
>>>> https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7
>>>>
>>>> Result (ifunc disable):
>>>> 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
>>>> UNSUPPORTED: elf/tst-env-setuid
>>>> UNSUPPORTED: elf/tst-env-setuid-tunables
>>>> XPASS: elf/tst-protected1a
>>>> XPASS: elf/tst-protected1b
>>>> UNSUPPORTED: elf/tst-valgrind-smoke
>>>> 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-pthread-gdb-attach
>>>> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
>>>> UNSUPPORTED: nptl/tst-rseq-nptl
>>>> UNSUPPORTED: stdlib/tst-secure-getenv
>>>> UNSUPPORTED: time/tst-clock_settime
>>>> UNSUPPORTED: time/tst-settimeofday
>>>> Summary of test results:
>>>>      4535 PASS
>>>>        22 UNSUPPORTED
>>>>        12 XFAIL
>>>>         6 XPASS
>>> Thanks for your effort these days. I ran the test on Gentoo and this 
>>> is what I have found out:
>>>
>>> UNSUPPORTED: crypt/cert
>>> FAIL: elf/check-abi-libc
>>> 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/ifuncmain2
>>> FAIL: elf/ifuncmain2pic
>>> FAIL: elf/ifuncmain3
>>> FAIL: elf/ifuncmain4
>>> FAIL: elf/ifuncmain5staticpic
>>> FAIL: elf/ifuncmain6pie
>>> FAIL: elf/ifuncmain7
>>> FAIL: elf/ifuncmain7pic
>>> FAIL: elf/ifuncmain7pie
>>> FAIL: elf/ifuncmain9
>>> FAIL: elf/ifuncmain9pic
>>> FAIL: elf/ifuncmain9pie
>>> UNSUPPORTED: elf/tst-env-setuid
>>> UNSUPPORTED: elf/tst-env-setuid-tunables
>>> FAIL: elf/tst-glibc-hwcaps-prepend-cache
>>> FAIL: elf/tst-ifunc-textrel
>>> FAIL: elf/tst-ldconfig-ld_so_conf-update
>>> XPASS: elf/tst-protected1a
>>> XPASS: elf/tst-protected1b
>>> UNSUPPORTED: elf/tst-valgrind-smoke
>>> FAIL: malloc/tst-free-errno-malloc-hugetlb1
>>> 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
>>> FAIL: nptl/tst-pthread-gdb-attach
>>> FAIL: nptl/tst-pthread-gdb-attach-static
>>> UNSUPPORTED: nptl/tst-rseq-nptl
>>> FAIL: nss/tst-nss-files-hosts-long
>>> UNSUPPORTED: resolv/tst-resolv-ai_idn
>>> UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
>>> UNSUPPORTED: stdlib/tst-secure-getenv
>>> UNSUPPORTED: time/tst-clock_settime
>>> UNSUPPORTED: time/tst-settimeofday
>>>
>>> Of these, the ifunc failures are "expected" by you, the 
>>> elf/check-abi-libc diff is trivial (maybe you just didn't rebase as 
>>> frequently):
>>>
>>> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 
>>> 2022-07-23 14:45:57.490029442 +0800
>>> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 
>>> 13:44:10.416642655 +0800
>>> @@ -496 +496 @@ GLIBC_2.36 _mcount F
>>> -GLIBC_2.36 _nl_default_dirname D 0x12
>>> +GLIBC_2.36 _nl_default_dirname D 0x17
>>> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
>>> +GLIBC_2.36 arc4random F
>>> +GLIBC_2.36 arc4random_buf F
>>> +GLIBC_2.36 arc4random_uniform F
>>>
>>> The others may need some love. Of course they're possibly because of 
>>> my particular environment (Gentoo is a little bit different than 
>>> "ordinary" distros like Debian/Fedora, and I already have to symlink 
>>> the libgcc_s.so and libstdc++.so to pass the nptl tests at all).
>> The 'elf/tst-glibc-hwcaps-prepend-cache' and 
>> 'elf/tst-ldconfig-ld_so_conf-update',
>> might worth to take a look, although they are not arch-specific and I 
>> think it is
>> more related to the test environment.
>>
>> Also, once you add the loongarch entry on release wiki [2], please 
>> the configure
>> options use to state ifunc needs to be explicit disabled.
>>
>>> Coming to code quality, there are obviously warts present, like the 
>>> lingering uses of the name "x" for $r21 and apparent lack of 
>>> assembly pseudo-insn sugar usages (e.g. no "move a, b" but always 
>>> "or a, b, zero"; the code must be directly descended from an 
>>> extremely early time when the assembler didn't have such support), 
>>> but at this point these cosmetic concerns are better fixed after 
>>> 2.36 to minimize churn prior to release. At a quick glance the ABI 
>>> is looking good. (There is a certain "__x" in bits/setjmp.h meant to 
>>> refer to r21, but __jmp_buf is not public API so I think we're safe 
>>> here.)
>>>
>> I agree that cosmetic issues should not interfere with loongarch64 
>> addition, we
>> can backport if required (although for such changes I also do not see 
>> much
>> point).
>>
>> I have create a branch which I think it is suitable for inclusion [1], I
>> have fixed the ABI issue due arc4random addition and some style issues
>> (trailing lines) that were triggering our pre-commit hooks..
>>
>>> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
>>> anyway.  But let's wait for Adhemerval's suggestion...
>> It is up to your, if you are ok with my fixed branch I can install 
>> otherwise
>> you send a v8.
>>
>> [1] 
>> https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/loongarch64
>> [2] https://sourceware.org/glibc/wiki/Release/2.36
  
Adhemerval Zanella July 26, 2022, 12:42 p.m. UTC | #13
Thanks, I will check with Carlos on how to give you write access.

I plan to install loongarch support today.

On 26/07/22 09:35, caiyinyu wrote:
> 
> Also, once you add the loongarch entry on release wiki [2], please the configure
> options use to state ifunc needs to be explicit disabled.
> 
> ---------
> 
> I have created an account (caiyinyu@loongson.cn) on glibc wiki and we need to participate in the wiki to edit loongarch parts.
> 
> 
> 在 2022/7/25 下午10:14, caiyinyu 写道:
>>> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
>>> anyway.  But let's wait for Adhemerval's suggestion...
>>
>> It is up to your, if you are ok with my fixed branch I can install otherwise
>> you send a v8.
>>
>> --------------------
>>
>> I checked and I'm ok with the fixed branch.
>>
>> Waiting for other suggestions.
>>
>> Thanks.
>>
>>
>>
>> 在 2022/7/25 下午9:27, Adhemerval Zanella Netto 写道:
>>>
>>> On 24/07/22 06:49, WANG Xuerui wrote:
>>>> Hi,
>>>>
>>>> On 7/19/22 09:20, caiyinyu wrote:
>>>>> <snip>
>>>>> 6. Test result: all passed (ifunc disable).
>>>>>
>>>>> Test with:
>>>>>     Linux-5.19-rc4, Binutils-2.38, and GCC-12.1.
>>>>>     glibc: https://github.com/loongson/glibc/tree/loongarch_2_36_upstream_v7
>>>>>
>>>>> Result (ifunc disable):
>>>>> 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
>>>>> UNSUPPORTED: elf/tst-env-setuid
>>>>> UNSUPPORTED: elf/tst-env-setuid-tunables
>>>>> XPASS: elf/tst-protected1a
>>>>> XPASS: elf/tst-protected1b
>>>>> UNSUPPORTED: elf/tst-valgrind-smoke
>>>>> 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-pthread-gdb-attach
>>>>> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
>>>>> UNSUPPORTED: nptl/tst-rseq-nptl
>>>>> UNSUPPORTED: stdlib/tst-secure-getenv
>>>>> UNSUPPORTED: time/tst-clock_settime
>>>>> UNSUPPORTED: time/tst-settimeofday
>>>>> Summary of test results:
>>>>>      4535 PASS
>>>>>        22 UNSUPPORTED
>>>>>        12 XFAIL
>>>>>         6 XPASS
>>>> Thanks for your effort these days. I ran the test on Gentoo and this is what I have found out:
>>>>
>>>> UNSUPPORTED: crypt/cert
>>>> FAIL: elf/check-abi-libc
>>>> 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/ifuncmain2
>>>> FAIL: elf/ifuncmain2pic
>>>> FAIL: elf/ifuncmain3
>>>> FAIL: elf/ifuncmain4
>>>> FAIL: elf/ifuncmain5staticpic
>>>> FAIL: elf/ifuncmain6pie
>>>> FAIL: elf/ifuncmain7
>>>> FAIL: elf/ifuncmain7pic
>>>> FAIL: elf/ifuncmain7pie
>>>> FAIL: elf/ifuncmain9
>>>> FAIL: elf/ifuncmain9pic
>>>> FAIL: elf/ifuncmain9pie
>>>> UNSUPPORTED: elf/tst-env-setuid
>>>> UNSUPPORTED: elf/tst-env-setuid-tunables
>>>> FAIL: elf/tst-glibc-hwcaps-prepend-cache
>>>> FAIL: elf/tst-ifunc-textrel
>>>> FAIL: elf/tst-ldconfig-ld_so_conf-update
>>>> XPASS: elf/tst-protected1a
>>>> XPASS: elf/tst-protected1b
>>>> UNSUPPORTED: elf/tst-valgrind-smoke
>>>> FAIL: malloc/tst-free-errno-malloc-hugetlb1
>>>> 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
>>>> FAIL: nptl/tst-pthread-gdb-attach
>>>> FAIL: nptl/tst-pthread-gdb-attach-static
>>>> UNSUPPORTED: nptl/tst-rseq-nptl
>>>> FAIL: nss/tst-nss-files-hosts-long
>>>> UNSUPPORTED: resolv/tst-resolv-ai_idn
>>>> UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
>>>> UNSUPPORTED: stdlib/tst-secure-getenv
>>>> UNSUPPORTED: time/tst-clock_settime
>>>> UNSUPPORTED: time/tst-settimeofday
>>>>
>>>> Of these, the ifunc failures are "expected" by you, the elf/check-abi-libc diff is trivial (maybe you just didn't rebase as frequently):
>>>>
>>>> --- ../sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist 2022-07-23 14:45:57.490029442 +0800
>>>> +++ /home/xenon/src/glibc/build/libc.symlist    2022-07-24 13:44:10.416642655 +0800
>>>> @@ -496 +496 @@ GLIBC_2.36 _mcount F
>>>> -GLIBC_2.36 _nl_default_dirname D 0x12
>>>> +GLIBC_2.36 _nl_default_dirname D 0x17
>>>> @@ -541,0 +542,3 @@ GLIBC_2.36 alphasort64 F
>>>> +GLIBC_2.36 arc4random F
>>>> +GLIBC_2.36 arc4random_buf F
>>>> +GLIBC_2.36 arc4random_uniform F
>>>>
>>>> The others may need some love. Of course they're possibly because of my particular environment (Gentoo is a little bit different than "ordinary" distros like Debian/Fedora, and I already have to symlink the libgcc_s.so and libstdc++.so to pass the nptl tests at all).
>>> The 'elf/tst-glibc-hwcaps-prepend-cache' and 'elf/tst-ldconfig-ld_so_conf-update',
>>> might worth to take a look, although they are not arch-specific and I think it is
>>> more related to the test environment.
>>>
>>> Also, once you add the loongarch entry on release wiki [2], please the configure
>>> options use to state ifunc needs to be explicit disabled.
>>>
>>>> Coming to code quality, there are obviously warts present, like the lingering uses of the name "x" for $r21 and apparent lack of assembly pseudo-insn sugar usages (e.g. no "move a, b" but always "or a, b, zero"; the code must be directly descended from an extremely early time when the assembler didn't have such support), but at this point these cosmetic concerns are better fixed after 2.36 to minimize churn prior to release. At a quick glance the ABI is looking good. (There is a certain "__x" in bits/setjmp.h meant to refer to r21, but __jmp_buf is not public API so I think we're safe here.)
>>>>
>>> I agree that cosmetic issues should not interfere with loongarch64 addition, we
>>> can backport if required (although for such changes I also do not see much
>>> point).
>>>
>>> I have create a branch which I think it is suitable for inclusion [1], I
>>> have fixed the ABI issue due arc4random addition and some style issues
>>> (trailing lines) that were triggering our pre-commit hooks..
>>>
>>>> I guess a v8 is better because the 17th patch (NEWS) needs a rebase
>>>> anyway.  But let's wait for Adhemerval's suggestion...
>>> It is up to your, if you are ok with my fixed branch I can install otherwise
>>> you send a v8.
>>>
>>> [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/loongarch64
>>> [2] https://sourceware.org/glibc/wiki/Release/2.36
>
  
Mark Wielaard July 26, 2022, 2 p.m. UTC | #14
On Tue, Jul 26, 2022 at 09:42:27AM -0300, Adhemerval Zanella Netto via Libc-alpha wrote:
> On 26/07/22 09:35, caiyinyu wrote:
> > I have created an account (caiyinyu@loongson.cn) on glibc wiki and
> > we need to participate in the wiki to edit loongarch parts.
> > 
> Thanks, I will check with Carlos on how to give you write access.

Someone with EditorGroup permissions needs to add the account to
https://sourceware.org/glibc/wiki/EditorGroup

Cheers,

Mark
  

Patch

diff --git a/sysdeps/loongarch/e_sqrtl.c b/sysdeps/loongarch/e_sqrtl.c
index 5eb8cc8adb..020c8911e6 100644
--- a/sysdeps/loongarch/e_sqrtl.c
+++ b/sysdeps/loongarch/e_sqrtl.c
@@ -19,6 +19,7 @@ 
 #include <stdlib.h>
 #include <soft-fp/soft-fp.h>
 #include <soft-fp/quad.h>
+#include <libm-alias-finite.h>
 
 long double
 __ieee754_sqrtl (const long double a)
@@ -35,4 +36,4 @@  __ieee754_sqrtl (const long double a)
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
-strong_alias (__ieee754_sqrtl, __sqrtl_finite)
+libm_alias_finite (__ieee754_sqrtl, __sqrtl)
diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
index 6ddb86edef..b3dbd00001 100644
--- a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist
@@ -17,7 +17,6 @@  GLIBC_2.36 __signbit F
 GLIBC_2.36 __signbitf F
 GLIBC_2.36 __signbitl F
 GLIBC_2.36 __signgam D 0x4
-GLIBC_2.36 __sqrtl_finite F
 GLIBC_2.36 acos F
 GLIBC_2.36 acosf F
 GLIBC_2.36 acosf128 F

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 9e7e360125..da9b905900 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -220,7 +220,7 @@  class Context(object):
                         binutils_cfg=['--enable-obsolete'])
         self.add_config(arch='loongarch64',
                         os_name='linux-gnu',
-                        variant='hard',
+                        variant='lp64d',
                         gcc_cfg=['--with-abi=lp64d','--disable-multilib'])
         self.add_config(arch='m68k',
                         os_name='linux-gnu',