Skip to contentSkip to conversation

OpenRISC port

PATCH New Stafford Horne 3 participants 11 messages May 22, 2020 – Jun 10, 2020 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

cover OpenRISC port

Hi All,

This is the patch for the OpenRISC port of glibc.

DEVELOPMENT

The original patch was put together by Christian Scensson a few years ago. I have taken the patch and finished all of the TODO items and run and fixed all of the test failures.

BUILDING and TESTING

Testing has been done with the qemu OpenRISC simulator using the build and run scripts found here:

- https://github.com/stffrdhrn/or1k-utils/tree/master/glibc

Running the tests I found a few issues with binutils, gcc and the OpenRISC architecture as well, patches for binutils are upstream and gcc should be upstream soon:

- Binutils: use latest master
- GCC: https://github.com/stffrdhrn/gcc/commits/or1k-glibc-1
- QEMU: https://github.com/stffrdhrn/qemu/commits/or1k-glibc (FPU issues)

TEST RESULTS

Pretty much all tests are passing however there are several math (fpu) tests which are failing due to issues with setting underflow/overflow flags. These seem consistent with issues reported by other architectures. Is there a known issue here?

I can provide more details.

-Stafford

Christian Svensson (1):
Initial support for OpenRISC

 elf/elf.h                                     |   37 +
 sysdeps/or1k/Implies                          |    4 +
 sysdeps/or1k/Makefile                         |    7 +
 sysdeps/or1k/__longjmp.S                      |   55 +
 sysdeps/or1k/atomic-machine.h                 |   77 +
 sysdeps/or1k/bits/atomic.h                    |   51 +
 sysdeps/or1k/bits/endianness.h                |   11 +
 sysdeps/or1k/bits/fenv.h                      |   79 +
 sysdeps/or1k/bits/link.h                      |   51 +
 sysdeps/or1k/bits/setjmp.h                    |   36 +
 sysdeps/or1k/bsd-_setjmp.S                    |    1 +
 sysdeps/or1k/bsd-setjmp.S                     |    1 +
 sysdeps/or1k/dl-machine.h                     |  339 +++
 sysdeps/or1k/dl-start.S                       |  101 +
 sysdeps/or1k/dl-tls.h                         |   28 +
 sysdeps/or1k/dl-trampoline.S                  |   82 +
 sysdeps/or1k/fpu/fclrexcpt.c                  |   41 +
 sysdeps/or1k/fpu/fegetenv.c                   |   32 +
 sysdeps/or1k/fpu/fegetmode.c                  |   27 +
 sysdeps/or1k/fpu/fegetround.c                 |   34 +
 sysdeps/or1k/fpu/feholdexcpt.c                |   41 +
 sysdeps/or1k/fpu/fesetenv.c                   |   35 +
 sysdeps/or1k/fpu/fesetexcept.c                |   32 +
 sysdeps/or1k/fpu/fesetmode.c                  |   42 +
 sysdeps/or1k/fpu/fesetround.c                 |   44 +
 sysdeps/or1k/fpu/feupdateenv.c                |   44 +
 sysdeps/or1k/fpu/fgetexcptflg.c               |   37 +
 sysdeps/or1k/fpu/fraiseexcpt.c                |   82 +
 sysdeps/or1k/fpu/fsetexcptflg.c               |   40 +
 sysdeps/or1k/fpu/ftestexcept.c                |   32 +
 sysdeps/or1k/fpu/get-rounding-mode.h          |   38 +
 sysdeps/or1k/fpu_control.h                    |   49 +
 sysdeps/or1k/jmpbuf-offsets.h                 |   23 +
 sysdeps/or1k/jmpbuf-unwind.h                  |   35 +
 sysdeps/or1k/ldsodefs.h                       |   40 +
 sysdeps/or1k/libc-tls.c                       |   32 +
 sysdeps/or1k/libm-test-ulps                   | 1107 +++++++++
 sysdeps/or1k/libm-test-ulps-name              |    1 +
 sysdeps/or1k/machine-gmon.h                   |   24 +
 sysdeps/or1k/math-tests-trap.h                |   27 +
 sysdeps/or1k/memusage.h                       |   20 +
 sysdeps/or1k/nofpu/Implies                    |    1 +
 sysdeps/or1k/nofpu/math-tests-exceptions.h    |   29 +
 sysdeps/or1k/nofpu/math-tests-rounding.h      |   28 +
 sysdeps/or1k/nptl/Makefile                    |   21 +
 sysdeps/or1k/nptl/bits/pthreadtypes-arch.h    |   48 +
 sysdeps/or1k/nptl/bits/semaphore.h            |   34 +
 sysdeps/or1k/nptl/pthreaddef.h                |   32 +
 sysdeps/or1k/nptl/tcb-offsets.sym             |    6 +
 sysdeps/or1k/nptl/tls.h                       |  193 ++
 sysdeps/or1k/preconfigure                     |   38 +
 sysdeps/or1k/setjmp.S                         |   56 +
 sysdeps/or1k/sfp-machine.h                    |  102 +
 sysdeps/or1k/sotruss-lib.c                    |   51 +
 sysdeps/or1k/stackinfo.h                      |   33 +
 sysdeps/or1k/start.S                          |  116 +
 sysdeps/or1k/sysdep.h                         |   77 +
 sysdeps/or1k/tininess.h                       |    1 +
 sysdeps/or1k/tls-macros.h                     |   82 +
 sysdeps/or1k/tst-audit.h                      |   24 +
 sysdeps/unix/sysv/linux/or1k/Implies          |    3 +
 sysdeps/unix/sysv/linux/or1k/Makefile         |   12 +
 sysdeps/unix/sysv/linux/or1k/arch-syscall.h   |  315 +++
 sysdeps/unix/sysv/linux/or1k/bits/fcntl.h     |   49 +
 sysdeps/unix/sysv/linux/or1k/bits/mman.h      |   44 +
 sysdeps/unix/sysv/linux/or1k/c++-types.data   |   67 +
 sysdeps/unix/sysv/linux/or1k/clone.c          |   59 +
 sysdeps/unix/sysv/linux/or1k/configure        |    4 +
 sysdeps/unix/sysv/linux/or1k/configure.ac     |    4 +
 sysdeps/unix/sysv/linux/or1k/getcontext.S     |   72 +
 sysdeps/unix/sysv/linux/or1k/ioctl.c          |   40 +
 sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h |   41 +
 .../unix/sysv/linux/or1k/kernel-features.h    |   24 +
 sysdeps/unix/sysv/linux/or1k/ld.abilist       |    5 +
 .../sysv/linux/or1k/libBrokenLocale.abilist   |    1 +
 sysdeps/unix/sysv/linux/or1k/libanl.abilist   |    4 +
 sysdeps/unix/sysv/linux/or1k/libc.abilist     | 2081 +++++++++++++++++
 sysdeps/unix/sysv/linux/or1k/libcrypt.abilist |    2 +
 sysdeps/unix/sysv/linux/or1k/libdl.abilist    |    9 +
 sysdeps/unix/sysv/linux/or1k/libm.abilist     |  699 ++++++
 sysdeps/unix/sysv/linux/or1k/libnsl.abilist   |  121 +
 .../unix/sysv/linux/or1k/libpthread.abilist   |  216 ++
 .../unix/sysv/linux/or1k/libresolv.abilist    |   79 +
 sysdeps/unix/sysv/linux/or1k/librt.abilist    |   35 +
 .../unix/sysv/linux/or1k/libthread_db.abilist |   40 +
 sysdeps/unix/sysv/linux/or1k/libutil.abilist  |    6 +
 sysdeps/unix/sysv/linux/or1k/localplt.data    |   13 +
 sysdeps/unix/sysv/linux/or1k/lowlevellock.h   |   23 +
 sysdeps/unix/sysv/linux/or1k/makecontext.c    |   77 +
 sysdeps/unix/sysv/linux/or1k/mmap_internal.h  |   29 +
 sysdeps/unix/sysv/linux/or1k/or1k_clone.S     |  112 +
 sysdeps/unix/sysv/linux/or1k/prctl.c          |   41 +
 sysdeps/unix/sysv/linux/or1k/pt-vfork.c       |   30 +
 sysdeps/unix/sysv/linux/or1k/setcontext.S     |  110 +
 sysdeps/unix/sysv/linux/or1k/shlib-versions   |    2 +
 sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h |   28 +
 sysdeps/unix/sysv/linux/or1k/swapcontext.S    |  116 +
 sysdeps/unix/sysv/linux/or1k/sys/procfs.h     |  120 +
 sysdeps/unix/sysv/linux/or1k/sys/ucontext.h   |   48 +
 sysdeps/unix/sysv/linux/or1k/sys/user.h       |    1 +
 sysdeps/unix/sysv/linux/or1k/syscall.c        |   45 +
 sysdeps/unix/sysv/linux/or1k/sysdep.c         |   33 +
 sysdeps/unix/sysv/linux/or1k/sysdep.h         |  167 ++
 sysdeps/unix/sysv/linux/or1k/ucontext_i.sym   |   26 +
 sysdeps/unix/sysv/linux/syscall-names.list    |    1 +
 105 files changed, 8945 insertions(+)
 create mode 100644 sysdeps/or1k/Implies
 create mode 100644 sysdeps/or1k/Makefile
 create mode 100644 sysdeps/or1k/__longjmp.S
 create mode 100644 sysdeps/or1k/atomic-machine.h
 create mode 100644 sysdeps/or1k/bits/atomic.h
 create mode 100644 sysdeps/or1k/bits/endianness.h
 create mode 100644 sysdeps/or1k/bits/fenv.h
 create mode 100644 sysdeps/or1k/bits/link.h
 create mode 100644 sysdeps/or1k/bits/setjmp.h
 create mode 100644 sysdeps/or1k/bsd-_setjmp.S
 create mode 100644 sysdeps/or1k/bsd-setjmp.S
 create mode 100644 sysdeps/or1k/dl-machine.h
 create mode 100644 sysdeps/or1k/dl-start.S
 create mode 100644 sysdeps/or1k/dl-tls.h
 create mode 100644 sysdeps/or1k/dl-trampoline.S
 create mode 100644 sysdeps/or1k/fpu/fclrexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fegetenv.c
 create mode 100644 sysdeps/or1k/fpu/fegetmode.c
 create mode 100644 sysdeps/or1k/fpu/fegetround.c
 create mode 100644 sysdeps/or1k/fpu/feholdexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fesetenv.c
 create mode 100644 sysdeps/or1k/fpu/fesetexcept.c
 create mode 100644 sysdeps/or1k/fpu/fesetmode.c
 create mode 100644 sysdeps/or1k/fpu/fesetround.c
 create mode 100644 sysdeps/or1k/fpu/feupdateenv.c
 create mode 100644 sysdeps/or1k/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/or1k/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/or1k/fpu/ftestexcept.c
 create mode 100644 sysdeps/or1k/fpu/get-rounding-mode.h
 create mode 100644 sysdeps/or1k/fpu_control.h
 create mode 100644 sysdeps/or1k/jmpbuf-offsets.h
 create mode 100644 sysdeps/or1k/jmpbuf-unwind.h
 create mode 100644 sysdeps/or1k/ldsodefs.h
 create mode 100644 sysdeps/or1k/libc-tls.c
 create mode 100644 sysdeps/or1k/libm-test-ulps
 create mode 100644 sysdeps/or1k/libm-test-ulps-name
 create mode 100644 sysdeps/or1k/machine-gmon.h
 create mode 100644 sysdeps/or1k/math-tests-trap.h
 create mode 100644 sysdeps/or1k/memusage.h
 create mode 100644 sysdeps/or1k/nofpu/Implies
 create mode 100644 sysdeps/or1k/nofpu/math-tests-exceptions.h
 create mode 100644 sysdeps/or1k/nofpu/math-tests-rounding.h
 create mode 100644 sysdeps/or1k/nptl/Makefile
 create mode 100644 sysdeps/or1k/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/or1k/nptl/bits/semaphore.h
 create mode 100644 sysdeps/or1k/nptl/pthreaddef.h
 create mode 100644 sysdeps/or1k/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/or1k/nptl/tls.h
 create mode 100644 sysdeps/or1k/preconfigure
 create mode 100644 sysdeps/or1k/setjmp.S
 create mode 100644 sysdeps/or1k/sfp-machine.h
 create mode 100644 sysdeps/or1k/sotruss-lib.c
 create mode 100644 sysdeps/or1k/stackinfo.h
 create mode 100644 sysdeps/or1k/start.S
 create mode 100644 sysdeps/or1k/sysdep.h
 create mode 100644 sysdeps/or1k/tininess.h
 create mode 100644 sysdeps/or1k/tls-macros.h
 create mode 100644 sysdeps/or1k/tst-audit.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/Implies
 create mode 100644 sysdeps/unix/sysv/linux/or1k/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/or1k/arch-syscall.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/fcntl.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/mman.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/or1k/clone.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/configure
 create mode 100644 sysdeps/unix/sysv/linux/or1k/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/or1k/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ioctl.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libnsl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/localplt.data
 create mode 100644 sysdeps/unix/sysv/linux/or1k/lowlevellock.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/mmap_internal.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/or1k_clone.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/prctl.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/pt-vfork.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/syscall.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ucontext_i.sym
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 Initial support for OpenRISC

From: Christian Svensson <[email protected]>

This patch includes the OpenRISC glibc support for linux.

YYYY-MM-DD Stafford Horne <[email protected]>
Christian Svensson <[email protected]>

* elf/elf.h: Add OpenRISC relocations.
* sysdeps/or1k/Implies: New file.
* sysdeps/or1k/Makefile: New file.
* sysdeps/or1k/__longjmp.S: New file.
* sysdeps/or1k/atomic-machine.h: New file.
* sysdeps/or1k/bits/atomic.h: New file.
* sysdeps/or1k/bits/endianness.h: New file.
* sysdeps/or1k/bits/fenv.h: New file.
* sysdeps/or1k/bits/link.h: New file.
* sysdeps/or1k/bits/setjmp.h: New file.
* sysdeps/or1k/bsd-_setjmp.S: New file.
* sysdeps/or1k/bsd-setjmp.S: New file.
* sysdeps/or1k/dl-machine.h: New file.
* sysdeps/or1k/dl-start.S: New file.
* sysdeps/or1k/dl-tls.h: New file.
* sysdeps/or1k/dl-trampoline.S: New file.
* sysdeps/or1k/fpu/fclrexcpt.c: New file.
* sysdeps/or1k/fpu/fegetenv.c: New file.
* sysdeps/or1k/fpu/fegetmode.c: New file.
* sysdeps/or1k/fpu/fegetround.c: New file.
* sysdeps/or1k/fpu/feholdexcpt.c: New file.
* sysdeps/or1k/fpu/fesetenv.c: New file.
* sysdeps/or1k/fpu/fesetexcept.c: New file.
* sysdeps/or1k/fpu/fesetmode.c: New file.
* sysdeps/or1k/fpu/fesetround.c: New file.
* sysdeps/or1k/fpu/feupdateenv.c: New file.
* sysdeps/or1k/fpu/fgetexcptflg.c: New file.
* sysdeps/or1k/fpu/fraiseexcpt.c: New file.
* sysdeps/or1k/fpu/fsetexcptflg.c: New file.
* sysdeps/or1k/fpu/ftestexcept.c: New file.
* sysdeps/or1k/fpu/get-rounding-mode.h: New file.
* sysdeps/or1k/fpu_control.h: New file.
* sysdeps/or1k/jmpbuf-offsets.h: New file.
* sysdeps/or1k/jmpbuf-unwind.h: New file.
* sysdeps/or1k/ldsodefs.h: New file.
* sysdeps/or1k/libc-tls.c: New file.
* sysdeps/or1k/libm-test-ulps: New file.
* sysdeps/or1k/libm-test-ulps-name: New file.
* sysdeps/or1k/machine-gmon.h: New file.
* sysdeps/or1k/math-tests-trap.h: New file.
* sysdeps/or1k/memusage.h: New file.
* sysdeps/or1k/nofpu/Implies: New file.
* sysdeps/or1k/nofpu/math-tests-exceptions.h: New file.
* sysdeps/or1k/nofpu/math-tests-rounding.h: New file.
* sysdeps/or1k/nptl/Makefile: New file.
* sysdeps/or1k/nptl/bits/pthreadtypes-arch.h: New file.
* sysdeps/or1k/nptl/bits/semaphore.h: New file.
* sysdeps/or1k/nptl/pthreaddef.h: New file.
* sysdeps/or1k/nptl/tcb-offsets.sym: New file.
* sysdeps/or1k/nptl/tls.h: New file.
* sysdeps/or1k/preconfigure: New file.
* sysdeps/or1k/setjmp.S: New file.
* sysdeps/or1k/sfp-machine.h: New file.
* sysdeps/or1k/sotruss-lib.c: New file.
* sysdeps/or1k/stackinfo.h: New file.
* sysdeps/or1k/start.S: New file.
* sysdeps/or1k/sysdep.h: New file.
* sysdeps/or1k/tininess.h: New file.
* sysdeps/or1k/tls-macros.h: New file.
* sysdeps/or1k/tst-audit.h: New file.
* sysdeps/unix/sysv/linux/or1k/Implies: New file.
* sysdeps/unix/sysv/linux/or1k/Makefile: New file.
* sysdeps/unix/sysv/linux/or1k/arch-syscall.h: New file.
* sysdeps/unix/sysv/linux/or1k/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/or1k/bits/mman.h: New file.
* sysdeps/unix/sysv/linux/or1k/c++-types.data: New file.
* sysdeps/unix/sysv/linux/or1k/clone.c: New file.
* sysdeps/unix/sysv/linux/or1k/configure: New file.
* sysdeps/unix/sysv/linux/or1k/configure.ac: New file.
* sysdeps/unix/sysv/linux/or1k/getcontext.S: New file.
* sysdeps/unix/sysv/linux/or1k/ioctl.c: New file.
* sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h: New file.
* sysdeps/unix/sysv/linux/or1k/kernel-features.h: New file.
* sysdeps/unix/sysv/linux/or1k/ld.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libanl.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libc.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libcrypt.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libdl.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libm.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libnsl.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libpthread.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libresolv.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/librt.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libthread_db.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/libutil.abilist: New file.
* sysdeps/unix/sysv/linux/or1k/localplt.data: New file.
* sysdeps/unix/sysv/linux/or1k/lowlevellock.h: New file.
* sysdeps/unix/sysv/linux/or1k/makecontext.c: New file.
* sysdeps/unix/sysv/linux/or1k/mmap_internal.h: New file.
* sysdeps/unix/sysv/linux/or1k/or1k_clone.S: New file.
* sysdeps/unix/sysv/linux/or1k/prctl.c: New file.
* sysdeps/unix/sysv/linux/or1k/pt-vfork.c: New file.
* sysdeps/unix/sysv/linux/or1k/setcontext.S: New file.
* sysdeps/unix/sysv/linux/or1k/shlib-versions: New file.
* sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h: New file.
* sysdeps/unix/sysv/linux/or1k/swapcontext.S: New file.
* sysdeps/unix/sysv/linux/or1k/sys/procfs.h: New file.
* sysdeps/unix/sysv/linux/or1k/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/or1k/sys/user.h: New file.
* sysdeps/unix/sysv/linux/or1k/syscall.c: New file.
* sysdeps/unix/sysv/linux/or1k/sysdep.c: New file.
* sysdeps/unix/sysv/linux/or1k/sysdep.h: New file.
* sysdeps/unix/sysv/linux/or1k/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/syscall-names.list: New file.

---
 elf/elf.h                                     |   37 +
 sysdeps/or1k/Implies                          |    4 +
 sysdeps/or1k/Makefile                         |    7 +
 sysdeps/or1k/__longjmp.S                      |   55 +
 sysdeps/or1k/atomic-machine.h                 |   77 +
 sysdeps/or1k/bits/atomic.h                    |   51 +
 sysdeps/or1k/bits/endianness.h                |   11 +
 sysdeps/or1k/bits/fenv.h                      |   79 +
 sysdeps/or1k/bits/link.h                      |   51 +
 sysdeps/or1k/bits/setjmp.h                    |   36 +
 sysdeps/or1k/bsd-_setjmp.S                    |    1 +
 sysdeps/or1k/bsd-setjmp.S                     |    1 +
 sysdeps/or1k/dl-machine.h                     |  339 +++
 sysdeps/or1k/dl-start.S                       |  101 +
 sysdeps/or1k/dl-tls.h                         |   28 +
 sysdeps/or1k/dl-trampoline.S                  |   82 +
 sysdeps/or1k/fpu/fclrexcpt.c                  |   41 +
 sysdeps/or1k/fpu/fegetenv.c                   |   32 +
 sysdeps/or1k/fpu/fegetmode.c                  |   27 +
 sysdeps/or1k/fpu/fegetround.c                 |   34 +
 sysdeps/or1k/fpu/feholdexcpt.c                |   41 +
 sysdeps/or1k/fpu/fesetenv.c                   |   35 +
 sysdeps/or1k/fpu/fesetexcept.c                |   32 +
 sysdeps/or1k/fpu/fesetmode.c                  |   42 +
 sysdeps/or1k/fpu/fesetround.c                 |   44 +
 sysdeps/or1k/fpu/feupdateenv.c                |   44 +
 sysdeps/or1k/fpu/fgetexcptflg.c               |   37 +
 sysdeps/or1k/fpu/fraiseexcpt.c                |   82 +
 sysdeps/or1k/fpu/fsetexcptflg.c               |   40 +
 sysdeps/or1k/fpu/ftestexcept.c                |   32 +
 sysdeps/or1k/fpu/get-rounding-mode.h          |   38 +
 sysdeps/or1k/fpu_control.h                    |   49 +
 sysdeps/or1k/jmpbuf-offsets.h                 |   23 +
 sysdeps/or1k/jmpbuf-unwind.h                  |   35 +
 sysdeps/or1k/ldsodefs.h                       |   40 +
 sysdeps/or1k/libc-tls.c                       |   32 +
 sysdeps/or1k/libm-test-ulps                   | 1107 +++++++++
 sysdeps/or1k/libm-test-ulps-name              |    1 +
 sysdeps/or1k/machine-gmon.h                   |   24 +
 sysdeps/or1k/math-tests-trap.h                |   27 +
 sysdeps/or1k/memusage.h                       |   20 +
 sysdeps/or1k/nofpu/Implies                    |    1 +
 sysdeps/or1k/nofpu/math-tests-exceptions.h    |   29 +
 sysdeps/or1k/nofpu/math-tests-rounding.h      |   28 +
 sysdeps/or1k/nptl/Makefile                    |   21 +
 sysdeps/or1k/nptl/bits/pthreadtypes-arch.h    |   48 +
 sysdeps/or1k/nptl/bits/semaphore.h            |   34 +
 sysdeps/or1k/nptl/pthreaddef.h                |   32 +
 sysdeps/or1k/nptl/tcb-offsets.sym             |    6 +
 sysdeps/or1k/nptl/tls.h                       |  193 ++
 sysdeps/or1k/preconfigure                     |   38 +
 sysdeps/or1k/setjmp.S                         |   56 +
 sysdeps/or1k/sfp-machine.h                    |  102 +
 sysdeps/or1k/sotruss-lib.c                    |   51 +
 sysdeps/or1k/stackinfo.h                      |   33 +
 sysdeps/or1k/start.S                          |  116 +
 sysdeps/or1k/sysdep.h                         |   77 +
 sysdeps/or1k/tininess.h                       |    1 +
 sysdeps/or1k/tls-macros.h                     |   82 +
 sysdeps/or1k/tst-audit.h                      |   24 +
 sysdeps/unix/sysv/linux/or1k/Implies          |    3 +
 sysdeps/unix/sysv/linux/or1k/Makefile         |   12 +
 sysdeps/unix/sysv/linux/or1k/arch-syscall.h   |  315 +++
 sysdeps/unix/sysv/linux/or1k/bits/fcntl.h     |   49 +
 sysdeps/unix/sysv/linux/or1k/bits/mman.h      |   44 +
 sysdeps/unix/sysv/linux/or1k/c++-types.data   |   67 +
 sysdeps/unix/sysv/linux/or1k/clone.c          |   59 +
 sysdeps/unix/sysv/linux/or1k/configure        |    4 +
 sysdeps/unix/sysv/linux/or1k/configure.ac     |    4 +
 sysdeps/unix/sysv/linux/or1k/getcontext.S     |   72 +
 sysdeps/unix/sysv/linux/or1k/ioctl.c          |   40 +
 sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h |   41 +
 .../unix/sysv/linux/or1k/kernel-features.h    |   24 +
 sysdeps/unix/sysv/linux/or1k/ld.abilist       |    5 +
 .../sysv/linux/or1k/libBrokenLocale.abilist   |    1 +
 sysdeps/unix/sysv/linux/or1k/libanl.abilist   |    4 +
 sysdeps/unix/sysv/linux/or1k/libc.abilist     | 2081 +++++++++++++++++
 sysdeps/unix/sysv/linux/or1k/libcrypt.abilist |    2 +
 sysdeps/unix/sysv/linux/or1k/libdl.abilist    |    9 +
 sysdeps/unix/sysv/linux/or1k/libm.abilist     |  699 ++++++
 sysdeps/unix/sysv/linux/or1k/libnsl.abilist   |  121 +
 .../unix/sysv/linux/or1k/libpthread.abilist   |  216 ++
 .../unix/sysv/linux/or1k/libresolv.abilist    |   79 +
 sysdeps/unix/sysv/linux/or1k/librt.abilist    |   35 +
 .../unix/sysv/linux/or1k/libthread_db.abilist |   40 +
 sysdeps/unix/sysv/linux/or1k/libutil.abilist  |    6 +
 sysdeps/unix/sysv/linux/or1k/localplt.data    |   13 +
 sysdeps/unix/sysv/linux/or1k/lowlevellock.h   |   23 +
 sysdeps/unix/sysv/linux/or1k/makecontext.c    |   77 +
 sysdeps/unix/sysv/linux/or1k/mmap_internal.h  |   29 +
 sysdeps/unix/sysv/linux/or1k/or1k_clone.S     |  112 +
 sysdeps/unix/sysv/linux/or1k/prctl.c          |   41 +
 sysdeps/unix/sysv/linux/or1k/pt-vfork.c       |   30 +
 sysdeps/unix/sysv/linux/or1k/setcontext.S     |  110 +
 sysdeps/unix/sysv/linux/or1k/shlib-versions   |    2 +
 sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h |   28 +
 sysdeps/unix/sysv/linux/or1k/swapcontext.S    |  116 +
 sysdeps/unix/sysv/linux/or1k/sys/procfs.h     |  120 +
 sysdeps/unix/sysv/linux/or1k/sys/ucontext.h   |   48 +
 sysdeps/unix/sysv/linux/or1k/sys/user.h       |    1 +
 sysdeps/unix/sysv/linux/or1k/syscall.c        |   45 +
 sysdeps/unix/sysv/linux/or1k/sysdep.c         |   33 +
 sysdeps/unix/sysv/linux/or1k/sysdep.h         |  167 ++
 sysdeps/unix/sysv/linux/or1k/ucontext_i.sym   |   26 +
 sysdeps/unix/sysv/linux/syscall-names.list    |    1 +
 105 files changed, 8945 insertions(+)
 create mode 100644 sysdeps/or1k/Implies
 create mode 100644 sysdeps/or1k/Makefile
 create mode 100644 sysdeps/or1k/__longjmp.S
 create mode 100644 sysdeps/or1k/atomic-machine.h
 create mode 100644 sysdeps/or1k/bits/atomic.h
 create mode 100644 sysdeps/or1k/bits/endianness.h
 create mode 100644 sysdeps/or1k/bits/fenv.h
 create mode 100644 sysdeps/or1k/bits/link.h
 create mode 100644 sysdeps/or1k/bits/setjmp.h
 create mode 100644 sysdeps/or1k/bsd-_setjmp.S
 create mode 100644 sysdeps/or1k/bsd-setjmp.S
 create mode 100644 sysdeps/or1k/dl-machine.h
 create mode 100644 sysdeps/or1k/dl-start.S
 create mode 100644 sysdeps/or1k/dl-tls.h
 create mode 100644 sysdeps/or1k/dl-trampoline.S
 create mode 100644 sysdeps/or1k/fpu/fclrexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fegetenv.c
 create mode 100644 sysdeps/or1k/fpu/fegetmode.c
 create mode 100644 sysdeps/or1k/fpu/fegetround.c
 create mode 100644 sysdeps/or1k/fpu/feholdexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fesetenv.c
 create mode 100644 sysdeps/or1k/fpu/fesetexcept.c
 create mode 100644 sysdeps/or1k/fpu/fesetmode.c
 create mode 100644 sysdeps/or1k/fpu/fesetround.c
 create mode 100644 sysdeps/or1k/fpu/feupdateenv.c
 create mode 100644 sysdeps/or1k/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/or1k/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/or1k/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/or1k/fpu/ftestexcept.c
 create mode 100644 sysdeps/or1k/fpu/get-rounding-mode.h
 create mode 100644 sysdeps/or1k/fpu_control.h
 create mode 100644 sysdeps/or1k/jmpbuf-offsets.h
 create mode 100644 sysdeps/or1k/jmpbuf-unwind.h
 create mode 100644 sysdeps/or1k/ldsodefs.h
 create mode 100644 sysdeps/or1k/libc-tls.c
 create mode 100644 sysdeps/or1k/libm-test-ulps
 create mode 100644 sysdeps/or1k/libm-test-ulps-name
 create mode 100644 sysdeps/or1k/machine-gmon.h
 create mode 100644 sysdeps/or1k/math-tests-trap.h
 create mode 100644 sysdeps/or1k/memusage.h
 create mode 100644 sysdeps/or1k/nofpu/Implies
 create mode 100644 sysdeps/or1k/nofpu/math-tests-exceptions.h
 create mode 100644 sysdeps/or1k/nofpu/math-tests-rounding.h
 create mode 100644 sysdeps/or1k/nptl/Makefile
 create mode 100644 sysdeps/or1k/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/or1k/nptl/bits/semaphore.h
 create mode 100644 sysdeps/or1k/nptl/pthreaddef.h
 create mode 100644 sysdeps/or1k/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/or1k/nptl/tls.h
 create mode 100644 sysdeps/or1k/preconfigure
 create mode 100644 sysdeps/or1k/setjmp.S
 create mode 100644 sysdeps/or1k/sfp-machine.h
 create mode 100644 sysdeps/or1k/sotruss-lib.c
 create mode 100644 sysdeps/or1k/stackinfo.h
 create mode 100644 sysdeps/or1k/start.S
 create mode 100644 sysdeps/or1k/sysdep.h
 create mode 100644 sysdeps/or1k/tininess.h
 create mode 100644 sysdeps/or1k/tls-macros.h
 create mode 100644 sysdeps/or1k/tst-audit.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/Implies
 create mode 100644 sysdeps/unix/sysv/linux/or1k/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/or1k/arch-syscall.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/fcntl.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/mman.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/or1k/clone.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/configure
 create mode 100644 sysdeps/unix/sysv/linux/or1k/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/or1k/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ioctl.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libnsl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/or1k/localplt.data
 create mode 100644 sysdeps/unix/sysv/linux/or1k/lowlevellock.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/mmap_internal.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/or1k_clone.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/prctl.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/pt-vfork.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/syscall.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.c
 create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/or1k/ucontext_i.sym
elf/elf.h +37 -0
index 51e9968405..1e8a8e74c4 100644
@@ -4096,6 +4096,43 @@ enum
 #define R_ARC_TLS_LE_S9		0x4a
 #define R_ARC_TLS_LE_32		0x4b
 
+/* OpenRISC 1000 specific relocs.  */
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
 __END_DECLS
 
 #endif	/* elf.h */
sysdeps/or1k/Implies new file +4 -0
new file mode 100644
index 0000000000..ff699c7dd5
@@ -0,0 +1,4 @@
+init_array
+wordsize-32
+ieee754/dbl-64
+ieee754/flt-32
sysdeps/or1k/Makefile new file +7 -0
new file mode 100644
index 0000000000..0241a0587e
@@ -0,0 +1,7 @@
+ASFLAGS-.os += -fPIC
+
+ifeq ($(subdir),elf)
+# Extra shared linker files to link only into dl-allobjs.so.
+sysdep-rtld-routines += dl-start
+endif
+
sysdeps/or1k/__longjmp.S new file +55 -0

55 lines not on this page · raw message

sysdeps/or1k/atomic-machine.h new file +77 -0

77 lines not on this page · raw message

sysdeps/or1k/bits/atomic.h new file +51 -0

51 lines not on this page · raw message

sysdeps/or1k/bits/endianness.h new file +11 -0
new file mode 100644
index 0000000000..96fd5ae5ef
@@ -0,0 +1,11 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
+#endif
+
+/* HP-PA is big-endian.  */
+#define __BYTE_ORDER __BIG_ENDIAN
+
+#endif /* bits/endianness.h */
sysdeps/or1k/bits/fenv.h new file +79 -0

79 lines not on this page · raw message

sysdeps/or1k/bits/link.h new file +51 -0

51 lines not on this page · raw message

sysdeps/or1k/bits/setjmp.h new file +36 -0
new file mode 100644
index 0000000000..dd07fce68c
@@ -0,0 +1,36 @@
+/* Define the machine-dependent type `jmp_buf'.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+#ifndef _OR1K_BITS_SETJMP_H
+#define _OR1K_BITS_SETJMP_H  1
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#if defined __USE_MISC || defined _ASM
+# define JB_SP     0  /* GPR1 */
+#endif
+
+#ifndef _ASM
+typedef long int __jmp_buf[13];
+#endif
+
+#endif /* _OR1K_BITS_SETJMP_H */
sysdeps/or1k/bsd-_setjmp.S new file +1 -0
new file mode 100644
index 0000000000..4e6a2da560
@@ -0,0 +1 @@
+/* _setjmp is in setjmp.S  */
sysdeps/or1k/bsd-setjmp.S new file +1 -0
new file mode 100644
index 0000000000..1da848d2f1
@@ -0,0 +1 @@
+/* setjmp is in setjmp.S  */
sysdeps/or1k/dl-machine.h new file +339 -0

339 lines not on this page · raw message

sysdeps/or1k/dl-start.S new file +101 -0

101 lines not on this page · raw message

sysdeps/or1k/dl-tls.h new file +28 -0
new file mode 100644
index 0000000000..105dd575e1
@@ -0,0 +1,28 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Type used for the representation of TLS information in the GOT.  */
+typedef struct
+{
+  unsigned long int ti_module;
+  unsigned long int ti_offset;
+} tls_index;
+
+
+extern void *__tls_get_addr (tls_index *ti);
+
sysdeps/or1k/dl-trampoline.S new file +82 -0

82 lines not on this page · raw message

sysdeps/or1k/fpu/fclrexcpt.c new file +41 -0

41 lines not on this page · raw message

sysdeps/or1k/fpu/fegetenv.c new file +32 -0
new file mode 100644
index 0000000000..c15c733ed4
@@ -0,0 +1,32 @@
+/* Store current floating-point environment.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+  _FPU_GETCW (*envp);
+
+  /* Success.  */
+  return 0;
+}
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
sysdeps/or1k/fpu/fegetmode.c new file +27 -0
new file mode 100644
index 0000000000..b20c551b0a
@@ -0,0 +1,27 @@
+/* Store current floating-point control modes.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fegetmode (femode_t *modep)
+{
+  _FPU_GETCW (*modep);
+  return 0;
+}
sysdeps/or1k/fpu/fegetround.c new file +34 -0
new file mode 100644
index 0000000000..de34c247cb
@@ -0,0 +1,34 @@
+/* Return current rounding direction.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fegetround (void)
+{
+  fpu_control_t cw;
+
+  /* Get control word.  */
+  _FPU_GETCW (cw);
+
+  return cw & (0x3 << 1);
+}
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
sysdeps/or1k/fpu/feholdexcpt.c new file +41 -0

41 lines not on this page · raw message

sysdeps/or1k/fpu/fesetenv.c new file +35 -0
new file mode 100644
index 0000000000..1fe7230c58
@@ -0,0 +1,35 @@
+/* Install given floating-point environment.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+  if (envp == FE_DFL_ENV)
+    _FPU_SETCW (_FPU_DEFAULT);
+  else
+    _FPU_SETCW (*envp);
+
+  /* Success.  */
+  return 0;
+}
+libm_hidden_def (__fesetenv)
+weak_alias (__fesetenv, fesetenv)
+libm_hidden_weak (fesetenv)
sysdeps/or1k/fpu/fesetexcept.c new file +32 -0
new file mode 100644
index 0000000000..192e92bbca
@@ -0,0 +1,32 @@
+/* Set given exception flags.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetexcept (int excepts)
+{
+  fpu_control_t cw;
+
+  _FPU_GETCW (cw);
+  cw |= excepts & FE_ALL_EXCEPT;
+  _FPU_SETCW (cw);
+
+  return 0;
+}
sysdeps/or1k/fpu/fesetmode.c new file +42 -0

42 lines not on this page · raw message

sysdeps/or1k/fpu/fesetround.c new file +44 -0

44 lines not on this page · raw message

sysdeps/or1k/fpu/feupdateenv.c new file +44 -0

44 lines not on this page · raw message

sysdeps/or1k/fpu/fgetexcptflg.c new file +37 -0
new file mode 100644
index 0000000000..320ea08547
@@ -0,0 +1,37 @@
+/* Store current representation for exceptions.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+  fpu_control_t temp;
+
+  /* Get the current exceptions.  */
+  _FPU_GETCW (temp);
+
+  /* We only save the relevant bits here. In particular, care has to be
+     taken with the CAUSE bits, as an inadvertent restore later on could
+     generate unexpected exceptions.  */
+  *flagp = temp & excepts & FE_ALL_EXCEPT;
+
+  /* Success.  */
+  return 0;
+}
sysdeps/or1k/fpu/fraiseexcpt.c new file +82 -0

82 lines not on this page · raw message

sysdeps/or1k/fpu/fsetexcptflg.c new file +40 -0
new file mode 100644
index 0000000000..641eba2a0e
@@ -0,0 +1,40 @@
+/* Set floating-point environment exception handling.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+  fpu_control_t temp;
+
+  /* Get the current exceptions.  */
+  _FPU_GETCW (temp);
+
+  /* Make sure the flags we want restored are legal.  */
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Now clear the bits called for, and copy them in from flagp. Note that
+     we ignore all non-flag bits from *flagp, so they don't matter.  */
+  temp = (temp & ~excepts) | (*flagp & excepts);
+
+  _FPU_SETCW (temp);
+
+  return 0;
+}
sysdeps/or1k/fpu/ftestexcept.c new file +32 -0
new file mode 100644
index 0000000000..8a7f1d1320
@@ -0,0 +1,32 @@
+/* Test exception in current environment.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_private.h>
+
+int
+fetestexcept (int excepts)
+{
+  fpu_control_t cw;
+
+  /* Get current control word.  */
+  _FPU_GETCW (cw);
+
+  return cw & (excepts & FE_ALL_EXCEPT);
+}
+libm_hidden_def (fetestexcept)
sysdeps/or1k/fpu/get-rounding-mode.h new file +38 -0
new file mode 100644
index 0000000000..3ad5216f38
@@ -0,0 +1,38 @@
+/* Determine floating-point rounding mode within libc.  OpenRISC version.
+
+   Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _OR1K_GET_ROUNDING_MODE_H
+#define _OR1K_GET_ROUNDING_MODE_H	1
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+/* Return the floating-point rounding mode.  */
+
+static inline int
+get_rounding_mode (void)
+{
+  fpu_control_t cw;
+
+  _FPU_GETCW (cw);
+  return cw & (0x3 << 1);
+}
+
+#endif /* get-rounding-mode.h */
sysdeps/or1k/fpu_control.h new file +49 -0

49 lines not on this page · raw message

sysdeps/or1k/jmpbuf-offsets.h new file +23 -0
new file mode 100644
index 0000000000..54dabe122e
@@ -0,0 +1,23 @@
+/* Private macros for accessing __jmp_buf contents.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define __JMP_BUF_SP    0
+
+/* Helper for generic ____longjmp_chk(). */
+#define JB_FRAME_ADDRESS(buf) \
+    ((void *) (unsigned long) (buf[__JMP_BUF_SP]))
sysdeps/or1k/jmpbuf-unwind.h new file +35 -0
new file mode 100644
index 0000000000..1a2428f840
@@ -0,0 +1,35 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle (jmpbuf[__JMP_BUF_SP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[__JMP_BUF_SP] - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
sysdeps/or1k/ldsodefs.h new file +40 -0
new file mode 100644
index 0000000000..7b0323429f
@@ -0,0 +1,40 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_SH_LDSODEFS_H
+#define	_SH_LDSODEFS_H	1
+
+#include <elf.h>
+
+struct La_or1k_regs;
+struct La_or1k_retval;
+
+#define ARCH_PLTENTER_MEMBERS						\
+    uintptr_t (*or1k_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *, \
+				  uintptr_t *, struct La_or1k_regs *, \
+				  unsigned int *, const char *name,	\
+				  long int *framesizep)
+
+#define ARCH_PLTEXIT_MEMBERS						\
+    unsigned int (*or1k_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *, \
+				    uintptr_t *, const struct La_or1k_regs *, \
+				    struct La_or1k_retval *, const char *)
+
+#include_next <ldsodefs.h>
+
+#endif
sysdeps/or1k/libc-tls.c new file +32 -0
new file mode 100644
index 0000000000..b0a278c640
@@ -0,0 +1,32 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <csu/libc-tls.c>
+#include <dl-tls.h>
+
+/* On OpenRISC, linker optimizations are not required, so __tls_get_addr
+   can be called even in statically linked binaries.  In this case module
+   must be always 1 and PT_TLS segment exist in the binary, otherwise it
+   would not link.  */
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+  dtv_t *dtv = THREAD_DTV ();
+  return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
sysdeps/or1k/libm-test-ulps new file +1107 -0

1,107 lines not on this page · raw message

sysdeps/or1k/libm-test-ulps-name new file +1 -0
new file mode 100644
index 0000000000..0af6591fd9
@@ -0,0 +1 @@
+OpenRISC
sysdeps/or1k/machine-gmon.h new file +24 -0
new file mode 100644
index 0000000000..abc1d097d5
@@ -0,0 +1,24 @@
+/* Profiling support.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Accept 'frompc' address as argument from the function that calls
+   _mcount for profiling.  Use  __builtin_return_address (0)
+   for the 'selfpc' address.  */
+
+#include <sysdep.h>
+#include <sysdeps/generic/machine-gmon.h>
sysdeps/or1k/math-tests-trap.h new file +27 -0
new file mode 100644
index 0000000000..882479be30
@@ -0,0 +1,27 @@
+/* Configuration for math tests: support for enabling exception traps.
+   OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef OR1K_MATH_TESTS_TRAP_H
+#define OR1K_MATH_TESTS_TRAP_H 1
+
+#include <fenv.h>
+
+#define EXCEPTION_ENABLE_SUPPORTED(EXCEPT)	((EXCEPT) == 0)
+
+#endif /* math-tests-trap.h.  */
sysdeps/or1k/memusage.h new file +20 -0
new file mode 100644
index 0000000000..cdd33c1b7c
@@ -0,0 +1,20 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("r1"); stack_ptr; })
+
+#include <sysdeps/generic/memusage.h>
sysdeps/or1k/nofpu/Implies new file +1 -0
new file mode 100644
index 0000000000..abcbadb25f
@@ -0,0 +1 @@
+ieee754/soft-fp
sysdeps/or1k/nofpu/math-tests-exceptions.h new file +29 -0
new file mode 100644
index 0000000000..2aea76d73d
@@ -0,0 +1,29 @@
+/* Configuration for math tests: support for exceptions.  OpenRISC no-FPU
+   version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef OR1K_NOFPU_MATH_TESTS_EXCEPTIONS_H
+#define OR1K_NOFPU_MATH_TESTS_EXCEPTIONS_H 1
+
+/* We support setting floating-point exception flags on hard-float
+   targets.  These are not supported on soft-float targets.  */
+#define EXCEPTION_TESTS_float 0
+#define EXCEPTION_TESTS_double        0
+#define EXCEPTION_TESTS_long_double   0
+
+#endif /* math-tests-exceptions.h.  */
sysdeps/or1k/nofpu/math-tests-rounding.h new file +28 -0
new file mode 100644
index 0000000000..ab90ee3cda
@@ -0,0 +1,28 @@
+/* Configuration for math tests: rounding mode support.  OpenRISC no-FPU
+   version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef OR1K_NOFPU_MATH_TESTS_ROUNDING_H
+#define OR1K_NOFPU_MATH_TESTS_ROUNDING_H 1
+
+/* On soft-float targets we only support the "to nearest" rounding mode.  */
+#define ROUNDING_TESTS_float(MODE)		((MODE) == FE_TONEAREST)
+#define ROUNDING_TESTS_double(MODE)		((MODE) == FE_TONEAREST)
+#define ROUNDING_TESTS_long_double(MODE)	((MODE) == FE_TONEAREST)
+
+#endif /* math-tests-rounding.h.  */
sysdeps/or1k/nptl/Makefile new file +21 -0
new file mode 100644
index 0000000000..f5828b7ec8
@@ -0,0 +1,21 @@
+# Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library.  If not, see
+# <https://www.gnu.org/licenses/>.
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

sysdeps/or1k/nptl/bits/pthreadtypes-arch.h new file +48 -0

48 lines not on this page · raw message

sysdeps/or1k/nptl/bits/semaphore.h new file +34 -0
new file mode 100644
index 0000000000..473594fcfc

Lines of this file are not shown. View the raw message.

sysdeps/or1k/nptl/pthreaddef.h new file +32 -0
new file mode 100644
index 0000000000..b0c48371f0

Lines of this file are not shown. View the raw message.

sysdeps/or1k/nptl/tcb-offsets.sym new file +6 -0
new file mode 100644
index 0000000000..86025a402d

Lines of this file are not shown. View the raw message.

sysdeps/or1k/nptl/tls.h new file +193 -0

193 lines not on this page · raw message

sysdeps/or1k/preconfigure new file +38 -0
new file mode 100644
index 0000000000..a253d14d52

Lines of this file are not shown. View the raw message.

sysdeps/or1k/setjmp.S new file +56 -0

56 lines not on this page · raw message

sysdeps/or1k/sfp-machine.h new file +102 -0

102 lines not on this page · raw message

sysdeps/or1k/sotruss-lib.c new file +51 -0

51 lines not on this page · raw message

sysdeps/or1k/stackinfo.h new file +33 -0
new file mode 100644
index 0000000000..1b031bcbb3

Lines of this file are not shown. View the raw message.

sysdeps/or1k/start.S new file +116 -0

116 lines not on this page · raw message

sysdeps/or1k/sysdep.h new file +77 -0

77 lines not on this page · raw message

sysdeps/or1k/tininess.h new file +1 -0
new file mode 100644
index 0000000000..1db37790f8

Lines of this file are not shown. View the raw message.

sysdeps/or1k/tls-macros.h new file +82 -0

82 lines not on this page · raw message

sysdeps/or1k/tst-audit.h new file +24 -0
new file mode 100644
index 0000000000..ee95ded044

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/Implies new file +3 -0
new file mode 100644
index 0000000000..f39f16c04a

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/Makefile new file +12 -0
new file mode 100644
index 0000000000..be20320b2f

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/arch-syscall.h new file +315 -0

315 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/bits/fcntl.h new file +49 -0

49 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/bits/mman.h new file +44 -0

44 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/c++-types.data new file +67 -0

67 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/clone.c new file +59 -0

59 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/configure new file +4 -0
new file mode 100644
index 0000000000..420b8cab0e

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/configure.ac new file +4 -0
new file mode 100644
index 0000000000..505530d5c3

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/getcontext.S new file +72 -0

72 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/ioctl.c new file +40 -0
new file mode 100644
index 0000000000..7aa0268481

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h new file +41 -0

41 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/kernel-features.h new file +24 -0
new file mode 100644
index 0000000000..0974c60739

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/ld.abilist new file +5 -0
new file mode 100644
index 0000000000..048f17c848

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libBrokenLocale.abilist new file +1 -0
new file mode 100644
index 0000000000..b0869cec1f

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libanl.abilist new file +4 -0
new file mode 100644
index 0000000000..ba513bd028

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libc.abilist new file +2081 -0

2,081 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/libcrypt.abilist new file +2 -0
new file mode 100644
index 0000000000..6bd253453e

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libdl.abilist new file +9 -0
new file mode 100644
index 0000000000..bf20b0c404

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libm.abilist new file +699 -0

699 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/libnsl.abilist new file +121 -0

121 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/libpthread.abilist new file +216 -0

216 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/libresolv.abilist new file +79 -0

79 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/librt.abilist new file +35 -0
new file mode 100644
index 0000000000..fda2b20c01

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libthread_db.abilist new file +40 -0
new file mode 100644
index 0000000000..dcbc4a8fbe

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/libutil.abilist new file +6 -0
new file mode 100644
index 0000000000..61f73bc34e

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/localplt.data new file +13 -0
new file mode 100644
index 0000000000..0ed8650b65

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/lowlevellock.h new file +23 -0
new file mode 100644
index 0000000000..1ab277ad19

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/makecontext.c new file +77 -0

77 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +29 -0
new file mode 100644
index 0000000000..79cefe667b

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/or1k_clone.S new file +112 -0

112 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/prctl.c new file +41 -0

41 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/pt-vfork.c new file +30 -0
new file mode 100644
index 0000000000..0169ec4f60

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/setcontext.S new file +110 -0

110 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/shlib-versions new file +2 -0
new file mode 100644
index 0000000000..c2217b3243

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h new file +28 -0
new file mode 100644
index 0000000000..a42a55d976

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/swapcontext.S new file +116 -0

116 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/sys/procfs.h new file +120 -0

120 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/sys/ucontext.h new file +48 -0

48 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/sys/user.h new file +1 -0
new file mode 100644
index 0000000000..c871f1a03d

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/syscall.c new file +45 -0

45 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/sysdep.c new file +33 -0
new file mode 100644
index 0000000000..3b681e14aa

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/or1k/sysdep.h new file +167 -0

167 lines not on this page · raw message

sysdeps/unix/sysv/linux/or1k/ucontext_i.sym new file +26 -0
new file mode 100644
index 0000000000..a8d4db080f

Lines of this file are not shown. View the raw message.

sysdeps/unix/sysv/linux/syscall-names.list +1 -0
index 21a62a06f4..fa434fd477 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.26.2

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 1/1 Initial support for OpenRISC

* Stafford Horne via Libc-alpha:

Quoted 36 lines
elf/elf.h +28 -0
index 51e9968405..1e8a8e74c4 100644
@@ -4096,6 +4096,43 @@ enum
 #define R_ARC_TLS_LE_S9		0x4a
 #define R_ARC_TLS_LE_32		0x4b
 
+/* OpenRISC 1000 specific relocs.  */
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26

elf/elf.h enum · line 4136

Quoted 10 lines
elf/elf.h +9 -0
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
 __END_DECLS

Please post this separately, it can be reviewed and go in before the actual port goes in.

sysdeps/or1k/Implies line 4

Quoted 10 lines
sysdeps/or1k/Implies new file +4 -0
new file mode 100644
index 0000000000..ff699c7dd5
@@ -0,0 +1,4 @@
+init_array
+wordsize-32
+ieee754/dbl-64
+ieee754/flt-32

The init_array subdirectory does not exist anymore.

Quoted 7 lines
sysdeps/or1k/bits/endianness.h new file +1 -0
new file mode 100644
index 0000000000..96fd5ae5ef
@@ -0,0 +1,11 @@
+#ifndef _BITS_ENDIANNESS_H

sysdeps/or1k/bits/endianness.h line 11

Quoted 10 lines
sysdeps/or1k/bits/endianness.h new file +10 -0
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
+#endif
+
+/* HP-PA is big-endian.  */
+#define __BYTE_ORDER __BIG_ENDIAN
+
+#endif /* bits/endianness.h */

HP-PA?

Quoted 26 lines
sysdeps/or1k/bits/setjmp.h new file +20 -0
new file mode 100644
index 0000000000..dd07fce68c
@@ -0,0 +1,36 @@
+/* Define the machine-dependent type `jmp_buf'.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+

sysdeps/or1k/bits/setjmp.h line 30

Quoted 10 lines
sysdeps/or1k/bits/setjmp.h new file +10 -0
+#ifndef _OR1K_BITS_SETJMP_H
+#define _OR1K_BITS_SETJMP_H  1
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#if defined __USE_MISC || defined _ASM
+# define JB_SP     0  /* GPR1 */
+#endif

It's odd to define this in an installed header. I think it's unused anyway. Looks like yet another hppa remnant.

Quoted 8 lines
sysdeps/or1k/dl-machine.h new file +1 -0
new file mode 100644
index 0000000000..0bcdc9888c
@@ -0,0 +1,339 @@
 
+auto inline void

sysdeps/or1k/dl-machine.h line 218

Quoted 10 lines
sysdeps/or1k/dl-machine.h new file +10 -0
+__attribute ((always_inline))
+elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+                  const Elf32_Sym *sym, const struct r_found_version *version,
+                  void *const reloc_addr_arg, int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_OR1K_NONE, 0))
+    return;

Please use __glibc_likely and __glibc_unlikely.

sysdeps/or1k/dl-machine.h line 267

Quoted 11 lines
sysdeps/or1k/dl-machine.h new file +11 -0
+          case R_OR1K_32:
+	    {
+	      /* Handle mis-aligned offsets */
+	      struct unaligned
+		{
+		  Elf32_Addr x;
+		} __attribute__ ((packed, may_alias));
+
+	      /* Support relocations on mis-aligned offsets.  */
+	      ((struct unaligned *) reloc_addr)->x = value + reloc->r_addend;
+	      break;

Would it be clearer to use memcpy here? The generated code is likely the same.

sysdeps/or1k/dl-machine.h line 305

Quoted 4 lines
sysdeps/or1k/dl-machine.h new file +4 -0
+          default:
+            _dl_fatal_printf("Unhandled reloc: %u\n", r_type);
+            _dl_reloc_bad_type (map, r_type, 0);
+            break;

_dl_reloc_bad_type is unreachable here.

Quoted 8 lines
sysdeps/or1k/dl-machine.h new file +8 -0
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_lazy_rel (struct link_map *map,
+                      Elf32_Addr l_addr, const Elf32_Rela *reloc,
+                      int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);

sysdeps/or1k/dl-machine.h line 336

Quoted 10 lines
sysdeps/or1k/dl-machine.h new file +10 -0
+
+  if (__builtin_expect (r_type == R_OR1K_JMP_SLOT, 1))
+      *reloc_addr += l_addr;
+  else if (__builtin_expect (r_type == R_OR1K_NONE, 0))
+    return;
+  else
+    {
+      _dl_fatal_printf("Unhandled lazy reloc: %u\n", r_type);
+      _dl_reloc_bad_type (map, r_type, 1);
+    }

Likewise.

sysdeps/or1k/dl-start.S line 4

Quoted 11 lines
sysdeps/or1k/dl-start.S new file +4 -0
new file mode 100644
index 0000000000..95cb0f2396
@@ -0,0 +1,101 @@
+	/* Load termination function address.
+	   Pass this in r9 to the _start function.
+	   start.S will then pass this to __libc_start_main.  */
+	l.lwz	r9, got(_dl_fini)(r16)

The fini argument to __libc_start_main is unused, so this shouldn't be necessary.

sysdeps/or1k/memusage.h

Quoted 7 lines
sysdeps/or1k/memusage.h new file +1 -0
new file mode 100644
index 0000000000..cdd33c1b7c
 
+#define GETSP() ({ register uintptr_t stack_ptr asm ("r1"); stack_ptr; })

I think it's more future-proof to use the appropriate compiler builtin.

sysdeps/or1k/start.S line 49

Quoted 10 lines
sysdeps/or1k/start.S new file +3 -0
new file mode 100644
index 0000000000..339e0ddcc2
@@ -0,0 +1,116 @@
 
+	/* rtld_fini = the dynamic fini address.
+	  This is set by dl-start.S or just plain NULL if called directly. */
+	l.ori	r8, r9, 0

I think this is outdated, see above.

Quoted 53 lines
sysdeps/unix/sysv/linux/or1k/clone.c new file +47 -0
new file mode 100644
index 0000000000..f9dc4d2106
@@ -0,0 +1,59 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdarg.h>
+#include <sysdep.h>
+
+extern int __or1k_clone (int (*fn)(void *), void *child_stack,
+			 int flags, void *arg, pid_t *ptid,
+			 void *tls, pid_t *ctid);
+
+
+/* or1k ABI uses stack for varargs, syscall uses registers.
+ * This function moves from varargs to regs. */
+int
+__clone (int (*fn)(void *), void *child_stack,
+	 int flags, void *arg, ...
+	 /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ )
+{
+  void *ptid;
+  void *tls;
+  void *ctid;
+  va_list ap;
+  int err;
+
+  va_start (ap, arg);
+  ptid = va_arg (ap, void *);
+  tls = va_arg (ap, void *);
+  ctid = va_arg (ap, void *);
+  va_end (ap);
+
+  /* Sanity check the arguments */
+  err = -EINVAL;
+  if (!fn)

sysdeps/unix/sysv/linux/or1k/clone.c line 57

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/clone.c new file +10 -0
+    goto syscall_error;
+  if (!child_stack)
+    goto syscall_error;
+
+  return __or1k_clone (fn, child_stack, flags, arg, ptid, tls, ctid);
+
+syscall_error:
+  __set_errno (-err);
+  return -1;
+}

Would it be possible to make the __clone function not varargs? Or is this too big a portability hazard?

Quoted 19 lines
sysdeps/unix/sysv/linux/or1k/lowlevellock.h new file +13 -0
new file mode 100644
index 0000000000..1ab277ad19
@@ -0,0 +1,23 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+

sysdeps/unix/sysv/linux/or1k/lowlevellock.h line 23

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/lowlevellock.h new file +10 -0
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _OR1K_LOWLEVELLOCK_H
+#define _OR1K_LOWLEVELLOCK_H	1
+
+#include <sysdeps/nptl/lowlevellock.h>
+
+#endif /* lowlevellock.h */

Is this really necessary? Doesn't the search path take care of that?

Quoted 25 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +19 -0
new file mode 100644
index 0000000000..79cefe667b
@@ -0,0 +1,29 @@
+/* Common mmap definition for Linux implementation.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef MMAP_OR1K_INTERNAL_LINUX_H

sysdeps/unix/sysv/linux/or1k/mmap_internal.h line 29

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +10 -0
+#define MMAP_OR1K_INTERNAL_LINUX_H
+
+/* Linux allows PAGE_SHIFT in range of [12-16] and expect
+   mmap2 offset to be provided in based on the configured pagesize.
+   Determine the shift dynamically with getpagesize.  */
+#define MMAP2_PAGE_UNIT -1
+
+#include_next <mmap_internal.h>
+
+#endif

Does OpenRISC really have a dynamic page size?

I do not see any of the required support code for this.

Quoted 16 lines
sysdeps/unix/sysv/linux/or1k/prctl.c new file +11 -0
new file mode 100644
index 0000000000..fc7e823974
+/* or1k ABI uses stack for varargs, syscall uses registers.
+ * This function moves from varargs to regs. */
+int
+__prctl (int __option, ...)
+{
+  va_list ap;
+  unsigned long arg2;
+  unsigned long arg3;
+  unsigned long arg4;
+  unsigned long arg5;
+

sysdeps/unix/sysv/linux/or1k/prctl.c line 41

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/prctl.c new file +10 -0
+  va_start (ap, __option);
+  arg2 = va_arg (ap, unsigned long);
+  arg3 = va_arg (ap, unsigned long);
+  arg4 = va_arg (ap, unsigned long);
+  arg5 = va_arg (ap, unsigned long);
+  va_end (ap);
+
+  return INLINE_SYSCALL (prctl, 5, __option, arg2, arg3, arg4, arg5);
+}
+weak_alias (__prctl, prctl)

This should use unsigned long int.

Quoted 17 lines
sysdeps/unix/sysv/linux/or1k/pt-vfork.c new file +11 -0
new file mode 100644
index 0000000000..0169ec4f60
@@ -0,0 +1,30 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

sysdeps/unix/sysv/linux/or1k/pt-vfork.c line 21

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/pt-vfork.c new file +10 -0
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* If we don't have vfork, fork is close enough.  */

This is no longer true for our posix_spawn implementation.

But this file should be unused anyway. Can you remove it?

Quoted 21 lines
sysdeps/unix/sysv/linux/or1k/syscall.c new file +14 -0
new file mode 100644
index 0000000000..6d491bb4b5
@@ -0,0 +1,45 @@
 
+long int
+syscall (long int syscall_number, ...)
+{
+  unsigned long arg1, arg2, arg3, arg4, arg5, arg6;
+  va_list arg;
+  long int ret;
+
+  va_start (arg, syscall_number);
+  arg1 = va_arg (arg, unsigned long);
+  arg2 = va_arg (arg, unsigned long);
+  arg3 = va_arg (arg, unsigned long);
+  arg4 = va_arg (arg, unsigned long);
+  arg5 = va_arg (arg, unsigned long);
+  arg6 = va_arg (arg, unsigned long);

sysdeps/unix/sysv/linux/or1k/syscall.c line 45

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/syscall.c new file +10 -0
+  va_end (arg);
+
+  ret = INTERNAL_SYSCALL_NCS (syscall_number, 6, arg1, arg2, arg3, arg4,
+			      arg5, arg6);
+
+  if (INTERNAL_SYSCALL_ERROR_P (ret))
+    return __syscall_error (ret);
+
+  return ret;
+}

Likewise, this should use unsigned long int. I suspect you can use INTERNAL_SYSCALL_CALL directly, too.

Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +2 -0
new file mode 100644
index 0000000000..3b681e14aa
 
+long __syscall_error (long err);
+hidden_proto (__syscall_error)

sysdeps/unix/sysv/linux/or1k/sysdep.c line 33

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +10 -0
+
+/* This routine is jumped to by all the syscall handlers, to stash
+   an error number into errno.  */
+long
+__syscall_error (long err)
+{
+  __set_errno (- err);
+  return -1;
+}
+hidden_def (__syscall_error)

Should use long int throughout. Also applies to sysdep.h below.

sysdeps/unix/sysv/linux/syscall-names.list open_by_handle_at · line 302

Quoted 12 lines
sysdeps/unix/sysv/linux/syscall-names.list +1 -0
index 21a62a06f4..fa434fd477 100644
@@ -296,6 +296,7 @@ open_by_handle_at
 open_tree
 openat
 openat2
+or1k_atomic
 osf_adjtime
 osf_afs_syscall
 osf_alt_plock

Please post this separately, it can go in immediately.

This is not a complete review; I can't comment on the architecture-specific bits, the atomics, and the math interfaces.

There are a few TODOs/TO-DOs left, please have a look.

You also need to document which ABIs are supported (in INSTALL, with a brief entry in NEWS). Are any specific GCC and binutils version requirements, or kernel header requirements (beyond the already documented minimums)?

I see a bunch of ifdef's for hard float, but this appears to be a hard-float-only port.

Thanks,
Florian

#9 lore raw

cover OpenRISC port

In reply to Stafford Horne
Quoted 3 lines · Stafford Horne via Libc-alpha

Hi All,

This is the patch for the OpenRISC port of glibc.

Please see <https://sourceware.org/glibc/wiki/NewPorts> for information to include in a new port submission. That includes pointing to architecture and ABI manuals.

Quoted 3 lines

The original patch was put together by Christian Scensson a few years ago. I have taken the patch and finished all of the TODO items and run and fixed all of the test failures.

Do you mean Christian Svensson? (There's a copyright assignment from Christian Svensson for GCC GLIBC BINUTILS from 2014.)

Quoted 4 lines

TEST RESULTS

Pretty much all tests are passing however there are several math (fpu) tests which are failing due to issues with setting underflow/overflow flags. These

There should not be any such failures with a correct port and architecture implementation.

Quoted 1 line

I can provide more details.

Full test results should be provided (see the above mentioned wiki page).

Signature · 2 lines
Joseph S. Myers
joseph at codesourcery.com
#7 lore raw

PATCH 1/1 Initial support for OpenRISC

In reply to Stafford Horne
Quoted 1 line · Stafford Horne via Libc-alpha

This patch includes the OpenRISC glibc support for linux.

This is missing a build-many-glibcs.py update. You always need to include such an update with a new port, which must build at least one configuration for each ABI supported by the port (and may build any major non-ABI variants that seem relevant). build-many-glibcs.py results for the port must be clean (i.e. no failures in the compilation part of the testsuite), at least when building with GCC and binutils master (it's OK if you need features or bug fixes not in the most recent release branches, although distributors might prefer such fixes to be backported). Similarly, there should be NEWS and README updates.

New 32-bit ports should preferably be set up to support only 64-bit time and 64-bit offsets (see ARC and RV32 patch postings for examples).

sysdeps/or1k/bits/atomic.h

Quoted 1 line
sysdeps/or1k/bits/atomic.h +0 -0

There should be no such file. bits/ is only for installed headers, not internal ones. See commit de071d199a8578055edf2722114788ae749823aa ("Move bits/atomic.h to atomic-machine.h (bug 14912).", 11 Sep 2015).

sysdeps/or1k/nptl/bits/semaphore.h

Quoted 1 line
sysdeps/or1k/nptl/bits/semaphore.h +0 -0

Do you really need this file? See commit 1270fbaaeebe642db335fccaaf98c82e6647cc0d ("semaphore: consolidate arch headers into a generic one", 5 May 2020).

sysdeps/or1k/nptl/bits/semaphore.h

Quoted 3 lines
sysdeps/or1k/nptl/bits/semaphore.h +3 -0
+  # Needed for relro detection
+  libc_commonpagesize=0x2000
+  libc_relro_required=yes

See commit cb403c34c6f6e1cce5018864485958cfc2e28906 ("Remove relro configure test.", 27 Jun 2014).

When you have an old out-of-tree port, it's a good idea to go through cross-architecture commits from when the port was first created onwards to identify such global changes that need to be applied to that port.

sysdeps/unix/sysv/linux/or1k/bits/mman.h

Quoted 1 line
sysdeps/unix/sysv/linux/or1k/bits/mman.h +0 -0

You shouldn't have this file. See the comment in sysdeps/unix/sysv/linux/bits/mman.h (and commit d3a43e49f342c4663af0fff9d95000cfe26867c3, "Unify many bits/mman.h headers.", 18 Sep 2018, and commit 61d8b5feeed36e242a043befe9b11f7f8c294f58, "Share MAP_* flags between more architectures.", 26 Sep 2018):

/* These definitions are appropriate for architectures that, in the
Linux kernel, either have no uapi/asm/mman.h, or have one that includes asm-generic/mman.h without any changes or additions relevant to glibc. If there are additions relevant to glibc, an architecture-specific bits/mman.h is needed. */

sysdeps/unix/sysv/linux/or1k/configure.ac line 4

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/configure.ac new file +4 -0
new file mode 100644
index 0000000000..505530d5c3
@@ -0,0 +1,4 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/or1k.
+
+arch_minimum_kernel=3.4.0

You'll probably need a newer minimum kernel when requiring 64-bit time support, until all the fallback for 64-bit time on 32-bit kernels without the 64-bit-time syscalls is implemented.

Quoted 1 line

+#undef __ASSUME_SET_ROBUST_LIST

Are you sure this is never supported on this architecture? arch/openrisc/include/asm/futex.h appears to have gained futex_atomic_cmpxchg_inatomic in 4.11, so I'd expect the #undef only to be for kernels older than that.

sysdeps/unix/sysv/linux/or1k/sys/procfs.h

Quoted 1 line
sysdeps/unix/sysv/linux/or1k/sys/procfs.h +0 -0

See commit d62f9ec0cce26a275ec68f4564814041a33395b1 ("Complete sys/procfs.h unification.", 25 Sep 2018). You shouldn't have an architecture-specific version of this file; add whatever bits/ headers are needed instead.

In general, each architecture-specific file needs a justification that either no generic version exists or the generic one is unsuitable or suboptimal for this architecture; the default is that we want to use unified implementations of as many files as possible.

Signature · 2 lines
Joseph S. Myers
joseph at codesourcery.com
#10 lore raw

cover OpenRISC port

In reply to Joseph Myers
Quoted 9 lines · Joseph Myers
Quoted 3 lines · Stafford Horne via Libc-alpha

Hi All,

This is the patch for the OpenRISC port of glibc.

Please see <https://sourceware.org/glibc/wiki/NewPorts> for information to include in a new port submission. That includes pointing to architecture and ABI manuals.

Thank you for the pointers, I will include this in v2. But the architecture manual is here:

- Page: https://openrisc.io/architecture
- PDF: https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf

- Architecture Revision Required for Full Hard Float support:
- https://openrisc.io/proposals/p17-user-mode-fpcsr

Quoted 6 lines
Quoted 3 lines

The original patch was put together by Christian Scensson a few years ago. I have taken the patch and finished all of the TODO items and run and fixed all of the test failures.

Do you mean Christian Svensson? (There's a copyright assignment from Christian Svensson for GCC GLIBC BINUTILS from 2014.)

Yes Christian Svensson, sorry for the typo. He is listed in the changelog on the patch.

Quoted 8 lines
Quoted 5 lines

TEST RESULTS

Pretty much all tests are passing however there are several math (fpu) tests which are failing due to issues with setting underflow/overflow flags. These

There should not be any such failures with a correct port and architecture implementation.

OK, I will look into it again. The last I remember there was somethign strange happening with underflow exception not being set in the GCC FPU emulation code.

Note, the OpenRISC implementation I tested with has only 32-bit FPU hard support. This meant that C API for log/cos/sin etc which internally are defined to use 64-bit double's all end up using emulation.

Quoted 3 lines
Quoted 1 line

I can provide more details.

Full test results should be provided (see the above mentioned wiki page).

I will do with the next round of patches. This is all very helpful.

-Stafford

#8 lore raw

PATCH 1/1 Initial support for OpenRISC

In reply to Joseph Myers

Hello,

Thanks for the review.

Quoted 4 lines · Joseph Myers
Quoted 1 line · Stafford Horne via Libc-alpha

This patch includes the OpenRISC glibc support for linux.

Quoted 9 lines

This is missing a build-many-glibcs.py update. You always need to include such an update with a new port, which must build at least one configuration for each ABI supported by the port (and may build any major non-ABI variants that seem relevant). build-many-glibcs.py results for the port must be clean (i.e. no failures in the compilation part of the testsuite), at least when building with GCC and binutils master (it's OK if you need features or bug fixes not in the most recent release branches, although distributors might prefer such fixes to be backported). Similarly, there should be NEWS and README updates.

OK.

Quoted 2 lines

New 32-bit ports should preferably be set up to support only 64-bit time and 64-bit offsets (see ARC and RV32 patch postings for examples).

OK.

Quoted 5 lines

sysdeps/or1k/bits/atomic.h

Quoted 1 line
sysdeps/or1k/bits/atomic.h +0 -0

There should be no such file. bits/ is only for installed headers, not internal ones. See commit de071d199a8578055edf2722114788ae749823aa ("Move bits/atomic.h to atomic-machine.h (bug 14912).", 11 Sep 2015).

OK.

Quoted 5 lines

sysdeps/or1k/nptl/bits/semaphore.h

Quoted 1 line
sysdeps/or1k/nptl/bits/semaphore.h +0 -0

Do you really need this file? See commit 1270fbaaeebe642db335fccaaf98c82e6647cc0d ("semaphore: consolidate arch headers into a generic one", 5 May 2020).

Likely, not, I will review.

Quoted 6 lines

sysdeps/or1k/nptl/bits/semaphore.h

Quoted 3 lines
sysdeps/or1k/nptl/bits/semaphore.h +3 -0
+  # Needed for relro detection
+  libc_commonpagesize=0x2000
+  libc_relro_required=yes

See commit cb403c34c6f6e1cce5018864485958cfc2e28906 ("Remove relro configure test.", 27 Jun 2014).

OK.

Quoted 3 lines

When you have an old out-of-tree port, it's a good idea to go through cross-architecture commits from when the port was first created onwards to identify such global changes that need to be applied to that port.

I did try to do this, but it started in 2014 it was hard to pick up everything. I also payed close attention to the riscv and csky ports.

Quoted 9 lines

sysdeps/unix/sysv/linux/or1k/bits/mman.h

Quoted 1 line
sysdeps/unix/sysv/linux/or1k/bits/mman.h +0 -0

You shouldn't have this file. See the comment in sysdeps/unix/sysv/linux/bits/mman.h (and commit d3a43e49f342c4663af0fff9d95000cfe26867c3, "Unify many bits/mman.h headers.", 18 Sep 2018, and commit 61d8b5feeed36e242a043befe9b11f7f8c294f58, "Share MAP_* flags between more architectures.", 26 Sep 2018):

Quoted 5 lines

/* These definitions are appropriate for architectures that, in the
Linux kernel, either have no uapi/asm/mman.h, or have one that includes asm-generic/mman.h without any changes or additions relevant to glibc. If there are additions relevant to glibc, an architecture-specific bits/mman.h is needed. */

OK.

Quoted 6 lines
Quoted 6 lines
sysdeps/unix/sysv/linux/or1k/configure.ac new file +0 -0
new file mode 100644
index 0000000000..505530d5c3
@@ -0,0 +1,4 @@
Quoted 8 lines

sysdeps/unix/sysv/linux/or1k/configure.ac line 4

Quoted 4 lines
sysdeps/unix/sysv/linux/or1k/configure.ac new file +4 -0
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/or1k.
+
+arch_minimum_kernel=3.4.0

You'll probably need a newer minimum kernel when requiring 64-bit time support, until all the fallback for 64-bit time on 32-bit kernels without the 64-bit-time syscalls is implemented.

OK, noted.

Quoted 6 lines
Quoted 1 line

+#undef __ASSUME_SET_ROBUST_LIST

Are you sure this is never supported on this architecture? arch/openrisc/include/asm/futex.h appears to have gained futex_atomic_cmpxchg_inatomic in 4.11, so I'd expect the #undef only to be for kernels older than that.

Sorry, I overlooked this thanks for catching. I added the atomic support to the kernel.

Quoted 6 lines

sysdeps/unix/sysv/linux/or1k/sys/procfs.h

Quoted 1 line
sysdeps/unix/sysv/linux/or1k/sys/procfs.h +0 -0

See commit d62f9ec0cce26a275ec68f4564814041a33395b1 ("Complete sys/procfs.h unification.", 25 Sep 2018). You shouldn't have an architecture-specific version of this file; add whatever bits/ headers are needed instead.

OK.

Quoted 4 lines

In general, each architecture-specific file needs a justification that either no generic version exists or the generic one is unsuitable or suboptimal for this architecture; the default is that we want to use unified implementations of as many files as possible.

This has also been my goal for OpenRISC (use as much generic code as possible), but when going over the original port I missed some of these. I noticed in the last few months since I started fixing up the port that many more architecture specific parts were moved to generic code and I did those moves. I seem to missed everything from before 2019 when I started the port.

Thank you for pointing these out.

I will work on cleaning this up, testing and posting a new version in a week or two.

-Stafford

#3 lore raw

PATCH 1/1 Initial support for OpenRISC

In reply to Florian Weimer

Hi Florian,

Thanks for the review.

Quoted 43 lines · Florian Weimer

* Stafford Horne via Libc-alpha:

Quoted 41 lines
elf/elf.h +33 -0
index 51e9968405..1e8a8e74c4 100644
@@ -4096,6 +4096,43 @@ enum
 #define R_ARC_TLS_LE_S9		0x4a
 #define R_ARC_TLS_LE_32		0x4b
 
+/* OpenRISC 1000 specific relocs.  */
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
Quoted 8 lines

elf/elf.h enum · line 4136

Quoted 5 lines
elf/elf.h +4 -0
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
 __END_DECLS

Please post this separately, it can be reviewed and go in before the actual port goes in.

OK, I will split it out.

Quoted 4 lines
Quoted 4 lines
sysdeps/or1k/Implies new file +0 -1
new file mode 100644
index 0000000000..ff699c7dd5
--- /dev/null
Quoted 8 lines

sysdeps/or1k/Implies line 4

Quoted 6 lines

+++ b/sysdeps/or1k/Implies

sysdeps/or1k/Implies new file +4 -0
@@ -0,0 +1,4 @@
+init_array
+wordsize-32
+ieee754/dbl-64
+ieee754/flt-32

The init_array subdirectory does not exist anymore.

OK. I missed this I started forward porting this old port around 2019 November and must have missed that this was removed.

Quoted 11 lines
Quoted 11 lines
sysdeps/or1k/bits/endianness.h new file +5 -0
new file mode 100644
index 0000000000..96fd5ae5ef
@@ -0,0 +1,11 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
Quoted 8 lines

sysdeps/or1k/bits/endianness.h line 11

Quoted 6 lines
sysdeps/or1k/bits/endianness.h new file +6 -0
+#endif
+
+/* HP-PA is big-endian.  */
+#define __BYTE_ORDER __BIG_ENDIAN
+
+#endif /* bits/endianness.h */

HP-PA?

OK.

Copy paste, during forward porting I thought I removed a lot of these, I will clean it up and grep for similar patterns.

Quoted 31 lines
Quoted 31 lines
sysdeps/or1k/bits/setjmp.h new file +25 -0
new file mode 100644
index 0000000000..dd07fce68c
@@ -0,0 +1,36 @@
+/* Define the machine-dependent type `jmp_buf'.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+#ifndef _OR1K_BITS_SETJMP_H
+#define _OR1K_BITS_SETJMP_H  1
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
Quoted 8 lines

sysdeps/or1k/bits/setjmp.h line 30

Quoted 5 lines
sysdeps/or1k/bits/setjmp.h new file +5 -0
+#endif
+
+#if defined __USE_MISC || defined _ASM
+# define JB_SP     0  /* GPR1 */
+#endif

It's odd to define this in an installed header. I think it's unused anyway. Looks like yet another hppa remnant.

Yes, I'll revisit this file.

Quoted 7 lines
Quoted 6 lines
sysdeps/or1k/dl-machine.h new file +0 -0
new file mode 100644
index 0000000000..0bcdc9888c
@@ -0,0 +1,339 @@
Quoted 13 lines

sysdeps/or1k/dl-machine.h line 218

Quoted 11 lines
sysdeps/or1k/dl-machine.h new file +11 -0
+auto inline void
+__attribute ((always_inline))
+elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+                  const Elf32_Sym *sym, const struct r_found_version *version,
+                  void *const reloc_addr_arg, int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_OR1K_NONE, 0))
+    return;

Please use __glibc_likely and __glibc_unlikely.

OK, I didn't know about those. Now I do.

Quoted 6 lines
Quoted 6 lines
sysdeps/or1k/dl-machine.h new file +6 -0
+          case R_OR1K_32:
+	    {
+	      /* Handle mis-aligned offsets */
+	      struct unaligned
+		{
+		  Elf32_Addr x;
Quoted 8 lines

sysdeps/or1k/dl-machine.h line 267

Quoted 5 lines
sysdeps/or1k/dl-machine.h new file +5 -0
+		} __attribute__ ((packed, may_alias));
+
+	      /* Support relocations on mis-aligned offsets.  */
+	      ((struct unaligned *) reloc_addr)->x = value + reloc->r_addend;
+	      break;

Would it be clearer to use memcpy here? The generated code is likely the same.

Yes, it should be, I will test it out.

Quoted 6 lines

sysdeps/or1k/dl-machine.h line 305

Quoted 4 lines
sysdeps/or1k/dl-machine.h new file +4 -0
+          default:
+            _dl_fatal_printf("Unhandled reloc: %u\n", r_type);
+            _dl_reloc_bad_type (map, r_type, 0);
+            break;

_dl_reloc_bad_type is unreachable here.

OK.

Quoted 12 lines
Quoted 12 lines
sysdeps/or1k/dl-machine.h new file +12 -0
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_lazy_rel (struct link_map *map,
+                      Elf32_Addr l_addr, const Elf32_Rela *reloc,
+                      int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_OR1K_JMP_SLOT, 1))
+      *reloc_addr += l_addr;
+  else if (__builtin_expect (r_type == R_OR1K_NONE, 0))
Quoted 8 lines

sysdeps/or1k/dl-machine.h line 336

Quoted 6 lines
sysdeps/or1k/dl-machine.h new file +6 -0
+    return;
+  else
+    {
+      _dl_fatal_printf("Unhandled lazy reloc: %u\n", r_type);
+      _dl_reloc_bad_type (map, r_type, 1);
+    }

Likewise.

OK.

Quoted 6 lines
Quoted 5 lines
sysdeps/or1k/dl-start.S new file +0 -0
new file mode 100644
index 0000000000..95cb0f2396
Quoted 8 lines

sysdeps/or1k/dl-start.S line 4

Quoted 5 lines
sysdeps/or1k/dl-start.S new file +4 -0
@@ -0,0 +1,101 @@
+	/* Load termination function address.
+	   Pass this in r9 to the _start function.
+	   start.S will then pass this to __libc_start_main.  */
+	l.lwz	r9, got(_dl_fini)(r16)

The fini argument to __libc_start_main is unused, so this shouldn't be necessary.

OK. I'll look for where this came from and remove it needed.

Quoted 9 lines

sysdeps/or1k/memusage.h

Quoted 7 lines
sysdeps/or1k/memusage.h new file +1 -0
new file mode 100644
index 0000000000..cdd33c1b7c
 
+#define GETSP() ({ register uintptr_t stack_ptr asm ("r1"); stack_ptr; })

I think it's more future-proof to use the appropriate compiler builtin.

Right, will do.

Quoted 7 lines
Quoted 6 lines
sysdeps/or1k/start.S new file +0 -0
new file mode 100644
index 0000000000..339e0ddcc2
@@ -0,0 +1,116 @@
Quoted 5 lines

sysdeps/or1k/start.S line 49

Quoted 3 lines
sysdeps/or1k/start.S new file +3 -0
+	/* rtld_fini = the dynamic fini address.
+	  This is set by dl-start.S or just plain NULL if called directly. */
+	l.ori	r8, r9, 0

I think this is outdated, see above.

OK.

Quoted 58 lines
Quoted 58 lines
sysdeps/unix/sysv/linux/or1k/clone.c new file +52 -0
new file mode 100644
index 0000000000..f9dc4d2106
@@ -0,0 +1,59 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdarg.h>
+#include <sysdep.h>
+
+extern int __or1k_clone (int (*fn)(void *), void *child_stack,
+			 int flags, void *arg, pid_t *ptid,
+			 void *tls, pid_t *ctid);
+
+
+/* or1k ABI uses stack for varargs, syscall uses registers.
+ * This function moves from varargs to regs. */
+int
+__clone (int (*fn)(void *), void *child_stack,
+	 int flags, void *arg, ...
+	 /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ )
+{
+  void *ptid;
+  void *tls;
+  void *ctid;
+  va_list ap;
+  int err;
+
+  va_start (ap, arg);
+  ptid = va_arg (ap, void *);
+  tls = va_arg (ap, void *);
+  ctid = va_arg (ap, void *);
+  va_end (ap);
+
+  /* Sanity check the arguments */
+  err = -EINVAL;
+  if (!fn)
+    goto syscall_error;
+  if (!child_stack)
+    goto syscall_error;
+
+  return __or1k_clone (fn, child_stack, flags, arg, ptid, tls, ctid);
Quoted 8 lines

sysdeps/unix/sysv/linux/or1k/clone.c line 57

Quoted 5 lines
sysdeps/unix/sysv/linux/or1k/clone.c new file +5 -0
+
+syscall_error:
+  __set_errno (-err);
+  return -1;
+}

Would it be possible to make the __clone function not varargs? Or is this too big a portability hazard?

That would mean overriding the definition in sched.h?

This is the approach we used in other libc ports.

Quoted 23 lines
Quoted 23 lines
sysdeps/unix/sysv/linux/or1k/lowlevellock.h new file +17 -0
new file mode 100644
index 0000000000..1ab277ad19
@@ -0,0 +1,23 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
Quoted 8 lines

sysdeps/unix/sysv/linux/or1k/lowlevellock.h line 23

Quoted 6 lines
sysdeps/unix/sysv/linux/or1k/lowlevellock.h new file +6 -0
+#ifndef _OR1K_LOWLEVELLOCK_H
+#define _OR1K_LOWLEVELLOCK_H	1
+
+#include <sysdeps/nptl/lowlevellock.h>
+
+#endif /* lowlevellock.h */

Is this really necessary? Doesn't the search path take care of that?

I think not, I must have added this before I understood about the search path.

Quoted 38 lines
Quoted 25 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +19 -0
new file mode 100644
index 0000000000..79cefe667b
@@ -0,0 +1,29 @@
+/* Common mmap definition for Linux implementation.  OpenRISC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef MMAP_OR1K_INTERNAL_LINUX_H

sysdeps/unix/sysv/linux/or1k/mmap_internal.h line 29

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +10 -0
+#define MMAP_OR1K_INTERNAL_LINUX_H
+
+/* Linux allows PAGE_SHIFT in range of [12-16] and expect
+   mmap2 offset to be provided in based on the configured pagesize.
+   Determine the shift dynamically with getpagesize.  */
+#define MMAP2_PAGE_UNIT -1
+
+#include_next <mmap_internal.h>
+
+#endif

Does OpenRISC really have a dynamic page size?

Quoted 1 line

I do not see any of the required support code for this.

Its not dynamic, but the issue I was fixing here was to allow getting the page size from the kernel. The default 4K value was causing issues with clone if I remember.

Let me test this again.

Quoted 20 lines
Quoted 20 lines
sysdeps/unix/sysv/linux/or1k/prctl.c new file +15 -0
new file mode 100644
index 0000000000..fc7e823974
+/* or1k ABI uses stack for varargs, syscall uses registers.
+ * This function moves from varargs to regs. */
+int
+__prctl (int __option, ...)
+{
+  va_list ap;
+  unsigned long arg2;
+  unsigned long arg3;
+  unsigned long arg4;
+  unsigned long arg5;
+
+  va_start (ap, __option);
+  arg2 = va_arg (ap, unsigned long);
+  arg3 = va_arg (ap, unsigned long);
+  arg4 = va_arg (ap, unsigned long);
Quoted 8 lines

sysdeps/unix/sysv/linux/or1k/prctl.c line 41

Quoted 6 lines
sysdeps/unix/sysv/linux/or1k/prctl.c new file +6 -0
+  arg5 = va_arg (ap, unsigned long);
+  va_end (ap);
+
+  return INLINE_SYSCALL (prctl, 5, __option, arg2, arg3, arg4, arg5);
+}
+weak_alias (__prctl, prctl)

This should use unsigned long int.

OK.

Quoted 30 lines
Quoted 17 lines
sysdeps/unix/sysv/linux/or1k/pt-vfork.c new file +11 -0
new file mode 100644
index 0000000000..0169ec4f60
@@ -0,0 +1,30 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

sysdeps/unix/sysv/linux/or1k/pt-vfork.c line 21

Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/pt-vfork.c new file +10 -0
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* If we don't have vfork, fork is close enough.  */

This is no longer true for our posix_spawn implementation.

Quoted 1 line

But this file should be unused anyway. Can you remove it?

OK.

Quoted 26 lines
Quoted 26 lines
sysdeps/unix/sysv/linux/or1k/syscall.c new file +19 -0
new file mode 100644
index 0000000000..6d491bb4b5
@@ -0,0 +1,45 @@
 
+long int
+syscall (long int syscall_number, ...)
+{
+  unsigned long arg1, arg2, arg3, arg4, arg5, arg6;
+  va_list arg;
+  long int ret;
+
+  va_start (arg, syscall_number);
+  arg1 = va_arg (arg, unsigned long);
+  arg2 = va_arg (arg, unsigned long);
+  arg3 = va_arg (arg, unsigned long);
+  arg4 = va_arg (arg, unsigned long);
+  arg5 = va_arg (arg, unsigned long);
+  arg6 = va_arg (arg, unsigned long);
+  va_end (arg);
+
+  ret = INTERNAL_SYSCALL_NCS (syscall_number, 6, arg1, arg2, arg3, arg4,
+			      arg5, arg6);
+
Quoted 8 lines

sysdeps/unix/sysv/linux/or1k/syscall.c line 45

Quoted 5 lines
sysdeps/unix/sysv/linux/or1k/syscall.c new file +5 -0
+  if (INTERNAL_SYSCALL_ERROR_P (ret))
+    return __syscall_error (ret);
+
+  return ret;
+}

Likewise, this should use unsigned long int. I suspect you can use INTERNAL_SYSCALL_CALL directly, too.

OK.

Quoted 6 lines
Quoted 5 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +0 -0
new file mode 100644
index 0000000000..3b681e14aa
Quoted 14 lines

sysdeps/unix/sysv/linux/or1k/sysdep.c line 33

Quoted 12 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +12 -0
+long __syscall_error (long err);
+hidden_proto (__syscall_error)
+
+/* This routine is jumped to by all the syscall handlers, to stash
+   an error number into errno.  */
+long
+__syscall_error (long err)
+{
+  __set_errno (- err);
+  return -1;
+}
+hidden_def (__syscall_error)

Should use long int throughout. Also applies to sysdep.h below.

OK. I will update.

Quoted 6 lines
Quoted 6 lines
sysdeps/unix/sysv/linux/syscall-names.list +0 -0
index 21a62a06f4..fa434fd477 100644
@@ -296,6 +296,7 @@ open_by_handle_at
 open_tree
Quoted 8 lines

sysdeps/unix/sysv/linux/syscall-names.list open_by_handle_at · line 302

Quoted 6 lines
sysdeps/unix/sysv/linux/syscall-names.list +1 -0
 openat
 openat2
+or1k_atomic
 osf_adjtime
 osf_afs_syscall
 osf_alt_plock

Please post this separately, it can go in immediately.

OK, I will split it out.

Quoted 4 lines

This is not a complete review; I can't comment on the architecture-specific bits, the atomics, and the math interfaces.

There are a few TODOs/TO-DOs left, please have a look.

OK, I will look, must have missed them.

Quoted 4 lines

You also need to document which ABIs are supported (in INSTALL, with a brief entry in NEWS). Are any specific GCC and binutils version requirements, or kernel header requirements (beyond the already documented minimums)?

OK.

For binutils and gcc require patches which are mentioned in the cover letter. I will document.

Quoted 2 lines

I see a bunch of ifdef's for hard float, but this appears to be a hard-float-only port.

I should support both hard fliat and soft float, but have not tested soft float yet. Let me test to see what would break.

Thanks for the review, I am happy that I can remove a lot of code and clean up the port even more. I am also happy that a lot of the upstream glibc work has been going on to move arch specific parts to generic code, I think you are making great progress.

-Stafford

#4 lore raw

PATCH 1/1 Initial support for OpenRISC

Quoted 2 lines · Stafford Horne via Libc-alpha

For binutils and gcc require patches which are mentioned in the cover letter. I will document.

In my view the changes need to be upstream before the patch can go into glibc. We want to avoid the mess we had with MicroBlaze where the port turned out to depend on GCC patches that hadn't yet been upstreamed.

Signature · 2 lines
Joseph S. Myers
joseph at codesourcery.com
#5 lore raw

PATCH 1/1 Initial support for OpenRISC

Quoted 8 lines · Joseph Myers
Quoted 2 lines · Stafford Horne via Libc-alpha

For binutils and gcc require patches which are mentioned in the cover letter. I will document.

In my view the changes need to be upstream before the patch can go into glibc. We want to avoid the mess we had with MicroBlaze where the port turned out to depend on GCC patches that hadn't yet been upstreamed.

Notes, I don't think that will be a problem. Binutils patches are already upstream. The GCC patches should be too before I send the V2 series (I just need to push them).

-Stafford

#6 lore raw

PATCH 1/1 Initial support for OpenRISC

Quoted 6 lines · Stafford Horne
Quoted 5 lines · Joseph Myers
Quoted 2 lines · Stafford Horne via Libc-alpha

For binutils and gcc require patches which are mentioned in the cover letter. I will document.

Quoted 7 lines
Quoted 3 lines

In my view the changes need to be upstream before the patch can go into glibc. We want to avoid the mess we had with MicroBlaze where the port turned out to depend on GCC patches that hadn't yet been upstreamed.

Notes, I don't think that will be a problem. Binutils patches are already upstream. The GCC patches should be too before I send the V2 series (I just need to push them).

Hi All,

Just an update on this series. I have made all of the changes but the updates to new kernel API's are making quite a new test fail. Mostly these are environmental issues that I need to sort out.

My todo list now is:

- Sort out all new failures
- Sort out the FPU failures (I may mail asking for help on that)
- Go though all files again to ensure what is and isn't needed (i.e. removed due to upstream refactorings)
- Update the wiki pages as required by NewPorts

It's going to take me a bit longer than I expected to get v2 out.

-Stafford