Glibc OpenRISC port
v2 cover Glibc OpenRISC port
This is the OpenRISC port for glibc that I have been working on.
Changes since v1:
- Update api's as suggested by Florian
- Remove hard float support
- Updates to get all tests passing
- Split patch into managable bits similar to recent ARC port
Documentation:
Architecture / ABI docs:
https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf
Test Results:
build-many-glibcs.py:
Both with mainline ang gcc-11.
Summary of test results:
1252 PASS
15 XFAIL
Full test suite:
The full suite is running using the gcc-11 branch of GCC, mainline shows issues with math soft-fp.
1 FAIL
4056 PASS
28 UNSUPPORTED
18 XFAIL
tst-tzset.out: https://gist.github.com/stffrdhrn/5a49696cbf9bda342c52162a4950e4f2
tests.sum: https://gist.github.com/stffrdhrn/9663c91ae65865e5323b946d0f2d1a3e Note, I have some extra patches to get this to work:
Branch: https://github.com/stffrdhrn/or1k-glibc/commits/or1k-port-2
Patches:
2021-11-13 a45ab06431 Stafford Horne support: Workaround gcc float rounding error
2021-11-13 1cb553ff2b Stafford Horne malloc: Fix malloc debug for 2.35 onwards
2021-11-13 864ac06370 Stafford Horne resolv: Fix tests by aligning hand
I have posted these before to the list, they are not architecture specific issues, but things that need to be resolved in gcc or glibc.
Stafford Horne (13):
elf: Add reloc for OpenRISC
linux/syscalls: Add or1k_atomic syscall for OpenRISC
or1k: ABI Implementation
or1k: startup and dynamic linking code
or1k: Thread Local Storage support
or1k: Atomics and Locking primitives
or1k: math soft float support
or1k: Linux Syscall Interface
or1k: Linux ABI
or1k: ABI lists
or1k: Build Infrastructure build-many-glibcs.py: add OpenRISC support Documentation for OpenRISC port
NEWS | 2 + README | 1 + elf/elf.h | 37 + scripts/build-many-glibcs.py | 5 + sysdeps/or1k/Implies | 3 + sysdeps/or1k/Makefile | 7 + sysdeps/or1k/__longjmp.S | 55 + sysdeps/or1k/atomic-machine.h | 79 + sysdeps/or1k/bits/endianness.h | 11 + sysdeps/or1k/bits/fenv.h | 68 + sysdeps/or1k/bits/link.h | 50 + sysdeps/or1k/bits/setjmp.h | 32 + sysdeps/or1k/bsd-_setjmp.S | 1 + sysdeps/or1k/bsd-setjmp.S | 1 + sysdeps/or1k/dl-machine.h | 323 +++ sysdeps/or1k/dl-start.S | 98 + sysdeps/or1k/dl-tls.h | 26 + sysdeps/or1k/dl-trampoline.S | 79 + 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 | 1112 +++++++++ sysdeps/or1k/libm-test-ulps-name | 1 + sysdeps/or1k/machine-gmon.h | 35 + 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/pthreaddef.h | 35 + sysdeps/or1k/nptl/tcb-offsets.sym | 6 + sysdeps/or1k/nptl/tls.h | 189 ++ sysdeps/or1k/preconfigure | 34 + sysdeps/or1k/setjmp.S | 56 + sysdeps/or1k/sfp-machine.h | 93 + sysdeps/or1k/sotruss-lib.c | 51 + sysdeps/or1k/stackinfo.h | 33 + sysdeps/or1k/start.S | 99 + sysdeps/or1k/sysdep.h | 82 + sysdeps/or1k/tininess.h | 1 + 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 | 320 +++ sysdeps/unix/sysv/linux/or1k/bits/procfs.h | 38 + sysdeps/unix/sysv/linux/or1k/bits/timesize.h | 19 + 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 + sysdeps/unix/sysv/linux/or1k/kernel_stat.h | 24 + sysdeps/unix/sysv/linux/or1k/ld.abilist | 5 + .../sysv/linux/or1k/libBrokenLocale.abilist | 1 + sysdeps/unix/sysv/linux/or1k/libanl.abilist | 1 + sysdeps/unix/sysv/linux/or1k/libc.abilist | 2122 +++++++++++++++++ .../sysv/linux/or1k/libc_malloc_debug.abilist | 26 + sysdeps/unix/sysv/linux/or1k/libcrypt.abilist | 2 + sysdeps/unix/sysv/linux/or1k/libdl.abilist | 0 sysdeps/unix/sysv/linux/or1k/libm.abilist | 759 ++++++ sysdeps/unix/sysv/linux/or1k/libnsl.abilist | 121 + .../unix/sysv/linux/or1k/libpthread.abilist | 0 .../unix/sysv/linux/or1k/libresolv.abilist | 55 + sysdeps/unix/sysv/linux/or1k/librt.abilist | 0 .../unix/sysv/linux/or1k/libthread_db.abilist | 40 + sysdeps/unix/sysv/linux/or1k/libutil.abilist | 1 + sysdeps/unix/sysv/linux/or1k/localplt.data | 14 + sysdeps/unix/sysv/linux/or1k/makecontext.c | 77 + sysdeps/unix/sysv/linux/or1k/mmap_internal.h | 30 + sysdeps/unix/sysv/linux/or1k/or1k_clone.S | 89 + sysdeps/unix/sysv/linux/or1k/setcontext.S | 108 + 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/ucontext.h | 53 + 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 | 195 ++ sysdeps/unix/sysv/linux/or1k/ucontext_i.sym | 26 + sysdeps/unix/sysv/linux/syscall-names.list | 1 + 85 files changed, 7660 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/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/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/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/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/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/procfs.h create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/timesize.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_stat.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/libc_malloc_debug.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/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/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/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.31.1
PATCH v2 1/13 elf: Add reloc for OpenRISC
--- elf/elf.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
elf/elf.h +37 -0
@@ -4119,4 +4119,41 @@ 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 +#endif /* elf.h */
Signature · 1 line
2.31.1
PATCH v2 2/13 linux/syscalls: Add or1k_atomic syscall for OpenRISC
In reply to Stafford Horne--- sysdeps/unix/sysv/linux/syscall-names.list | 1 + 1 file changed, 1 insertion(+)
sysdeps/unix/sysv/linux/syscall-names.list +1 -0
@@ -304,6 +304,7 @@ open_by_handle_at open_tree openat openat2 +or1k_atomic osf_adjtime osf_afs_syscall osf_alt_plock
Signature · 1 line
2.31.1
PATCH v2 3/13 or1k: ABI Implementation
In reply to Stafford HorneThis code deals with the OpenRISC ABI.
--- sysdeps/or1k/__longjmp.S | 55 +++++++++++++++++++++++ sysdeps/or1k/bits/endianness.h | 11 +++++ sysdeps/or1k/bits/setjmp.h | 32 +++++++++++++ sysdeps/or1k/bsd-_setjmp.S | 1 + sysdeps/or1k/bsd-setjmp.S | 1 + sysdeps/or1k/dl-trampoline.S | 79 ++++++++++++++++++++++++++++++++ sysdeps/or1k/jmpbuf-offsets.h | 23 ++++++++++ sysdeps/or1k/jmpbuf-unwind.h | 35 +++++++++++++++ sysdeps/or1k/machine-gmon.h | 35 +++++++++++++++ sysdeps/or1k/memusage.h | 20 +++++++++ sysdeps/or1k/setjmp.S | 56 +++++++++++++++++++++++ sysdeps/or1k/sysdep.h | 82 ++++++++++++++++++++++++++++++++++ 12 files changed, 430 insertions(+) create mode 100644 sysdeps/or1k/__longjmp.S create mode 100644 sysdeps/or1k/bits/endianness.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-trampoline.S create mode 100644 sysdeps/or1k/jmpbuf-offsets.h create mode 100644 sysdeps/or1k/jmpbuf-unwind.h create mode 100644 sysdeps/or1k/machine-gmon.h create mode 100644 sysdeps/or1k/memusage.h create mode 100644 sysdeps/or1k/setjmp.S create mode 100644 sysdeps/or1k/sysdep.h
sysdeps/or1k/__longjmp.S new file +55 -0
@@ -0,0 +1,55 @@ +/* longjmp, OpenRISC version. + Copyright (C) 2021 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. */ + +#include <features.h> +#define _ASM +#define _SETJMP_H +#include <bits/setjmp.h> + + .globl __longjmp; + .type __longjmp, @function; + .align 4; + +__longjmp: + l.lwz r1, 0(r3) + l.lwz r2, 4(r3) + + /* if r4 is 0, something wrong, so set it to 1 */ + l.sfeqi r4, 0x0 + l.bnf 1f /* r4 != 0, longjmp value sensible */ + l.nop + l.ori r4, r0, 0x1 /* make nonzero */ +1: + l.addi r11, r4, 0 + l.lwz r9, 8(r3) + l.lwz r10, 12(r3) + l.lwz r14, 16(r3) + l.lwz r16, 20(r3) + l.lwz r18, 24(r3) + l.lwz r20, 28(r3) + l.lwz r22, 32(r3) + l.lwz r24, 36(r3) + l.lwz r26, 40(r3) + l.lwz r28, 44(r3) + l.lwz r30, 48(r3) + l.jr r9 + l.nop + .size __longjmp, . - __longjmp + +libc_hidden_def(__longjmp)
sysdeps/or1k/bits/endianness.h new file +11 -0
@@ -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 + +/* OpenRISC is big-endian. */ +#define __BYTE_ORDER __BIG_ENDIAN + +#endif /* bits/endianness.h */
sysdeps/or1k/bits/setjmp.h new file +32 -0
@@ -0,0 +1,32 @@ +/* Define the machine-dependent type `jmp_buf'. OpenRISC version. +Copyright (C) 2021 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 + +#ifndef _ASM +typedef long int __jmp_buf [13 ]; +#endif + +#endif /* _OR1K_BITS_SETJMP_H */
sysdeps/or1k/bsd-_setjmp.S new file +1 -0
@@ -0,0 +1 @@ +/* _setjmp is in setjmp.S */
sysdeps/or1k/bsd-setjmp.S new file +1 -0
@@ -0,0 +1 @@ +/* setjmp is in setjmp.S */
sysdeps/or1k/dl-trampoline.S new file +79 -0
79 lines not on this page · raw message
sysdeps/or1k/jmpbuf-offsets.h new file +23 -0
@@ -0,0 +1,23 @@ +/* Private macros for accessing __jmp_buf contents. OpenRISC version. +Copyright (C) 2021 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
@@ -0,0 +1,35 @@ +/* Copyright (C) 2021 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/machine-gmon.h new file +35 -0
@@ -0,0 +1,35 @@ +/* Machine-dependent definitions for profiling support. OpenRISC version. +Copyright (C) 2021 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 <sysdep.h> + +#define _MCOUNT_DECL (frompc, selfpc) \ +static void \ +__mcount_internal (unsigned long int frompc, unsigned long int selfpc) + +/* This is very simple as gcc does all the heavy lifting at the _mcount +call site. GCC passes in the return address of the function calling +_mcount. */ + +#define MCOUNT \ +void \ +_mcount (void *frompc) \ +{ \ + __mcount_internal ((unsigned long int) frompc, \ + (unsigned long int) __builtin_return_address (0)); \ +}
sysdeps/or1k/memusage.h new file +20 -0
@@ -0,0 +1,20 @@ +/* Copyright (C) 2021 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/setjmp.S new file +56 -0
56 lines not on this page · raw message
sysdeps/or1k/sysdep.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 3/13 or1k: ABI Implementation
Quoted 1 line · Stafford Horne via Libc-alpha
+/* Helper for generic
____longjmp_chk(). */
Don't use () after a function name just to indicate it's a function, as opposed to a function call with no arguments (see the GNU Coding Standards).
Signature · 2 lines
Joseph S. Myers joseph at codesourcery.com
PATCH v2 3/13 or1k: ABI Implementation
Quoted 7 lines · Joseph Myers
Quoted 1 line · Stafford Horne via Libc-alpha
+/* Helper for generic
____longjmp_chk(). */Don't use () after a function name just to indicate it's a function, as opposed to a function call with no arguments (see the GNU Coding Standards).
OK, sorry about that, I know this but didn't remember when going though the patch on my own. I will go through and clean this up.
-Stafford
PATCH v2 4/13 or1k: startup and dynamic linking code
In reply to Stafford HorneCode for C runtime startup and dynamic loading including PLT layout.
--- sysdeps/or1k/bits/link.h | 50 ++++++ sysdeps/or1k/dl-machine.h | 323 +++++++++++++++++++++++++++++++++++++ sysdeps/or1k/dl-start.S | 98 +++++++++++ sysdeps/or1k/ldsodefs.h | 40 +++++ sysdeps/or1k/sotruss-lib.c | 51 ++++++ sysdeps/or1k/start.S | 99 ++++++++++++ sysdeps/or1k/tst-audit.h | 24 +++ 7 files changed, 685 insertions(+) create mode 100644 sysdeps/or1k/bits/link.h create mode 100644 sysdeps/or1k/dl-machine.h create mode 100644 sysdeps/or1k/dl-start.S create mode 100644 sysdeps/or1k/ldsodefs.h create mode 100644 sysdeps/or1k/sotruss-lib.c create mode 100644 sysdeps/or1k/start.S create mode 100644 sysdeps/or1k/tst-audit.h
sysdeps/or1k/bits/link.h new file +50 -0
@@ -0,0 +1,50 @@ +/* Copyright (C) 2021 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 _LINK_H +# error "Never include <bits/link.h> directly; use <link.h> instead." +#endif + +/* Registers for entry into PLT. */ +typedef struct La_or1k_regs +{ +uint32_t lr_reg[31 ]; +}La_or1k_regs ; + +/* Return values for calls from PLT. */ +typedef struct La_or1k_retval +{ +uint32_t lrv_r3; +}La_or1k_retval ; + +__BEGIN_DECLS + +extern ElfW(Addr) la_or1k_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_or1k_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_or1k_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx, +uintptr_t *__refcook, +uintptr_t *__defcook, +const La_or1k_regs *__inregs, +La_or1k_retval *__outregs, +const char *__symname); + +__END_DECLS
sysdeps/or1k/dl-machine.h new file +323 -0
323 lines not on this page · raw message
sysdeps/or1k/dl-start.S new file +98 -0
98 lines not on this page · raw message
sysdeps/or1k/ldsodefs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* Run-time dynamic linker data structures for loaded ELF shared objects. +Copyright (C) 2021 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_LDSODEFS_H +#define _OR1K_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/sotruss-lib.c new file +51 -0
51 lines not on this page · raw message
sysdeps/or1k/start.S new file +99 -0
99 lines not on this page · raw message
sysdeps/or1k/tst-audit.h new file +24 -0
@@ -0,0 +1,24 @@ +/* Definitions for testing PLT entry/exit auditing. OpenRISC version. +Copyright (C) 2021 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 pltenter la_or1k_gnu_pltenter +#define pltexit la_or1k_gnu_pltexit +#define La_regs La_or1k_regs +#define La_retval La_or1k_retval +#define int_retval lrv_r3
Signature · 1 line
2.31.1
PATCH v2 5/13 or1k: Thread Local Storage support
In reply to Stafford HorneOpenRISC includes 3 TLS addressing models. Local Dynamic optimizations are not done in the linker and therefore use the same code sequences as Global Dynamic.
--- sysdeps/or1k/dl-tls.h | 26 ++++ sysdeps/or1k/libc-tls.c | 32 +++++ sysdeps/or1k/nptl/tcb-offsets.sym | 6 + sysdeps/or1k/nptl/tls.h | 189 ++++++++++++++++++++++++++++++ sysdeps/or1k/stackinfo.h | 33 ++++++ 5 files changed, 286 insertions(+) create mode 100644 sysdeps/or1k/dl-tls.h create mode 100644 sysdeps/or1k/libc-tls.c create mode 100644 sysdeps/or1k/nptl/tcb-offsets.sym create mode 100644 sysdeps/or1k/nptl/tls.h create mode 100644 sysdeps/or1k/stackinfo.h
sysdeps/or1k/dl-tls.h new file +26 -0
@@ -0,0 +1,26 @@ +/* Copyright (C) 2021 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/libc-tls.c new file +32 -0
@@ -0,0 +1,32 @@ +/* Copyright (C) 2021 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/nptl/tcb-offsets.sym new file +6 -0
@@ -0,0 +1,6 @@ +#include <sysdep.h> +#include <tls.h> + +MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) +TID_OFFSET offsetof (struct pthread, tid) +TP_TO_PTHREAD_OFFSET -(sizeof (struct pthread) + sizeof (tcbhead_t))
sysdeps/or1k/nptl/tls.h new file +189 -0
189 lines not on this page · raw message
sysdeps/or1k/stackinfo.h new file +33 -0
@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 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/>. */ + +/* This file contains a bit of information about the stack allocation +of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +#include <elf.h> + +/* On or1k the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is +* present, but it is presumed absent. */ +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) + +#endif /* stackinfo.h */
Signature · 1 line
2.31.1
PATCH v2 5/13 or1k: Thread Local Storage support
sysdeps/or1k/dl-tls.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/or1k/dl-tls.h new file +1
-0@@ -0,0 +1,26 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc.
Each file should have a one-line description on the line before the copyright notice.
sysdeps/or1k/libc-tls.c line 1
Quoted 7 lines
sysdeps/or1k/libc-tls.c new file +1
-0@@ -0,0 +1,32 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc.
Likewise.
sysdeps/or1k/stackinfo.h line 1
Quoted 7 lines
sysdeps/or1k/stackinfo.h new file +1
-0@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc.
Likewise.
sysdeps/or1k/stackinfo.h line 30
Quoted 2 lines
sysdeps/or1k/stackinfo.h new file +2
-0+/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is +* present, but it is presumed absent. */
We don't use '*' at the start of second and subsequent lines of comments.
(It seems unfortunate for a new port to default to executable stacks, but it looks like this is indeed what the Linux kernel port to OpenRISC does, given the lack of an override of the default VM_DATA_DEFAULT_FLAGS and VM_STACK_DEFAULT_FLAGS.)
Signature · 2 lines
Joseph S. Myers joseph at codesourcery.com
PATCH v2 5/13 or1k: Thread Local Storage support
Quoted 12 lines · Joseph Myers
sysdeps/or1k/dl-tls.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/or1k/dl-tls.h new file +1
-0@@ -0,0 +1,26 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc. Each file should have a one-line description on the line before the copyright notice.
OK, I went through the patch's and made sure I have this on all .c .h and .S files.
Quoted 20 lines
sysdeps/or1k/libc-tls.c line 1
Quoted 7 lines
sysdeps/or1k/libc-tls.c new file +1
-0@@ -0,0 +1,32 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc. Likewise.
sysdeps/or1k/stackinfo.h line 1
Quoted 7 lines
sysdeps/or1k/stackinfo.h new file +1
-0@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc. Likewise.
Quoted 4 lines
sysdeps/or1k/stackinfo.h line 30
Quoted 2 lines
sysdeps/or1k/stackinfo.h new file +2
-0+/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is +* present, but it is presumed absent. */ We don't use '*' at the start of second and subsequent lines of comments.
OK, I went through the patch and tried to sort all of these occurances out. Also there were a few where we didn't have two spaces after period ".". Also, a few other similar issues.
Quoted 4 lines
(It seems unfortunate for a new port to default to executable stacks, but it looks like this is indeed what the Linux kernel port to OpenRISC does, given the lack of an override of the default
VM_DATA_DEFAULT_FLAGSandVM_STACK_DEFAULT_FLAGS.)
Yes.
Thanks for reviewing.
-Stafford
PATCH v2 6/13 or1k: Atomics and Locking primitives
In reply to Stafford Horne--- sysdeps/or1k/atomic-machine.h | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sysdeps/or1k/atomic-machine.h
sysdeps/or1k/atomic-machine.h new file +79 -0
@@ -0,0 +1,79 @@ +/* Atomic operations. OpenRISC version. +Copyright (C) 2021 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_ATOMIC_H_ +#define __OR1K_ATOMIC_H_ + +#include <stdint.h> + +typedef int32_t atomic32_t ; +typedef uint32_t uatomic32_t ; + +typedef intptr_t atomicptr_t ; +typedef uintptr_t uatomicptr_t ; +typedef intmax_t atomic_max_t ; +typedef uintmax_t uatomic_max_t ; + +#define __HAVE_64B_ATOMICS 0 +#define USE_ATOMIC_COMPILER_BUILTINS 1 +#define ATOMIC_EXCHANGE_USES_CAS 1 + +#define __arch_compare_and_exchange_bool_8_int (mem, newval, oldval, model) \ + (abort (), 0) + +#define __arch_compare_and_exchange_bool_16_int (mem, newval, oldval, model) \ + (abort (), 0) + +#define __arch_compare_and_exchange_bool_32_int (mem, newval, oldval, model) \ + ({ \ + typeof (*mem) __oldval = (oldval); \ + !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \ + model, __ATOMIC_RELAXED); \ + }) + +#define __arch_compare_and_exchange_bool_64_int (mem, newval, oldval, model) \ + (abort (), 0) + +#define __arch_compare_and_exchange_val_8_int (mem, newval, oldval, model) \ + (abort (), (__typeof (*mem)) 0) + +#define __arch_compare_and_exchange_val_16_int (mem, newval, oldval, model) \ + (abort (), (__typeof (*mem)) 0) + +#define __arch_compare_and_exchange_val_32_int (mem, newval, oldval, model) \ + ({ \ + typeof (*mem) __oldval = (oldval); \ + __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \ + model, __ATOMIC_RELAXED); \ + __oldval; \ + }) + +#define __arch_compare_and_exchange_val_64_int (mem, newval, oldval, model) \ + (abort (), (__typeof (*mem)) 0) + +#define atomic_compare_and_exchange_bool_acq (mem, new, old) \ + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \ + mem, new, old, __ATOMIC_ACQUIRE) + +#define atomic_compare_and_exchange_val_acq (mem, new, old) \ + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \ + mem, new, old, __ATOMIC_ACQUIRE) + +#define atomic_full_barrier () ({ asm volatile ("l.msync" ::: "memory"); }) + +#endif /* atomic-machine.h */
Signature · 1 line
2.31.1
PATCH v2 7/13 or1k: math soft float support
In reply to Stafford HorneOpenRISC support hard float but I will like to submit that after glibc soft float goes upstream. The hard float support depends on adding user access to the FPCSR, which is not supported by the kernel yet.
--- sysdeps/or1k/bits/fenv.h | 68 ++ sysdeps/or1k/libm-test-ulps | 1112 ++++++++++++++++++++ sysdeps/or1k/libm-test-ulps-name | 1 + sysdeps/or1k/nofpu/math-tests-exceptions.h | 29 + sysdeps/or1k/nofpu/math-tests-rounding.h | 28 + sysdeps/or1k/sfp-machine.h | 93 ++ sysdeps/or1k/tininess.h | 1 + 7 files changed, 1332 insertions(+) create mode 100644 sysdeps/or1k/bits/fenv.h create mode 100644 sysdeps/or1k/libm-test-ulps create mode 100644 sysdeps/or1k/libm-test-ulps-name 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/sfp-machine.h create mode 100644 sysdeps/or1k/tininess.h
sysdeps/or1k/bits/fenv.h new file +68 -0
@@ -0,0 +1,68 @@ +/* Copyright (C) 2021 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 _FENV_H +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." +#endif + +/* Define bits representing exceptions in the FPCSR status word. */ +enum + { + FE_OVERFLOW = +#define FE_OVERFLOW 1 << 3 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 1 << 4 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 1 << 8 + FE_INEXACT, + FE_INVALID = +#define FE_INVALID 1 << 9 + FE_INVALID, + FE_DIVBYZERO = +#define FE_DIVBYZERO 1 << 11 + FE_DIVBYZERO, + }; + +/* All supported exceptions. */ +#define FE_ALL_EXCEPT \ + (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) + +/* Define bits representing rounding modes in the FPCSR Rmode field. */ +#define FE_TONEAREST (0x0 << 1) +#define FE_TOWARDZERO (0x1 << 1) +#define FE_UPWARD (0x2 << 1) +#define FE_DOWNWARD (0x3 << 1) + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t ; + +/* Type representing floating-point environment. */ +typedef unsigned int fenv_t ; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((const fenv_t *) -1l) + +#if __GLIBC_USE (IEC_60559_BFP_EXT ) +/* Type representing floating-point control modes. */ +typedef unsigned int femode_t ; + +/* Default floating-point control modes. */ +# define FE_DFL_MODE ((const femode_t *) -1L) +#endif
sysdeps/or1k/libm-test-ulps new file +1112 -0
1,112 lines not on this page · raw message
sysdeps/or1k/libm-test-ulps-name new file +1 -0
@@ -0,0 +1 @@ +OpenRISC
sysdeps/or1k/nofpu/math-tests-exceptions.h new file +29 -0
@@ -0,0 +1,29 @@ +/* Configuration for math tests: support for exceptions. OpenRISC no-FPU +version. +Copyright (C) 2021 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
@@ -0,0 +1,28 @@ +/* Configuration for math tests: rounding mode support. OpenRISC no-FPU +version. +Copyright (C) 2021 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/sfp-machine.h new file +93 -0
93 lines not on this page · raw message
sysdeps/or1k/tininess.h new file +1 -0
@@ -0,0 +1 @@ +#define TININESS_AFTER_ROUNDING 1
Signature · 1 line
2.31.1
PATCH v2 7/13 or1k: math soft float support
sysdeps/or1k/bits/fenv.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/or1k/bits/fenv.h new file +1
-0@@ -0,0 +1,68 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc.
Missing one-line description at start of file.
The constants you're defining here seem to be specific to hard float, but they're defined unconditionally. Is this because you use the same ABI for hard float and soft float (which is generally the case when such hard float constants might be defined for soft float as well - a soft float compilation could be using a hard float libc that supports those constants)?
sysdeps/or1k/bits/fenv.h line 27
Quoted 5 lines
sysdeps/or1k/bits/fenv.h new file +5
-0+/* Define bits representing exceptions in the FPCSR status word. */ +enum + { + FE_OVERFLOW = +#define FE_OVERFLOW 1 << 3
Macros need to be properly surrounded by parentheses so they always group as a single operand in any expression.
sysdeps/or1k/bits/fenv.h line 11
Quoted 5 lines
sysdeps/or1k/bits/fenv.h new file +5
-0+#define FP_EX_OVERFLOW 1 << 3 +#define FP_EX_UNDERFLOW 1 << 4 +#define FP_EX_INEXACT 1 << 8 +#define FP_EX_INVALID 1 << 9 +#define FP_EX_DIVZERO 1 << 11
Likewise in sfp-machine.h.
Signature · 2 lines
Joseph S. Myers [email protected]
PATCH v2 7/13 or1k: math soft float support
Quoted 11 lines · Joseph Myers
sysdeps/or1k/bits/fenv.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/or1k/bits/fenv.h new file +1
-0@@ -0,0 +1,68 @@ +/* Copyright (C) 2021 Free Software Foundation, Inc. Missing one-line description at start of file.
OK Added for v3.
Quoted 6 lines
The constants you're defining here seem to be specific to hard float, but they're defined unconditionally. Is this because you use the same ABI for hard float and soft float (which is generally the case when such hard float constants might be defined for soft float as well - a soft float compilation could be using a hard float libc that supports those constants)?
Yes, it's the same ABI. I have patches for hard float but am not submitting until the Linux side is sorted out as mentioned in the comment. It seems delcairing these conditionally was normal, hence I didn't mention anything about it.
I didn't think as far as allowing for shared libc usage between soft/float float, but I think that would work.
Quoted 9 lines
sysdeps/or1k/bits/fenv.h line 27
Quoted 5 lines
sysdeps/or1k/bits/fenv.h new file +5
-0+/* Define bits representing exceptions in the FPCSR status word. */ +enum + { + FE_OVERFLOW = +#define FE_OVERFLOW 1 << 3Macros need to be properly surrounded by parentheses so they always group as a single operand in any expression.
Quoted 7 lines
sysdeps/or1k/bits/fenv.h line 11
Quoted 5 lines
sysdeps/or1k/bits/fenv.h new file +5
-0+#define FP_EX_OVERFLOW 1 << 3 +#define FP_EX_UNDERFLOW 1 << 4 +#define FP_EX_INEXACT 1 << 8 +#define FP_EX_INVALID 1 << 9 +#define FP_EX_DIVZERO 1 << 11Likewise in
sfp-machine.h.
OK, I have cleaned those up.
Quoted 3 lines
Signature · 2 lines
Joseph S. Myers joseph at codesourcery.com
PATCH v2 8/13 or1k: Linux Syscall Interface
In reply to Stafford Horne--- sysdeps/unix/sysv/linux/or1k/arch-syscall.h | 320 ++++++++++++++++++ sysdeps/unix/sysv/linux/or1k/bits/timesize.h | 19 ++ sysdeps/unix/sysv/linux/or1k/clone.c | 59 ++++ sysdeps/unix/sysv/linux/or1k/ioctl.c | 40 +++ sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h | 41 +++ sysdeps/unix/sysv/linux/or1k/kernel_stat.h | 24 ++ sysdeps/unix/sysv/linux/or1k/mmap_internal.h | 30 ++ sysdeps/unix/sysv/linux/or1k/or1k_clone.S | 89 +++++ sysdeps/unix/sysv/linux/or1k/syscall.c | 45 +++ sysdeps/unix/sysv/linux/or1k/sysdep.c | 33 ++ sysdeps/unix/sysv/linux/or1k/sysdep.h | 195 +++++++++++ 11 files changed, 895 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/or1k/arch-syscall.h create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/timesize.h create mode 100644 sysdeps/unix/sysv/linux/or1k/clone.c 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_stat.h 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/syscall.c create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.c create mode 100644 sysdeps/unix/sysv/linux/or1k/sysdep.h
sysdeps/unix/sysv/linux/or1k/arch-syscall.h new file +320 -0
@@ -0,0 +1,320 @@ +/* AUTOGENERATED by update-syscall-lists.py. */ +#define __NR_accept 202 +#define __NR_accept4 242 +#define __NR_acct 89 +#define __NR_add_key 217 +#define __NR_adjtimex 171 +#define __NR_bind 200 +#define __NR_bpf 280 +#define __NR_brk 214 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_chdir 49 +#define __NR_chroot 51 +#define __NR_clock_adjtime 266 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres 114 +#define __NR_clock_getres_time64 406 +#define __NR_clock_gettime 113 +#define __NR_clock_gettime64 403 +#define __NR_clock_nanosleep 115 +#define __NR_clock_nanosleep_time64 407 +#define __NR_clock_settime 112 +#define __NR_clock_settime64 404 +#define __NR_clone 220 +#define __NR_clone3 435 +#define __NR_close 57 +#define __NR_close_range 436 +#define __NR_connect 203 +#define __NR_copy_file_range 285 +#define __NR_delete_module 106 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_epoll_pwait2 441 +#define __NR_eventfd2 19 +#define __NR_execve 221 +#define __NR_execveat 281 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_faccessat 48 +#define __NR_faccessat2 439 +#define __NR_fadvise64_64 223 +#define __NR_fallocate 47 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_fchdir 50 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchown 55 +#define __NR_fchownat 54 +#define __NR_fcntl64 25 +#define __NR_fdatasync 83 +#define __NR_fgetxattr 10 +#define __NR_finit_module 273 +#define __NR_flistxattr 13 +#define __NR_flock 32 +#define __NR_fremovexattr 16 +#define __NR_fsconfig 431 +#define __NR_fsetxattr 7 +#define __NR_fsmount 432 +#define __NR_fsopen 430 +#define __NR_fspick 433 +#define __NR_fstat64 80 +#define __NR_fstatat64 79 +#define __NR_fstatfs64 44 +#define __NR_fsync 82 +#define __NR_ftruncate64 46 +#define __NR_futex 98 +#define __NR_futex_time64 422 +#define __NR_get_mempolicy 236 +#define __NR_get_robust_list 100 +#define __NR_getcpu 168 +#define __NR_getcwd 17 +#define __NR_getdents64 61 +#define __NR_getegid 177 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getgroups 158 +#define __NR_getitimer 102 +#define __NR_getpeername 205 +#define __NR_getpgid 155 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getpriority 141 +#define __NR_getrandom 278 +#define __NR_getresgid 150 +#define __NR_getresuid 148 +#define __NR_getrlimit 163 +#define __NR_getrusage 165 +#define __NR_getsid 156 +#define __NR_getsockname 204 +#define __NR_getsockopt 209 +#define __NR_gettid 178 +#define __NR_gettimeofday 169 +#define __NR_getuid 174 +#define __NR_getxattr 8 +#define __NR_init_module 105 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_init1 26 +#define __NR_inotify_rm_watch 28 +#define __NR_io_cancel 3 +#define __NR_io_destroy 1 +#define __NR_io_getevents 4 +#define __NR_io_pgetevents 292 +#define __NR_io_pgetevents_time64 416 +#define __NR_io_setup 0 +#define __NR_io_submit 2 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_io_uring_setup 425 +#define __NR_ioctl 29 +#define __NR_ioprio_get 31 +#define __NR_ioprio_set 30 +#define __NR_kcmp 272 +#define __NR_kexec_file_load 294 +#define __NR_kexec_load 104 +#define __NR_keyctl 219 +#define __NR_kill 129 +#define __NR_lgetxattr 9 +#define __NR_linkat 37 +#define __NR_listen 201 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_llseek 62 +#define __NR_lookup_dcookie 18 +#define __NR_lremovexattr 15 +#define __NR_lsetxattr 6 +#define __NR_madvise 233 +#define __NR_mbind 235 +#define __NR_membarrier 283 +#define __NR_memfd_create 279 +#define __NR_migrate_pages 238 +#define __NR_mincore 232 +#define __NR_mkdirat 34 +#define __NR_mknodat 33 +#define __NR_mlock 228 +#define __NR_mlock2 284 +#define __NR_mlockall 230 +#define __NR_mmap2 222 +#define __NR_mount 40 +#define __NR_mount_setattr 442 +#define __NR_move_mount 429 +#define __NR_move_pages 239 +#define __NR_mprotect 226 +#define __NR_mq_getsetattr 185 +#define __NR_mq_notify 184 +#define __NR_mq_open 180 +#define __NR_mq_timedreceive 183 +#define __NR_mq_timedreceive_time64 419 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_unlink 181 +#define __NR_mremap 216 +#define __NR_msgctl 187 +#define __NR_msgget 186 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_msync 227 +#define __NR_munlock 229 +#define __NR_munlockall 231 +#define __NR_munmap 215 +#define __NR_name_to_handle_at 264 +#define __NR_nanosleep 101 +#define __NR_nfsservctl 42 +#define __NR_open_by_handle_at 265 +#define __NR_open_tree 428 +#define __NR_openat 56 +#define __NR_openat2 437 +#define __NR_or1k_atomic 244 +#define __NR_perf_event_open 241 +#define __NR_personality 92 +#define __NR_pidfd_getfd 438 +#define __NR_pidfd_open 434 +#define __NR_pidfd_send_signal 424 +#define __NR_pipe2 59 +#define __NR_pivot_root 41 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_pkey_mprotect 288 +#define __NR_ppoll 73 +#define __NR_ppoll_time64 414 +#define __NR_prctl 167 +#define __NR_pread64 67 +#define __NR_preadv 69 +#define __NR_preadv2 286 +#define __NR_prlimit64 261 +#define __NR_process_madvise 440 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_pselect6 72 +#define __NR_pselect6_time64 413 +#define __NR_ptrace 117 +#define __NR_pwrite64 68 +#define __NR_pwritev 70 +#define __NR_pwritev2 287 +#define __NR_quotactl 60 +#define __NR_read 63 +#define __NR_readahead 213 +#define __NR_readlinkat 78 +#define __NR_readv 65 +#define __NR_reboot 142 +#define __NR_recvfrom 207 +#define __NR_recvmmsg 243 +#define __NR_recvmmsg_time64 417 +#define __NR_recvmsg 212 +#define __NR_remap_file_pages 234 +#define __NR_removexattr 14 +#define __NR_renameat 38 +#define __NR_renameat2 276 +#define __NR_request_key 218 +#define __NR_restart_syscall 128 +#define __NR_rseq 293 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_getaffinity 123 +#define __NR_sched_getattr 275 +#define __NR_sched_getparam 121 +#define __NR_sched_getscheduler 120 +#define __NR_sched_rr_get_interval 127 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_sched_setaffinity 122 +#define __NR_sched_setattr 274 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_yield 124 +#define __NR_seccomp 277 +#define __NR_semctl 191 +#define __NR_semget 190 +#define __NR_semop 193 +#define __NR_semtimedop 192 +#define __NR_semtimedop_time64 420 +#define __NR_sendfile64 71 +#define __NR_sendmmsg 269 +#define __NR_sendmsg 211 +#define __NR_sendto 206 +#define __NR_set_mempolicy 237 +#define __NR_set_robust_list 99 +#define __NR_set_tid_address 96 +#define __NR_setdomainname 162 +#define __NR_setfsgid 152 +#define __NR_setfsuid 151 +#define __NR_setgid 144 +#define __NR_setgroups 159 +#define __NR_sethostname 161 +#define __NR_setitimer 103 +#define __NR_setns 268 +#define __NR_setpgid 154 +#define __NR_setpriority 140 +#define __NR_setregid 143 +#define __NR_setresgid 149 +#define __NR_setresuid 147 +#define __NR_setreuid 145 +#define __NR_setrlimit 164 +#define __NR_setsid 157 +#define __NR_setsockopt 208 +#define __NR_settimeofday 170 +#define __NR_setuid 146 +#define __NR_setxattr 5 +#define __NR_shmat 196 +#define __NR_shmctl 195 +#define __NR_shmdt 197 +#define __NR_shmget 194 +#define __NR_shutdown 210 +#define __NR_sigaltstack 132 +#define __NR_signalfd4 74 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_splice 76 +#define __NR_statfs64 43 +#define __NR_statx 291 +#define __NR_swapoff 225 +#define __NR_swapon 224 +#define __NR_symlinkat 36 +#define __NR_sync 81 +#define __NR_sync_file_range 84 +#define __NR_syncfs 267 +#define __NR_sysinfo 179 +#define __NR_syslog 116 +#define __NR_tee 77 +#define __NR_tgkill 131 +#define __NR_timer_create 107 +#define __NR_timer_delete 111 +#define __NR_timer_getoverrun 109 +#define __NR_timer_gettime 108 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime 110 +#define __NR_timer_settime64 409 +#define __NR_timerfd_create 85 +#define __NR_timerfd_gettime 87 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_settime64 411 +#define __NR_times 153 +#define __NR_tkill 130 +#define __NR_truncate64 45 +#define __NR_umask 166 +#define __NR_umount2 39 +#define __NR_uname 160 +#define __NR_unlinkat 35 +#define __NR_unshare 97 +#define __NR_userfaultfd 282 +#define __NR_utimensat 88 +#define __NR_utimensat_time64 412 +#define __NR_vhangup 58 +#define __NR_vmsplice 75 +#define __NR_wait4 260 +#define __NR_waitid 95 +#define __NR_write 64 +#define __NR_writev 66
sysdeps/unix/sysv/linux/or1k/bits/timesize.h new file +19 -0
@@ -0,0 +1,19 @@ +/* Bit size of the time_t type at glibc build time, OpenRISC version. +Copyright (C) 2021 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 __TIMESIZE 64
sysdeps/unix/sysv/linux/or1k/clone.c new file +59 -0
59 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +40 -0
@@ -0,0 +1,40 @@ +/* Copyright (C) 2021 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 <sys/ioctl.h> +#include <sysdep.h> + +/* The or1k ABI uses stack for varargs, syscall uses registers. +This function moves arguments from varargs to registers. */ +int +__ioctl (int fd,unsigned long int request, ...) +{ +void *arg; +va_list ap; +int result; + +va_start (ap, request); + arg = va_arg (ap, void *); + + result =INLINE_SYSCALL (ioctl,3 , fd, request, arg); +va_end (ap); + +return result; +} +libc_hidden_def (__ioctl) +weak_alias (__ioctl, ioctl)
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_stat.h new file +24 -0
@@ -0,0 +1,24 @@ +/* Copyright (C) 2021-2021 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 <bits/wordsize.h> + +#define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 + +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 0
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +30 -0
@@ -0,0 +1,30 @@ +/* Common mmap definition for Linux implementation. OpenRISC version. +Copyright (C) 2021 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 +#define MMAP_OR1K_INTERNAL_LINUX_H + +/* OpenRISC Linux sets the page shift to 13 and mmap2 expects +offsets to be provided in 8K pages. Set MMAP2_PAGE_UNIT to -1 +to allow mmap_internal.h to determine the page size dynamically with +getpagesize. */ +#define MMAP2_PAGE_UNIT -1 + +#include_next <mmap_internal.h> + +#endif
sysdeps/unix/sysv/linux/or1k/or1k_clone.S new file +89 -0
89 lines not on this page · 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
@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 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 <sysdep.h> +#include <errno.h> + +long int __syscall_error (long int err); +hidden_proto (__syscall_error) + +/* This routine is jumped to by all the syscall handlers, to stash +an error number into errno. */ +long int +__syscall_error (long int err) +{ +__set_errno (- err); +return -1 ; +} +hidden_def (__syscall_error)
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +195 -0
195 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 8/13 or1k: Linux Syscall Interface
sysdeps/unix/sysv/linux/or1k/arch-syscall.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/unix/sysv/linux/or1k/arch-syscall.h new file +1
-0@@ -0,0 +1,320 @@ +/* AUTOGENERATED by update-syscall-lists.py. */
This file seems to be missing a definition of __NR_process_mrelease. Make sure you regenerate it with Linux 5.15, the current version used for syscall lists in glibc.
Signature · 2 lines
Joseph S. Myers joseph at codesourcery.com
PATCH v2 8/13 or1k: Linux Syscall Interface
Quoted 13 lines · Joseph Myers
sysdeps/unix/sysv/linux/or1k/arch-syscall.h line 1
Quoted 7 lines · Stafford Horne via Libc-alpha
sysdeps/unix/sysv/linux/or1k/arch-syscall.h new file +1
-0@@ -0,0 +1,320 @@ +/* AUTOGENERATED by update-syscall-lists.py. */ This file seems to be missing a definition of
__NR_process_mrelease. Make sure you regenerate it with Linux 5.15, the current version used for syscall lists in glibc.
Right, I will update. I have been trying to play catch up with upstream, I didn't update this yet.
-Stafford
PATCH v2 8/13 or1k: Linux Syscall Interface
In reply to Stafford HorneQuoted 1 line · Stafford Horne via Libc-alpha
+#define
__TIMESIZE64
Maybe we should refactor to make this the default for newer ports and make old ports to redefine it.
Quoted 30 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +24
-0@@ -0,0 +1,40 @@ +/* Copyright (C) 2021 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 <sys/ioctl.h> +#include <sysdep.h> + +/* The or1k ABI uses stack for varargs, syscall uses registers. +This function moves arguments from varargs to registers. */ +int
sysdeps/unix/sysv/linux/or1k/ioctl.c line 34
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +10
-0+__ioctl (int fd, unsigned long int request, ...) +{ + void *arg; +va_list ap; +int result; + +va_start (ap, request); + arg = va_arg (ap, void *); + + result =INLINE_SYSCALL (ioctl,3 , fd, request, arg);
Use INLINE_SYSCALL_CALL.
sysdeps/unix/sysv/linux/or1k/ioctl.c line 40
Quoted 6 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +6
-0+va_end (ap); + +return result; +} +libc_hidden_def (__ioctl) +weak_alias (__ioctl, ioctl)
I think it would be better to make it the default implementation. Unfortunately it might result in worse code, but I think the assumption on auto-generation syscall that varargs are always passed in register also fragile.
Quoted 37 lines
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h new file +31
-0@@ -0,0 +1,41 @@ +/* jump buffer constants, OpenRISC version. +Copyright (C) 2021 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/>. */ + +/* Produced by this program: + +#include <stdio.h> +#include <unistd.h> +#include <setjmp.h> +#include <stddef.h> + +int main (int argc, char **argv) +{ +printf ("#define JMP_BUF_SIZE %d\n", sizeof (jmp_buf)); +printf ("#define JMP_BUF_ALIGN %d\n", __alignof__ (jmp_buf)); +printf ("#define SIGJMP_BUF_SIZE %d\n", sizeof (sigjmp_buf)); +printf ("#define SIGJMP_BUF_ALIGN %d\n", __alignof__ (sigjmp_buf));
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h line 41
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h new file +10
-0+printf ("#define MASK_WAS_SAVED_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __mask_was_saved)); +printf ("#define SAVED_MASK_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __saved_mask)); +} */ + +#define JMP_BUF_SIZE 184 +#define JMP_BUF_ALIGN 4 +#define SIGJMP_BUF_SIZE 184 +#define SIGJMP_BUF_ALIGN 4 +#define MASK_WAS_SAVED_OFFSET 52 +#define SAVED_MASK_OFFSET 56
This is replicated for all architectures and it can be replaced with a gen-as-const-headers file. I will fix it upstream, so there won't be the need to add this new header.
Quoted 20 lines
sysdeps/unix/sysv/linux/or1k/kernel_stat.h new file +14
-0@@ -0,0 +1,24 @@ +/* Copyright (C) 2021-2021 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
sysdeps/unix/sysv/linux/or1k/kernel_stat.h line 24
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/kernel_stat.h new file +10
-0+ License along with the GNU C Library. If not, see + <https://www.gnu.org/licenses/>. */ + +#include <bits/wordsize.h> + +#define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 + +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 0
So the generic Linux interface only misses the STAT64_IS_KERNEL_STAT64, right? I think we can add it and thus or1k just need to ajust __STATFS_MATCHES_STATFS64.
Quoted 26 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +20
-0@@ -0,0 +1,30 @@ +/* Common mmap definition for Linux implementation. OpenRISC version. +Copyright (C) 2021 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 +#define MMAP_OR1K_INTERNAL_LINUX_H
sysdeps/unix/sysv/linux/or1k/mmap_internal.h line 30
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +10
-0+ +/* OpenRISC Linux sets the page shift to 13 and mmap2 expects +offsets to be provided in 8K pages. Set MMAP2_PAGE_UNIT to -1 +to allow mmap_internal.h to determine the page size dynamically with +getpagesize. */ +#define MMAP2_PAGE_UNIT -1 + +#include_next <mmap_internal.h> + +#endif
MMAP2_PAGE_UNIT set to -1 means the architecture supports multiple page size, but from the comment my understanding it only support 8k. If it where the case it would be simpler to just set MMAP2_PAGE_UNIT to 8192ULL.
As a side note, maybe arc should do it as well.
Quoted 136 lines
sysdeps/unix/sysv/linux/or1k/or1k_clone.S new file +89
-0@@ -0,0 +1,89 @@ +/* clone helper __or1k_clone for OpenRISC. + Copyright (C) 2021 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. */ + +#include <sysdep.h> +#include <tls.h> +#define __ASSEMBLY__ +#include <linux/sched.h> + + .text +ENTRY(__or1k_clone) + + /* To handle GCC varargs we need to use our __clone wrapper to pop + everything from the stack for us. + Now everything is placed in the registers which saves us a lot + of trouble. + + The userland implementation is: + + int clone (int (*fn)(void *), void *child_stack, + int flags, void *arg, pid_t *ptid, + struct user_desc *tls, pid_t *ctid); + The kernel entry is: + + int clone (long flags, void *child_stack, int *parent_tid, + int *child_tid, struct void *tls) + + NB: tls isn't really an argument, it is read from r7 directly. */ + + /* First, align the stack to 4 bytes. */ + l.xori r11, r0, -4 + l.and r4, r4, r11 + + /* Put 'fn', 'arg' and 'flags' on the child stack. */ + l.addi r4, r4, -12 + l.sw 8(r4), r3 + l.sw 4(r4), r6 + l.sw 0(r4), r5 + + l.ori r3, r5, 0 + /* The child_stack is already in r4. */ + l.ori r5, r7, 0 + l.lwz r6, 0(r1) + l.ori r7, r8, 0 + + DO_CALL (clone) + + l.sfgeui r11, 0xf001 + l.bf L(error) + l.nop + + /* If we are not the child, return the pid. */ + l.sfeqi r11, 0 + l.bf L(thread_start) + l.nop + + l.jr r9 + l.nop + +L(thread_start): + /* Load function from stack. */ + l.lwz r11, 8(r1) + l.jalr r11 + l.lwz r3, 4(r1) + + /* Exit the child thread. */ + l.ori r3, r11, 0 + DO_CALL (exit) + +L(error): + l.j SYSCALL_ERROR_NAME + l.ori r3, r11, 0 + +PSEUDO_END (__or1k_clone)sysdeps/unix/sysv/linux/or1k/syscall.c new file +35
-0@@ -0,0 +1,45 @@ +/* System call interface. OpenRISC version. +Copyright (C) 2021 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 <sysdep.h> +#include <stdarg.h> + +long int +syscall (long int syscall_number, ...) +{ +unsigned long int arg1, arg2, arg3, arg4, arg5, arg6; +va_list arg; +long int ret; + +va_start (arg, syscall_number); + arg1 = va_arg (arg, unsigned long int); + arg2 = va_arg (arg, unsigned long int); + arg3 = va_arg (arg, unsigned long int); + arg4 = va_arg (arg, unsigned long int); + arg5 = va_arg (arg, unsigned long int); + arg6 = va_arg (arg, unsigned long int);
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; +}
As for ioctl.c, I also think this should the set as the default implementation. It would allows us to remove the hppa version as well.
(maybe also add a INTERNAL_SYSCALL_CALL_NCS, to get rid of the requirement to pass the number of arguments).
Quoted 29 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +23
-0@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 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 <sysdep.h> +#include <errno.h> + +long int __syscall_error (long int 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 int +__syscall_error (long int err) +{ +__set_errno (- err); +return -1 ; +} +hidden_def (__syscall_error)
This is another thing I have in my backlog to cleanup: I think we also should move it to default implementation. The architectures that uses non standard call procedure already implement it with assembly routines.
Quoted 27 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +21
-0@@ -0,0 +1,195 @@ +/* Copyright (C) 2021 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 <sysdeps/or1k/sysdep.h> +#include <sysdeps/unix/sysv/linux/generic/sysdep.h> +#include <tls.h> +
sysdeps/unix/sysv/linux/or1k/sysdep.h line 31
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +10
-0+/* "workarounds" for generic code needing to handle 64-bit time_t. */ + +#undef __NR_clock_getres +#undef __NR_futex +#undef __NR_ppoll +#undef __NR_pselect6 +#undef __NR_recvmmsg +#undef __NR_rt_sigtimedwait +#undef __NR_semtimedop +#undef __NR_utimensat
I think we might need to update update-syscall-lists.py to *not* emit no emit 32-bit time syscalls if the architecture only exports 64-bit interfaces.
Quoted 165 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +164
-0+ +/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ +#define __NR_clock_getres __NR_clock_getres_time64 +/* Fix sysdeps/nptl/lowlevellock-futex.h. */ +#define __NR_futex __NR_futex_time64 +/* Fix sysdeps/unix/sysv/linux/pause.c. */ +#define __NR_ppoll __NR_ppoll_time64 +/* Fix sysdeps/unix/sysv/linux/select.c. */ +#define __NR_pselect6 __NR_pselect6_time64 +/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ +#define __NR_recvmmsg __NR_recvmmsg_time64 +/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ +#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ +#define __NR_semtimedop __NR_semtimedop_time64 +/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ +#define __NR_utimensat __NR_utimensat_time64 + +#undef SYS_ify +#define SYS_ify (syscall_name) (__NR_##syscall_name) + +/* Linux uses a negative return value to indicate syscall errors, +unlike most Unices, which use the condition codes' carry flag. + +Since version 2.1 the return value of a system call might be +negative even if the call succeeded. E.g., the `lseek' system call +might return a large offset. Therefore we must not anymore test +for < 0, but test for a real error by making sure the value in R0 +is a real error number. Linus said he will make sure the no syscall +returns a value in -1 .. -4095 as a valid result so we can safely +test with -4095. */ + +#ifdef __ASSEMBLER__ + +/* Macros used in syscall-template.S */ +#define ret l.jr r9; l.nop +#define ret_NOERRNO l.jr r9; l.nop + +#undef DO_CALL +#define DO_CALL (syscall_name) \ + l.addi r11, r0, SYS_ify (syscall_name); \ + l.sys 1; \ + l.nop + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name); \ + DO_CALL(syscall_name); \ + /* if -4096 < ret < 0 holds, it's an error */ \ + l.sfgeui r11, 0xf001; \ + l.bf L(pseudo_end); \ + l.nop + +#undef PSEUDO_NOERRNO +#define PSEUDO_NOERRNO (name, syscall_name, args) \ + ENTRY (name); \ + DO_CALL(syscall_name) + +#undef PSEUDO_END +#define PSEUDO_END (name) \ +L(pseudo_end): \ + l.j SYSCALL_ERROR_NAME; \ + l.ori r3,r11,0; \ + END (name) + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO (name) \ + END (name) + +#ifndef PIC +/* For static code, on error jump to __syscall_error directly. */ +# define SYSCALL_ERROR_NAME __syscall_error +#elif !IS_IN (libc) +/* Use the internal name for libc/libpthread shared objects. */ +# define SYSCALL_ERROR_NAME __GI___syscall_error +#else +/* Otherwise, on error do a full PLT jump. */ +# define SYSCALL_ERROR_NAME plt(__syscall_error) +#endif + +#else /* not __ASSEMBLER__ */ + +#include <errno.h> + +extern long int __syscall_error (long int neg_errno); + +/* Pointer mangling is not yet supported for or1k. */ +#define PTR_MANGLE (var) (void) (var) +#define PTR_DEMANGLE (var) (void) (var) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) + +/* The _NCS variant allows non-constant syscall numbers. */ +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + ({ unsigned long int __sys_result; \ + { \ + long int _sc_ret = (long int) number; \ + LOAD_ARGS_##nr (args) \ + register long int __sc_ret __asm__ ("r11") = _sc_ret; \ + __asm__ __volatile__ ("l.sys 1\n\t" \ + " l.nop\n\t" \ + : "+r" (__sc_ret) \ + : ASM_ARGS_##nr \ + : ASM_CLOBBERS_##nr \ + "r12", "r13", "r15", "r17", "r19", \ + "r21", "r23", "r25", "r27", "r29", \ + "r31", "memory"); \ + __sys_result = __sc_ret; \ + } \ + (long int) __sys_result; }) + +/* From here on we have nested macros that generate code for +* storing arguments to the syscall */ + +#define LOAD_ARGS_0 () + +#define ASM_ARGS_0 +#define ASM_CLOBBERS_0 "r3", ASM_CLOBBERS_1 + +#define LOAD_ARGS_1 (a) \ + long int _a = (long int)(a); \ + register long int __a __asm__ ("r3") = _a; +#define ASM_ARGS_1 "r" (__a) +#define ASM_CLOBBERS_1 "r4", ASM_CLOBBERS_2 + +#define LOAD_ARGS_2 (a, b) \ + long int _b = (long int)(b); \ + LOAD_ARGS_1 (a) \ + register long int __b __asm__ ("r4") = _b; +#define ASM_ARGS_2 ASM_ARGS_1, "r" (__b) +#define ASM_CLOBBERS_2 "r5", ASM_CLOBBERS_3 + +#define LOAD_ARGS_3 (a, b, c) \ + long int _c = (long int)(c); \ + LOAD_ARGS_2 (a, b) \ + register long int __c __asm__ ("r5") = _c; +#define ASM_ARGS_3 ASM_ARGS_2, "r" (__c) +#define ASM_CLOBBERS_3 "r6", ASM_CLOBBERS_4 + +#define LOAD_ARGS_4 (a, b, c, d) \ + LOAD_ARGS_3 (a, b, c) \ + long int _d = (long int)(d); \ + register long int __d __asm__ ("r6") = _d; +#define ASM_ARGS_4 ASM_ARGS_3, "r" (__d) +#define ASM_CLOBBERS_4 "r7", ASM_CLOBBERS_5 + +#define LOAD_ARGS_5 (a, b, c, d, e) \ + long int _e = (long int)(e); \ + LOAD_ARGS_4 (a, b, c, d) \ + register long int __e __asm__ ("r7") = _e; +#define ASM_ARGS_5 ASM_ARGS_4, "r" (__e) +#define ASM_CLOBBERS_5 "r8", ASM_CLOBBERS_6 + +#define LOAD_ARGS_6 (a, b, c, d, e, f) \ + long int _f = (long int)(f); \ + LOAD_ARGS_5 (a, b, c, d, e) \ + register long int __f __asm__ ("r8") = _f; +#define ASM_ARGS_6 ASM_ARGS_5, "r" (__f) +#define ASM_CLOBBERS_6 + +#endif
PATCH v2 8/13 or1k: Linux Syscall Interface
Quoted 4 lines · Adhemerval Zanella
Quoted 1 line · Stafford Horne via Libc-alpha
+#define
__TIMESIZE64
It makes sense, it may be easier to do once/if the port it merged.
I am often playing catch up as upstream moves forward.
Quoted 46 lines
Maybe we should refactor to make this the default for newer ports and make old ports to redefine it.
Quoted 30 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +24
-0@@ -0,0 +1,40 @@ +/* Copyright (C) 2021 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 <sys/ioctl.h> +#include <sysdep.h> + +/* The or1k ABI uses stack for varargs, syscall uses registers. +This function moves arguments from varargs to registers. */ +int sysdeps/unix/sysv/linux/or1k/ioctl.c line 34
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +10
-0+__ioctl (int fd, unsigned long int request, ...) +{ + void *arg; +va_list ap; +int result; + +va_start (ap, request); + arg = va_arg (ap, void *); + + result =INLINE_SYSCALL (ioctl,3 , fd, request, arg);Use
INLINE_SYSCALL_CALL.
Quoted 11 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c line 40
Quoted 6 lines
sysdeps/unix/sysv/linux/or1k/ioctl.c new file +6
-0+va_end (ap); + +return result; +} +libc_hidden_def (__ioctl) +weak_alias (__ioctl, ioctl)I think it would be better to make it the default implementation. Unfortunately it might result in worse code, but I think the assumption on auto-generation syscall that varargs are always passed in register also fragile.
I see you have just posted a generic ioctl implementation that does this. I will rebase and use/test that.
Quoted 43 lines
Quoted 43 lines
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h new file +37
-0@@ -0,0 +1,41 @@ +/* jump buffer constants, OpenRISC version. +Copyright (C) 2021 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/>. */ + +/* Produced by this program: + +#include <stdio.h> +#include <unistd.h> +#include <setjmp.h> +#include <stddef.h> + +int main (int argc, char **argv) +{ +printf ("#define JMP_BUF_SIZE %d\n", sizeof (jmp_buf)); +printf ("#define JMP_BUF_ALIGN %d\n", __alignof__ (jmp_buf)); +printf ("#define SIGJMP_BUF_SIZE %d\n", sizeof (sigjmp_buf)); +printf ("#define SIGJMP_BUF_ALIGN %d\n", __alignof__ (sigjmp_buf)); +printf ("#define MASK_WAS_SAVED_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __mask_was_saved)); +printf ("#define SAVED_MASK_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __saved_mask)); +} */ + +#define JMP_BUF_SIZE 184 +#define JMP_BUF_ALIGN 4
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h line 41
Quoted 4 lines
sysdeps/unix/sysv/linux/or1k/jmp_buf-macros.h new file +4
-0+#define SIGJMP_BUF_SIZE 184 +#define SIGJMP_BUF_ALIGN 4 +#define MASK_WAS_SAVED_OFFSET 52 +#define SAVED_MASK_OFFSET 56This is replicated for all architectures and it can be replaced with a gen-as-const-headers file. I will fix it upstream, so there won't be the need to add this new header.
I see you did that upstream, this can go.
Quoted 25 lines
Quoted 25 lines
sysdeps/unix/sysv/linux/or1k/kernel_stat.h new file +19
-0@@ -0,0 +1,24 @@ +/* Copyright (C) 2021-2021 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 <bits/wordsize.h> +
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/kernel_stat.h line 24
Quoted 5 lines
sysdeps/unix/sysv/linux/or1k/kernel_stat.h new file +5
-0+#define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 + +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 0So the generic Linux interface only misses the
STAT64_IS_KERNEL_STAT64, right? I think we can add it and thus or1k just need to ajust__STATFS_MATCHES_STATFS64.
OK let me look at it.
Quoted 42 lines
Quoted 26 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +20
-0@@ -0,0 +1,30 @@ +/* Common mmap definition for Linux implementation. OpenRISC version. +Copyright (C) 2021 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 +#define MMAP_OR1K_INTERNAL_LINUX_H sysdeps/unix/sysv/linux/or1k/mmap_internal.h line 30
Quoted 10 lines
sysdeps/unix/sysv/linux/or1k/mmap_internal.h new file +10
-0+ +/* OpenRISC Linux sets the page shift to 13 and mmap2 expects +offsets to be provided in 8K pages. Set MMAP2_PAGE_UNIT to -1 +to allow mmap_internal.h to determine the page size dynamically with +getpagesize. */ +#define MMAP2_PAGE_UNIT -1 + +#include_next <mmap_internal.h> + +#endif
MMAP2_PAGE_UNITset to -1 means the architecture supports multiple page size, but from the comment my understanding it only support 8k. If it where the case it would be simpler to just setMMAP2_PAGE_UNITto 8192ULL.
Quoted 1 line
As a side note, maybe arc should do it as well.
Thats right, I remember there was some issue if I just defined 8192ULL, but I couldn't recall. Let me test that.
Quoted 150 lines
Quoted 136 lines
sysdeps/unix/sysv/linux/or1k/or1k_clone.S new file +89
-0@@ -0,0 +1,89 @@ +/* clone helper __or1k_clone for OpenRISC. + Copyright (C) 2021 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. */ + +#include <sysdep.h> +#include <tls.h> +#define __ASSEMBLY__ +#include <linux/sched.h> + + .text +ENTRY(__or1k_clone) + + /* To handle GCC varargs we need to use our __clone wrapper to pop + everything from the stack for us. + Now everything is placed in the registers which saves us a lot + of trouble. + + The userland implementation is: + + int clone (int (*fn)(void *), void *child_stack, + int flags, void *arg, pid_t *ptid, + struct user_desc *tls, pid_t *ctid); + The kernel entry is: + + int clone (long flags, void *child_stack, int *parent_tid, + int *child_tid, struct void *tls) + + NB: tls isn't really an argument, it is read from r7 directly. */ + + /* First, align the stack to 4 bytes. */ + l.xori r11, r0, -4 + l.and r4, r4, r11 + + /* Put 'fn', 'arg' and 'flags' on the child stack. */ + l.addi r4, r4, -12 + l.sw 8(r4), r3 + l.sw 4(r4), r6 + l.sw 0(r4), r5 + + l.ori r3, r5, 0 + /* The child_stack is already in r4. */ + l.ori r5, r7, 0 + l.lwz r6, 0(r1) + l.ori r7, r8, 0 + + DO_CALL (clone) + + l.sfgeui r11, 0xf001 + l.bf L(error) + l.nop + + /* If we are not the child, return the pid. */ + l.sfeqi r11, 0 + l.bf L(thread_start) + l.nop + + l.jr r9 + l.nop + +L(thread_start): + /* Load function from stack. */ + l.lwz r11, 8(r1) + l.jalr r11 + l.lwz r3, 4(r1) + + /* Exit the child thread. */ + l.ori r3, r11, 0 + DO_CALL (exit) + +L(error): + l.j SYSCALL_ERROR_NAME + l.ori r3, r11, 0 + +PSEUDO_END (__or1k_clone)sysdeps/unix/sysv/linux/or1k/syscall.c new file +35
-0@@ -0,0 +1,45 @@ +/* System call interface. OpenRISC version. +Copyright (C) 2021 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 <sysdep.h> +#include <stdarg.h> + +long int +syscall (long int syscall_number, ...) +{ +unsigned long int arg1, arg2, arg3, arg4, arg5, arg6; +va_list arg; +long int ret; + +va_start (arg, syscall_number); + arg1 = va_arg (arg, unsigned long int); + arg2 = va_arg (arg, unsigned long int); + arg3 = va_arg (arg, unsigned long int); + arg4 = va_arg (arg, unsigned long int); + arg5 = va_arg (arg, unsigned long int); + arg6 = va_arg (arg, unsigned long int);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; +}As for
ioctl.c, I also think this should the set as the default implementation. It would allows us to remove the hppa version as well.
Quoted 2 lines
(maybe also add a
INTERNAL_SYSCALL_CALL_NCS, to get rid of the requirement to pass the number of arguments).
Right, I see you posted a patch for that, I will rebase so we can remove this.
Quoted 35 lines
Quoted 35 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +29
-0@@ -0,0 +1,33 @@ +/* Copyright (C) 2021 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 <sysdep.h> +#include <errno.h> + +long int __syscall_error (long int err); +hidden_proto (__syscall_error) + +/* This routine is jumped to by all the syscall handlers, to stash +an error number into errno. */ +long int +__syscall_error (long int err) +{
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c line 33
Quoted 4 lines
sysdeps/unix/sysv/linux/or1k/sysdep.c new file +4
-0+__set_errno (- err); +return -1 ; +} +hidden_def (__syscall_error)This is another thing I have in my backlog to cleanup: I think we also should move it to default implementation. The architectures that uses non standard call procedure already implement it with assembly routines.
Yeah, that makes sense.
Quoted 33 lines
Quoted 33 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +27
-0@@ -0,0 +1,195 @@ +/* Copyright (C) 2021 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 <sysdeps/or1k/sysdep.h> +#include <sysdeps/unix/sysv/linux/generic/sysdep.h> +#include <tls.h> + +/* "workarounds" for generic code needing to handle 64-bit time_t. */ + +#undef __NR_clock_getres +#undef __NR_futex +#undef __NR_ppoll +#undef __NR_pselect6
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h line 31
Quoted 4 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +4
-0+#undef __NR_recvmmsg +#undef __NR_rt_sigtimedwait +#undef __NR_semtimedop +#undef __NR_utimensatI think we might need to update
update-syscall-lists.pyto *not* emit no emit 32-bit time syscalls if the architecture only exports 64-bit interfaces.
Yes, other arch's are having to do this as well.
Quoted 157 lines
Quoted 157 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +157
-0+ +/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ +#define __NR_clock_getres __NR_clock_getres_time64 +/* Fix sysdeps/nptl/lowlevellock-futex.h. */ +#define __NR_futex __NR_futex_time64 +/* Fix sysdeps/unix/sysv/linux/pause.c. */ +#define __NR_ppoll __NR_ppoll_time64 +/* Fix sysdeps/unix/sysv/linux/select.c. */ +#define __NR_pselect6 __NR_pselect6_time64 +/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ +#define __NR_recvmmsg __NR_recvmmsg_time64 +/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ +#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ +#define __NR_semtimedop __NR_semtimedop_time64 +/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ +#define __NR_utimensat __NR_utimensat_time64 + +#undef SYS_ify +#define SYS_ify (syscall_name) (__NR_##syscall_name) + +/* Linux uses a negative return value to indicate syscall errors, +unlike most Unices, which use the condition codes' carry flag. + +Since version 2.1 the return value of a system call might be +negative even if the call succeeded. E.g., the `lseek' system call +might return a large offset. Therefore we must not anymore test +for < 0, but test for a real error by making sure the value in R0 +is a real error number. Linus said he will make sure the no syscall +returns a value in -1 .. -4095 as a valid result so we can safely +test with -4095. */ + +#ifdef __ASSEMBLER__ + +/* Macros used in syscall-template.S */ +#define ret l.jr r9; l.nop +#define ret_NOERRNO l.jr r9; l.nop + +#undef DO_CALL +#define DO_CALL (syscall_name) \ + l.addi r11, r0, SYS_ify (syscall_name); \ + l.sys 1; \ + l.nop + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name); \ + DO_CALL(syscall_name); \ + /* if -4096 < ret < 0 holds, it's an error */ \ + l.sfgeui r11, 0xf001; \ + l.bf L(pseudo_end); \ + l.nop + +#undef PSEUDO_NOERRNO +#define PSEUDO_NOERRNO (name, syscall_name, args) \ + ENTRY (name); \ + DO_CALL(syscall_name) + +#undef PSEUDO_END +#define PSEUDO_END (name) \ +L(pseudo_end): \ + l.j SYSCALL_ERROR_NAME; \ + l.ori r3,r11,0; \ + END (name) + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO (name) \ + END (name) + +#ifndef PIC +/* For static code, on error jump to __syscall_error directly. */ +# define SYSCALL_ERROR_NAME __syscall_error +#elif !IS_IN (libc) +/* Use the internal name for libc/libpthread shared objects. */ +# define SYSCALL_ERROR_NAME __GI___syscall_error +#else +/* Otherwise, on error do a full PLT jump. */ +# define SYSCALL_ERROR_NAME plt(__syscall_error) +#endif + +#else /* not __ASSEMBLER__ */ + +#include <errno.h> + +extern long int __syscall_error (long int neg_errno); + +/* Pointer mangling is not yet supported for or1k. */ +#define PTR_MANGLE (var) (void) (var) +#define PTR_DEMANGLE (var) (void) (var) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) + +/* The _NCS variant allows non-constant syscall numbers. */ +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + ({ unsigned long int __sys_result; \ + { \ + long int _sc_ret = (long int) number; \ + LOAD_ARGS_##nr (args) \ + register long int __sc_ret __asm__ ("r11") = _sc_ret; \ + __asm__ __volatile__ ("l.sys 1\n\t" \ + " l.nop\n\t" \ + : "+r" (__sc_ret) \ + : ASM_ARGS_##nr \ + : ASM_CLOBBERS_##nr \ + "r12", "r13", "r15", "r17", "r19", \ + "r21", "r23", "r25", "r27", "r29", \ + "r31", "memory"); \ + __sys_result = __sc_ret; \ + } \ + (long int) __sys_result; }) + +/* From here on we have nested macros that generate code for +* storing arguments to the syscall */ + +#define LOAD_ARGS_0 () + +#define ASM_ARGS_0 +#define ASM_CLOBBERS_0 "r3", ASM_CLOBBERS_1 + +#define LOAD_ARGS_1 (a) \ + long int _a = (long int)(a); \ + register long int __a __asm__ ("r3") = _a; +#define ASM_ARGS_1 "r" (__a) +#define ASM_CLOBBERS_1 "r4", ASM_CLOBBERS_2 + +#define LOAD_ARGS_2 (a, b) \ + long int _b = (long int)(b); \ + LOAD_ARGS_1 (a) \ + register long int __b __asm__ ("r4") = _b; +#define ASM_ARGS_2 ASM_ARGS_1, "r" (__b) +#define ASM_CLOBBERS_2 "r5", ASM_CLOBBERS_3 + +#define LOAD_ARGS_3 (a, b, c) \ + long int _c = (long int)(c); \ + LOAD_ARGS_2 (a, b) \ + register long int __c __asm__ ("r5") = _c; +#define ASM_ARGS_3 ASM_ARGS_2, "r" (__c) +#define ASM_CLOBBERS_3 "r6", ASM_CLOBBERS_4 + +#define LOAD_ARGS_4 (a, b, c, d) \ + LOAD_ARGS_3 (a, b, c) \ + long int _d = (long int)(d); \ + register long int __d __asm__ ("r6") = _d; +#define ASM_ARGS_4 ASM_ARGS_3, "r" (__d) +#define ASM_CLOBBERS_4 "r7", ASM_CLOBBERS_5 + +#define LOAD_ARGS_5 (a, b, c, d, e) \ + long int _e = (long int)(e); \ + LOAD_ARGS_4 (a, b, c, d) \ + register long int __e __asm__ ("r7") = _e; +#define ASM_ARGS_5 ASM_ARGS_4, "r" (__e) +#define ASM_CLOBBERS_5 "r8", ASM_CLOBBERS_6 + +#define LOAD_ARGS_6 (a, b, c, d, e, f) \
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h line 195
Quoted 8 lines
sysdeps/unix/sysv/linux/or1k/sysdep.h new file +7
-0+long int _f = (long int )(f); \ + LOAD_ARGS_5 (a, b, c, d, e) \ + register long int __f __asm__ ("r8") = _f; +#define ASM_ARGS_6 ASM_ARGS_5, "r" (__f) +#define ASM_CLOBBERS_6 + +#endif
Thanks for the review.
-Stafford
PATCH v2 9/13 or1k: Linux ABI
In reply to Stafford Horne--- sysdeps/or1k/nptl/bits/pthreadtypes-arch.h | 48 ++++++++ sysdeps/or1k/nptl/pthreaddef.h | 35 ++++++ sysdeps/unix/sysv/linux/or1k/bits/procfs.h | 38 ++++++ sysdeps/unix/sysv/linux/or1k/getcontext.S | 72 +++++++++++ sysdeps/unix/sysv/linux/or1k/makecontext.c | 77 ++++++++++++ sysdeps/unix/sysv/linux/or1k/setcontext.S | 108 ++++++++++++++++ sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h | 28 +++++ sysdeps/unix/sysv/linux/or1k/swapcontext.S | 116 ++++++++++++++++++ sysdeps/unix/sysv/linux/or1k/sys/ucontext.h | 53 ++++++++ sysdeps/unix/sysv/linux/or1k/sys/user.h | 1 + sysdeps/unix/sysv/linux/or1k/ucontext_i.sym | 26 ++++ 11 files changed, 602 insertions(+) create mode 100644 sysdeps/or1k/nptl/bits/pthreadtypes-arch.h create mode 100644 sysdeps/or1k/nptl/pthreaddef.h create mode 100644 sysdeps/unix/sysv/linux/or1k/bits/procfs.h create mode 100644 sysdeps/unix/sysv/linux/or1k/getcontext.S create mode 100644 sysdeps/unix/sysv/linux/or1k/makecontext.c create mode 100644 sysdeps/unix/sysv/linux/or1k/setcontext.S 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/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/or1k/sys/user.h create mode 100644 sysdeps/unix/sysv/linux/or1k/ucontext_i.sym
sysdeps/or1k/nptl/bits/pthreadtypes-arch.h new file +48 -0
@@ -0,0 +1,48 @@ +/* Machine-specific pthread type layouts. OpenRISC version. +Copyright (C) 2021 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 _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#include <bits/wordsize.h> + +/* Opaque union sizes for: +pthread_attr_t - internally pthread_attr +pthread_mutex_t - internally __pthread_mutex_s +pthread_mutexattr_t - internally pthread_mutexattr +pthread_cond_t - internally __pthread_cond_s +pthread_condattr_t - internally pthread_condattr +pthread_rwlock_t - internally __pthread_rwlock_arch_t +pthread_rwlockattr_t - internally pthread_rwlockattr +pthread_barrier_t - internally pthread_barrier +pthread_barrierattr_t - internally pthread_barrierattr */ + +#define __SIZEOF_PTHREAD_ATTR_T 32 +#define __SIZEOF_PTHREAD_MUTEX_T 32 +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCK_T 44 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIER_T 20 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#define __LOCK_ALIGNMENT +#define __ONCE_ALIGNMENT + +#endif /* bits/pthreadtypes.h */
sysdeps/or1k/nptl/pthreaddef.h new file +35 -0
@@ -0,0 +1,35 @@ +/* Copyright (C) 2021 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/>. */ + +/* Default stack size. */ +#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) + +/* Minimum guard size. */ +#define ARCH_MIN_GUARD_SIZE 0 + +/* Required stack pointer alignment at beginning. */ +#define STACK_ALIGN 16 + +/* Minimal stack size after allocating thread descriptor and guard size. */ +#define MINIMAL_REST_STACK 2048 + +/* Alignment requirement for TCB. Needs to be >= to STACK_ALIGN. */ +#define TCB_ALIGNMENT 16 + +/* Location of current stack frame. */ +#define CURRENT_STACK_FRAME __builtin_frame_address (0)
sysdeps/unix/sysv/linux/or1k/bits/procfs.h new file +38 -0
@@ -0,0 +1,38 @@ +/* Types for registers for sys/procfs.h. OpenRISC version. +Copyright (C) 2021 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 _SYS_PROCFS_H +# error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead." +#endif + +#include <sys/ucontext.h> + +#define ELF_NGREG __NGREG + +/* Type for a general-purpose register. */ +typedef unsigned long int elf_greg_t ; + +/* And the array of general-purpose registers. We could have used `struct +user_regs' directly, but tradition says that the register set is an array, +which does have some peculiar semantics, so leave it that way. +GDB uses this for prtrace GETREGSET, on OpenRISC the regset contains 32 +gprs the PC and the SR, 34 longs. */ +typedef elf_greg_t elf_gregset_t [34 ]; + +/* Register set for the floating-point registers. */ +typedef elf_greg_t elf_fpregset_t [32 ];
sysdeps/unix/sysv/linux/or1k/getcontext.S new file +72 -0
72 lines not on this page · 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/setcontext.S new file +108 -0
108 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/sigcontextinfo.h new file +28 -0
@@ -0,0 +1,28 @@ +/* Profile counter helper to get PC from sigcontext. OpenRISC version. +Copyright (C) 2021 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 _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + +static inline uintptr_t +sigcontext_get_pc (const ucontext_t *ctx) +{ +return ctx->uc_mcontext.__pc; +} + +#endif
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/ucontext.h new file +53 -0
53 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/sys/user.h new file +1 -0
@@ -0,0 +1 @@ +/* This file is not needed, but in practice gdb might try to include it. */
sysdeps/unix/sysv/linux/or1k/ucontext_i.sym new file +26 -0
@@ -0,0 +1,26 @@ +#include <inttypes.h> +#include <signal.h> +#include <stddef.h> +#include <sys/ucontext.h> + +-- Constants used by the rt_sigprocmask call. + +SIG_BLOCK +SIG_SETMASK + +_NSIG8 (_NSIG / 8) + +-- Offsets of the fields in the ucontext_t structure. +#define ucontext(member) offsetof (ucontext_t, member) +#define stack(member) ucontext (uc_stack.member) + +UCONTEXT_LINK ucontext (uc_link) +UCONTEXT_STACK ucontext (uc_stack) +UCONTEXT_MCONTEXT ucontext (uc_mcontext) +UCONTEXT_SIGMASK ucontext (uc_sigmask) + +STACK_SP stack (ss_sp) +STACK_SIZE stack (ss_size) +STACK_FLAGS stack (ss_flags) + +UCONTEXT_SIZE sizeof (ucontext_t)
Signature · 1 line
2.31.1
PATCH v2 10/13 or1k: ABI lists
In reply to Stafford Horne--- sysdeps/unix/sysv/linux/or1k/c++-types.data | 67 + sysdeps/unix/sysv/linux/or1k/ld.abilist | 5 + .../sysv/linux/or1k/libBrokenLocale.abilist | 1 + sysdeps/unix/sysv/linux/or1k/libanl.abilist | 1 + sysdeps/unix/sysv/linux/or1k/libc.abilist | 2122 +++++++++++++++++ .../sysv/linux/or1k/libc_malloc_debug.abilist | 26 + sysdeps/unix/sysv/linux/or1k/libcrypt.abilist | 2 + sysdeps/unix/sysv/linux/or1k/libdl.abilist | 0 sysdeps/unix/sysv/linux/or1k/libm.abilist | 759 ++++++ sysdeps/unix/sysv/linux/or1k/libnsl.abilist | 121 + .../unix/sysv/linux/or1k/libpthread.abilist | 0 .../unix/sysv/linux/or1k/libresolv.abilist | 55 + sysdeps/unix/sysv/linux/or1k/librt.abilist | 0 .../unix/sysv/linux/or1k/libthread_db.abilist | 40 + sysdeps/unix/sysv/linux/or1k/libutil.abilist | 1 + sysdeps/unix/sysv/linux/or1k/localplt.data | 14 + 16 files changed, 3214 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/or1k/c++-types.data 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/libc_malloc_debug.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
sysdeps/unix/sysv/linux/or1k/c++-types.data new file +67 -0
@@ -0,0 +1,67 @@ +blkcnt64_t:x +blkcnt_t:x +blksize_t:i +caddr_t:Pc +clockid_t:i +clock_t:l +daddr_t:i +dev_t:y +fd_mask:l +fsblkcnt64_t:y +fsblkcnt_t:y +fsfilcnt64_t:y +fsfilcnt_t:y +fsid_t:8__fsid_t +gid_t:j +id_t:j +ino64_t:y +ino_t:y +int16_t:s +int32_t:i +int64_t:x +int8_t:a +intptr_t:i +key_t:i +loff_t:x +mode_t:j +nlink_t:j +off64_t:x +off_t:x +pid_t:i +pthread_attr_t:14pthread_attr_t +pthread_barrier_t:17pthread_barrier_t +pthread_barrierattr_t:21pthread_barrierattr_t +pthread_cond_t:14pthread_cond_t +pthread_condattr_t:18pthread_condattr_t +pthread_key_t:j +pthread_mutex_t:15pthread_mutex_t +pthread_mutexattr_t:19pthread_mutexattr_t +pthread_once_t:i +pthread_rwlock_t:16pthread_rwlock_t +pthread_rwlockattr_t:20pthread_rwlockattr_t +pthread_spinlock_t:i +pthread_t:m +quad_t:x +register_t:i +rlim64_t:y +rlim_t:y +sigset_t:10__sigset_t +size_t:j +socklen_t:j +ssize_t:i +suseconds_t:x +time_t:x +u_char:h +uid_t:j +uint:j +u_int:j +u_int16_t:t +u_int32_t:j +u_int64_t:y +u_int8_t:h +ulong:m +u_long:m +u_quad_t:y +useconds_t:j +ushort:t +u_short:t
sysdeps/unix/sysv/linux/or1k/ld.abilist new file +5 -0
@@ -0,0 +1,5 @@ +GLIBC_2.35 __libc_stack_end D 0x4 +GLIBC_2.35 __stack_chk_guard D 0x4 +GLIBC_2.35 __tls_get_addr F +GLIBC_2.35 _dl_mcount F +GLIBC_2.35 _r_debug D 0x14
sysdeps/unix/sysv/linux/or1k/libBrokenLocale.abilist new file +1 -0
@@ -0,0 +1 @@ +GLIBC_2.35 __ctype_get_mb_cur_max F
sysdeps/unix/sysv/linux/or1k/libanl.abilist new file +1 -0
@@ -0,0 +1 @@ +GLIBC_2.35 __libanl_version_placeholder F
sysdeps/unix/sysv/linux/or1k/libc.abilist new file +2122 -0
2,122 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/libc_malloc_debug.abilist new file +26 -0
@@ -0,0 +1,26 @@ +GLIBC_2.35 __free_hook D 0x4 +GLIBC_2.35 __malloc_hook D 0x4 +GLIBC_2.35 __memalign_hook D 0x4 +GLIBC_2.35 __realloc_hook D 0x4 +GLIBC_2.35 aligned_alloc F +GLIBC_2.35 calloc F +GLIBC_2.35 free F +GLIBC_2.35 mallinfo F +GLIBC_2.35 mallinfo2 F +GLIBC_2.35 malloc F +GLIBC_2.35 malloc_info F +GLIBC_2.35 malloc_stats F +GLIBC_2.35 malloc_trim F +GLIBC_2.35 malloc_usable_size F +GLIBC_2.35 mallopt F +GLIBC_2.35 mcheck F +GLIBC_2.35 mcheck_check_all F +GLIBC_2.35 mcheck_pedantic F +GLIBC_2.35 memalign F +GLIBC_2.35 mprobe F +GLIBC_2.35 mtrace F +GLIBC_2.35 muntrace F +GLIBC_2.35 posix_memalign F +GLIBC_2.35 pvalloc F +GLIBC_2.35 realloc F +GLIBC_2.35 valloc F
sysdeps/unix/sysv/linux/or1k/libcrypt.abilist new file +2 -0
@@ -0,0 +1,2 @@ +GLIBC_2.35 crypt F +GLIBC_2.35 crypt_r F
sysdeps/unix/sysv/linux/or1k/libdl.abilist new file +0 -0
sysdeps/unix/sysv/linux/or1k/libm.abilist new file +759 -0
759 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/libnsl.abilist new file +121 -0
17 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/libpthread.abilist new file +0 -0
sysdeps/unix/sysv/linux/or1k/libresolv.abilist new file +55 -0
55 lines not on this page · raw message
sysdeps/unix/sysv/linux/or1k/librt.abilist new file +0 -0
sysdeps/unix/sysv/linux/or1k/libthread_db.abilist new file +40 -0
Lines of this file are not shown. View the raw message.
sysdeps/unix/sysv/linux/or1k/libutil.abilist new file +1 -0
Lines of this file are not shown. View the raw message.
sysdeps/unix/sysv/linux/or1k/localplt.data new file +14 -0
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.31.1
Part of the diff is not shown here. View the raw message.
PATCH v2 11/13 or1k: Build Infrastructure
In reply to Stafford Horne--- sysdeps/or1k/Implies | 3 ++ sysdeps/or1k/Makefile | 7 +++++ sysdeps/or1k/nofpu/Implies | 1 + sysdeps/or1k/nptl/Makefile | 21 +++++++++++++ sysdeps/or1k/preconfigure | 34 +++++++++++++++++++++ sysdeps/unix/sysv/linux/or1k/Implies | 3 ++ sysdeps/unix/sysv/linux/or1k/Makefile | 12 ++++++++ sysdeps/unix/sysv/linux/or1k/configure | 4 +++ sysdeps/unix/sysv/linux/or1k/configure.ac | 4 +++ sysdeps/unix/sysv/linux/or1k/shlib-versions | 2 ++ 10 files changed, 91 insertions(+) create mode 100644 sysdeps/or1k/Implies create mode 100644 sysdeps/or1k/Makefile create mode 100644 sysdeps/or1k/nofpu/Implies create mode 100644 sysdeps/or1k/nptl/Makefile create mode 100644 sysdeps/or1k/preconfigure 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/configure create mode 100644 sysdeps/unix/sysv/linux/or1k/configure.ac create mode 100644 sysdeps/unix/sysv/linux/or1k/shlib-versions
sysdeps/or1k/Implies new file +3 -0
@@ -0,0 +1,3 @@ +wordsize-32 +ieee754/dbl-64 +ieee754/flt-32
sysdeps/or1k/Makefile new file +7 -0
@@ -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/nofpu/Implies new file +1 -0
@@ -0,0 +1 @@ +ieee754/soft-fp
sysdeps/or1k/nptl/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +# Copyright (C) 2021 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/>. + +ifeq ($(subdir),csu) +gen-as-const-headers += tcb-offsets.sym +endif
sysdeps/or1k/preconfigure new file +34 -0
@@ -0,0 +1,34 @@ +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +case "$machine" in +or1k*) + base_machine=or1k + machine=or1k + + with_fp_cond="defined __or1k_hard_float__" + ;; +esac +
sysdeps/unix/sysv/linux/or1k/Implies new file +3 -0
@@ -0,0 +1,3 @@ +or1k/nptl +unix/sysv/linux/generic/wordsize-32 +unix/sysv/linux/generic
sysdeps/unix/sysv/linux/or1k/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +ifeq ($(subdir),misc) + sysdep_routines += prctl or1k_clone +endif + +ifeq ($(subdir),stdlib) +gen-as-const-headers += ucontext_i.sym +endif + +# pull in __syscall_error routine +libpthread-routines += sysdep +librt-routines += sysdep +
sysdeps/unix/sysv/linux/or1k/configure new file +4 -0
@@ -0,0 +1,4 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/unix/sysv/linux/or1k. + +arch_minimum_kernel=5.10.0
sysdeps/unix/sysv/linux/or1k/configure.ac new file +4 -0
@@ -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=5.10.0
sysdeps/unix/sysv/linux/or1k/shlib-versions new file +2 -0
@@ -0,0 +1,2 @@ +DEFAULT GLIBC_2.35 +ld=ld-linux-or1k.so.1
Signature · 1 line
2.31.1
PATCH v2 11/13 or1k: Build Infrastructure
sysdeps/unix/sysv/linux/or1k/configure.ac line 4
Quoted 10 lines · Stafford Horne via Libc-alpha
sysdeps/unix/sysv/linux/or1k/configure.ac new file +4
-0@@ -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=5.10.0
This seems to be a lot more recent than when OpenRISC support was actually added to the Linux kernel, and also more recent than when 64-bit time support was added for 32-bit architectures (which may be a convenient minimum kernel for some new 32-bit architectures for that reason). Requiring a newer kernel like that is certainly fine if convenient for the port, but I think the choice of minimum kernel version, and the reasons for it, deserve mention at least in the commit message and the NEWS file entry.
Signature · 2 lines
Joseph S. Myers joseph at codesourcery.com
PATCH v2 11/13 or1k: Build Infrastructure
Quoted 13 lines · Joseph Myers
sysdeps/unix/sysv/linux/or1k/configure.ac line 4
Quoted 10 lines · Stafford Horne via Libc-alpha
sysdeps/unix/sysv/linux/or1k/configure.ac new file +4
-0@@ -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=5.10.0
Quoted 8 lines
This seems to be a lot more recent than when OpenRISC support was actually added to the Linux kernel, and also more recent than when 64-bit time support was added for 32-bit architectures (which may be a convenient minimum kernel for some new 32-bit architectures for that reason). Requiring a newer kernel like that is certainly fine if convenient for the port, but I think the choice of minimum kernel version, and the reasons for it, deserve mention at least in the commit message and the NEWS file entry.
OK, during the v1 review you mentioned:
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.
I really just chose the version I was working on at the time. I just looked back on it, this version 5.10 is good because. 1. it is a long term support version. 2. in 5.8 I fixed a kernel bug which caused clone/fork to not work with TLS.
I will upate the commit/news.
-Stafford
PATCH v2 12/13 build-many-glibcs.py: add OpenRISC support
In reply to Stafford Horne--- scripts/build-many-glibcs.py | 5 +++++ 1 file changed, 5 insertions(+)
scripts/build-many-glibcs.py +5 -0
@@ -334,6 +334,10 @@ class Context(object): 'ccopts': '-mabi=64'}]) self.add_config(arch='nios2', os_name='linux-gnu') + self.add_config(arch='or1k', + os_name='linux-gnu', + variant='soft', + gcc_cfg=['--with-multilib-list=mcmov']) self.add_config(arch='powerpc', os_name='linux-gnu', gcc_cfg=['--disable-multilib', '--enable-secureplt'],
@@ -1270,6 +1274,7 @@ def install_linux_headers(policy, cmdlist): 'microblaze': 'microblaze', 'mips': 'mips', 'nios2': 'nios2', + 'or1k': 'openrisc', 'powerpc': 'powerpc', 's390': 's390', 'riscv32': 'riscv',
Signature · 1 line
2.31.1
PATCH v2 13/13 Documentation for OpenRISC port
In reply to Stafford HorneOpenRISC architecture specification:
https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf
Currently the port as of the 2021-10-16 rebasing has the following test failures:
FAIL: timezone/tst-tzset # Not enough space to create 4GiB file
Writing credits for the port are:
Stafford Horne <[email protected]>
Christian Svensson <[email protected]>
--- NEWS | 2 ++ README | 1 + 2 files changed, 3 insertions(+)
NEWS +2 -0
@@ -481,6 +481,8 @@ Major new features: The latest GCC available at this time (10.2) does not support this level of fortification. +* Support for OpenRISC on Linux has been added. + Deprecated and removed features, and other changes affecting compatibility: * The mallinfo function is marked deprecated. Callers should call
README +1 -0
@@ -35,6 +35,7 @@ The GNU C Library supports these configurations for using Linux kernels: microblaze*-*-linux-gnu mips-*-linux-gnu mips64-*-linux-gnu + or1k-*-linux-gnu powerpc-*-linux-gnu Hardware or software floating point, BE only. powerpc64*-*-linux-gnu Big-endian and little-endian. s390-*-linux-gnu
Signature · 1 line
2.31.1