libc: Remove a bunch of code for architectures we don't actually support.

Namely:

* alpha
* hppa
* ia64
* microblaze
* nios2
* or1k
* s390
* sh
This commit is contained in:
Alex Rønne Petersen
2025-01-21 02:47:29 +01:00
parent 0595feb341
commit f1f269c6ee
89 changed files with 0 additions and 5926 deletions

View File

@@ -1,11 +0,0 @@
#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
/* Alpha is little-endian. */
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif /* bits/endianness.h */

View File

@@ -1,101 +0,0 @@
/* Special .init and .fini section support for Alpha.
Copyright (C) 2001-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI.
This differs from what would be generated for ordinary code in that
we save and restore the GP within the function. In order for linker
relaxation to work, the value in the GP register on exit from a function
must be valid for the function entry point. Normally, a function is
contained within one object file and this is not an issue, provided
that the function reloads the gp after making any function calls.
However, _init and _fini are constructed from pieces of many object
files, all of which may have different GP values. So we must reload
the GP value from crti.o in crtn.o. */
#include <libc-symbols.h>
#include <sysdep.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
.section .init, "ax", @progbits
.globl _init
.hidden _init
.type _init, @function
.usepv _init, std
_init:
ldgp $29, 0($27)
subq $30, 16, $30
#if PREINIT_FUNCTION_WEAK
lda $27, PREINIT_FUNCTION
#endif
stq $26, 0($30)
stq $29, 8($30)
#if PREINIT_FUNCTION_WEAK
beq $27, 1f
jsr $26, ($27), PREINIT_FUNCTION
ldq $29, 8($30)
1:
#else
bsr $26, PREINIT_FUNCTION !samegp
#endif
.p2align 3
.section .fini, "ax", @progbits
.globl _fini
.hidden _fini
.type _fini,@function
.usepv _fini,std
_fini:
ldgp $29, 0($27)
subq $30, 16, $30
stq $26, 0($30)
stq $29, 8($30)
.p2align 3

View File

@@ -1,49 +0,0 @@
/* Special .init and .fini section support for Alpha.
Copyright (C) 2001-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
.section .init, "ax", @progbits
ldq $26, 0($30)
ldq $29, 8($30)
addq $30, 16, $30
ret
.section .fini, "ax", @progbits
ldq $26, 0($30)
ldq $29, 8($30)
addq $30, 16, $30
ret

View File

@@ -1,3 +0,0 @@
/* Number of extra dynamic section entries for this architecture. By
default there are none. */
#define DT_THISPROCNUM DT_ALPHA_NUM

View File

@@ -1,85 +0,0 @@
/* Startup code for Alpha/ELF.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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>
.text
.align 3
.globl _start
.ent _start, 0
.type _start,@function
_start:
.frame $15, 0, $15
br gp, 1f
1: ldgp gp, 0(gp)
subq sp, 16, sp
mov 0, $15
.prologue 0
/* Load address of the user's main function. */
lda a0, main
ldl a1, 16(sp) /* get argc */
lda a2, 24(sp) /* get argv */
/* Load address of our own entry points to .fini and .init. */
lda a3, __libc_csu_init
lda a4, __libc_csu_fini
/* Store address of the shared library termination function. */
mov v0, a5
/* Provide the highest stack address to the user code. */
stq sp, 0(sp)
/* Call the user's main function, and exit with its value.
But let the libc call main. */
jsr ra, __libc_start_main
/* Die very horribly if exit returns. Call_pal hlt is callable from
kernel mode only; this will result in an illegal instruction trap. */
call_pal 0
.end _start
/* For ECOFF backwards compatibility. */
weak_alias (_start, __start)
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.weak data_start
data_start = __data_start

View File

@@ -1,83 +0,0 @@
/* Startup code for Alpha/ELF.
Copyright (C) 1993-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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>
.text
.align 3
.globl _start
.ent _start, 0
.type _start,@function
_start:
.frame $15, 0, $15
br gp, 1f
1: ldgp gp, 0(gp)
subq sp, 16, sp
mov 0, $15
.prologue 0
/* Load address of the user's main function. */
lda a0, main
ldl a1, 16(sp) /* get argc */
lda a2, 24(sp) /* get argv */
mov $r31, a3 /* Used to be init. */
mov $r31, a4 /* Used to be fini. */
/* Store address of the shared library termination function. */
mov v0, a5
/* Provide the highest stack address to the user code. */
stq sp, 0(sp)
/* Call the user's main function, and exit with its value.
But let the libc call main. */
jsr ra, __libc_start_main
/* Die very horribly if exit returns. Call_pal hlt is callable from
kernel mode only; this will result in an illegal instruction trap. */
call_pal 0
.end _start
/* For ECOFF backwards compatibility. */
weak_alias (_start, __start)
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.weak data_start
data_start = __data_start

View File

@@ -1,11 +0,0 @@
#ifndef _BITS_ENDIANNESS_H
#define _BITS_ENDIANNESS_H 1
#ifndef _BITS_ENDIAN_H
# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
#endif
/* HP-PA is big-endian. */
#define __BYTE_ORDER __BIG_ENDIAN
#endif /* bits/endianness.h */

View File

@@ -1,162 +0,0 @@
/* Special .init and .fini section support for HPPA
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI. */
#include <libc-symbols.h>
#include <sysdep.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
/* If we have working .init_array support, we want to keep the .init
section empty (apart from the mandatory prologue/epilogue. This
ensures that the default unwind conventions (return-pointer in b0,
frame state in ar.pfs, etc.) will do the Right Thing. To ensure
an empty .init section, we register gmon_initializer() via the
.init_array.
--davidm 02/10/29 */
#if PREINIT_FUNCTION_WEAK
/* This blob of assembly code is one simple C function:
static void
__attribute__ ((used))
gmon_initializer (void)
{
extern void weak_function __gmon_start__ (void);
if (__gmon_start__)
(*__gmon_start__)();
}
In a final executable, PLABEL32 relocations for function pointers are
resolved at link time. Typically, binutils/ld resolves __gmon_start__
using an external shared library. __gmon_start__ is always called if
it is found at link time. If __gmon_start__ is not found at runtime
due to a library update, then the function pointer will point at a null
function descriptor and calling it will cause a segmentation fault.
So, we call __canonicalize_funcptr_for_compare to obtain the canonicalized
address of __gmon_start__ and skip calling __gmon_start__ if it is zero.
*/
.type __canonicalize_funcptr_for_compare,@function
.type $$dyncall,@function
.section .data.rel.ro,"aw",@progbits
.align 4
.LC0:
.type __gmon_start__,@function
.word P%__gmon_start__
.text
.align 4
.type gmon_initializer,@function
gmon_initializer:
.PROC
.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=4
.ENTRY
stw %r2,-20(%r30)
stwm %r4,64(%r30)
stw %r3,-60(%r30)
addil LT'.LC0,%r19
ldw RT'.LC0(%r1),%r28
ldw 0(%r28),%r3
comib,= 0,%r3,1f
copy %r19,%r4
stw %r19,-32(%r30)
bl __canonicalize_funcptr_for_compare,%r2
copy %r3,%r26
comib,= 0,%r28,1f
copy %r4,%r19
copy %r3,%r22
.CALL ARGW0=GR
bl $$dyncall,%r31
copy %r31,%r2
1:
ldw -84(%r30),%r2
ldw -60(%r30),%r3
bv %r0(%r2)
ldwm -64(%r30),%r4
.EXIT
.PROCEND
.size gmon_initializer, .-gmon_initializer
# undef PREINIT_FUNCTION
# define PREINIT_FUNCTION gmon_initializer
#endif
.section .init_array, "aw"
.word P% PREINIT_FUNCTION
/* _init prologue. */
.section .init, "ax", %progbits
.align 4
.globl _init
.hidden _init
.type _init,@function
_init:
stw %rp,-20(%sp)
stwm %r4,64(%sp)
stw %r19,-32(%sp)
/* _fini prologue. */
.section .fini,"ax",%progbits
.align 4
.globl _fini
.hidden _fini
.type _fini,@function
_fini:
stw %rp,-20(%sp)
stwm %r4,64(%sp)
stw %r19,-32(%sp)
copy %r19,%r4

View File

@@ -1,66 +0,0 @@
/* Special .init and .fini section support for HPPA
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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>
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
.section .init, "ax", @progbits
ldw -84(%sp),%rp
copy %r4,%r19
bv %r0(%rp)
_end_init:
ldwm -64(%sp),%r4
/* Our very own unwind info, because the assembler can't handle
functions split into two or more pieces. */
.section .PARISC.unwind
.extern _init
.word _init, _end_init
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
/* Here is the tail end of _fini. */
.section .fini, "ax", @progbits
ldw -84(%sp),%rp
copy %r4,%r19
bv %r0(%rp)
_end_fini:
ldwm -64(%sp),%r4
.section .PARISC.unwind
.extern _fini
.word _fini, _end_fini
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08

View File

@@ -1,8 +0,0 @@
extern void _start (void);
/* Lives in libgcc.so and canonicalizes function pointers for comparison. */
extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr);
/* The function's entry point is stored in the first word of the
function descriptor (plabel) of _start(). */
#define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start)

View File

@@ -1,46 +0,0 @@
/* Copyright (C) 2005-2024 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_ARCH_H
#define _BITS_PTHREADTYPES_ARCH_H 1
/* Linuxthread type sizes (bytes):
sizeof(pthread_attr_t) = 0x24 (36)
sizeof(pthread_barrier_t) = 0x30 (48)
sizeof(pthread_barrierattr_t) = 0x4 (4)
sizeof(pthread_cond_t) = 0x30 (48)
sizeof(pthread_condattr_t) = 0x4 (4)
sizeof(pthread_mutex_t) = 0x30 (48)
sizeof(pthread_mutexattr_t) = 0x4 (4)
sizeof(pthread_rwlock_t) = 0x40 (64)
sizeof(pthread_rwlockattr_t) = 0x8 (8)
sizeof(pthread_spinlock_t) = 0x10 (16) */
#define __SIZEOF_PTHREAD_ATTR_T 36
#define __SIZEOF_PTHREAD_MUTEX_T 48
#define __SIZEOF_PTHREAD_BARRIER_T 48
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_CONDATTR_T 4
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
#define __SIZEOF_PTHREAD_RWLOCK_T 64
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
#define __ONCE_ALIGNMENT
#endif /* bits/pthreadtypes.h */

View File

@@ -1,152 +0,0 @@
/* ELF startup code for HPPA.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
.import main, code
.import $global$, data
.import __libc_start_main, code
.import __libc_csu_fini, code
.import __libc_csu_init, code
/* Have the linker create plabel words so we get PLABEL32
relocs and not 21/14. The use of 21/14 relocs is only
supported in the latest dynamic linker. */
#ifdef PIC
.section .data.rel.ro,"aw",@progbits
#else
.section .rodata,"a",@progbits
#endif
.align 4
.Lpmain:
.word P%main
.Lp__libc_start_main:
.word P%__libc_start_main
.Lp__libc_csu_fini:
.word P%__libc_csu_fini
.Lp__libc_csu_init:
.word P%__libc_csu_init
.text
.align 4
.globl _start
.export _start, ENTRY
.type _start,@function
_start:
/* At entry to the function we have:
r26 - Unused
r25 - argc
r24 - argv
r23 - False _dl_fini plabel address
This function is called from the lower half of RTLD_START.
The call to __libc_start_main expects:
1. r26 - Application main
2. r25 - argc
3. r24 - argv
4. r23 - __libc_csu_init
5. sp-52 - __libc_csu_fini
6. sp-56 - rtld_fini
7. sp-60 - stackend */
.proc
.callinfo
/* Clear previous-sp. */
stw %r0, -4(%sp)
/* Setup the stack and frame. */
stw %rp, -20(%sp)
ldo 64(%sp), %sp
stw %sp, -4(%sp)
stw %r19, -32(%sp)
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
/* void (*rtld_fini) (void) (6th argument) */
stw %r23, -56(%sp)
/* Need to setup 1, 4, 5, and 7th arguments */
#ifdef PIC
/* Load $global$ address into %dp */
bl .+8, %dp
addil L'$global$-$PIC_pcrel$0+1, %dp
ldo R'$global$-$PIC_pcrel$0+5(%r1), %dp
/* load main (1st argument) */
addil LT'.Lpmain, %r19
ldw RT'.Lpmain(%r1), %r26
ldw 0(%r26),%r26
/* void (*init) (void) (4th argument) */
addil LT'.Lp__libc_csu_init, %r19
ldw RT'.Lp__libc_csu_init(%r1), %r23
ldw 0(%r23), %r23
/* void (*fini) (void) (5th argument) */
addil LT'.Lp__libc_csu_fini, %r19
ldw RT'.Lp__libc_csu_fini(%r1), %r22
ldw 0(%r22), %r22
#else
/* Load $global$ address into %dp */
ldil L%$global$, %dp
ldo R%$global$(%dp), %dp
/* load main (1st argument) */
ldil LR'.Lpmain, %r26
ldw RR'.Lpmain(%r26), %r26
/* void (*init) (void) (4th argument) */
ldil LR'.Lp__libc_csu_init, %r23
ldw RR'.Lp__libc_csu_init(%r23), %r23
/* void (*fini) (void) (5th argument) */
ldil LR'.Lp__libc_csu_fini, %r22
ldw RR'.Lp__libc_csu_fini(%r22), %r22
#endif
/* Store 5th argument */
stw %r22, -52(%sp)
/* void *stack_end (7th argument) */
stw %sp, -60(%sp)
bl __libc_start_main,%r2
nop
/* die horribly if it returned (it shouldn't) */
iitlbp %r0,(%sr0,%r0)
nop
.procend
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,134 +0,0 @@
/* ELF startup code for HPPA.
Copyright (C) 2002-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
.import main, code
.import $global$, data
.import __libc_start_main, code
/* Have the linker create plabel words so we get PLABEL32
relocs and not 21/14. The use of 21/14 relocs is only
supported in the latest dynamic linker. */
#ifdef PIC
.section .data.rel.ro,"aw",@progbits
#else
.section .rodata,"a",@progbits
#endif
.align 4
.Lpmain:
.word P%main
.Lp__libc_start_main:
.word P%__libc_start_main
.text
.align 4
.globl _start
.export _start, ENTRY
.type _start,@function
_start:
/* At entry to the function we have:
r26 - Unused
r25 - argc
r24 - argv
r23 - False _dl_fini plabel address
This function is called from the lower half of RTLD_START.
The call to __libc_start_main expects:
1. r26 - Application main
2. r25 - argc
3. r24 - argv
4. r23 - init (unused)
5. sp-52 - fini (unused)
6. sp-56 - rtld_fini
7. sp-60 - stackend */
.proc
.callinfo
/* Clear previous-sp. */
stw %r0, -4(%sp)
/* Setup the stack and frame. */
stw %rp, -20(%sp)
ldo 64(%sp), %sp
stw %sp, -4(%sp)
stw %r19, -32(%sp)
/* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
/* void (*rtld_fini) (void) (6th argument) */
stw %r23, -56(%sp)
/* Need to setup 1, 4, 5, and 7th arguments */
#ifdef PIC
/* Load $global$ address into %dp */
bl .+8, %dp
addil L'$global$-$PIC_pcrel$0+1, %dp
ldo R'$global$-$PIC_pcrel$0+5(%r1), %dp
/* load main (1st argument) */
addil LT'.Lpmain, %r19
ldw RT'.Lpmain(%r1), %r26
ldw 0(%r26),%r26
#else
/* Load $global$ address into %dp */
ldil L%$global$, %dp
ldo R%$global$(%dp), %dp
/* load main (1st argument) */
ldil LR'.Lpmain, %r26
ldw RR'.Lpmain(%r26), %r26
#endif
ldi 0,%r23 /* Used to be init. */
ldi 0,%r22 /* Used to be fini. */
/* Store 5th argument */
stw %r22, -52(%sp)
/* void *stack_end (7th argument) */
stw %sp, -60(%sp)
bl __libc_start_main,%r2
nop
/* die horribly if it returned (it shouldn't) */
iitlbp %r0,(%sr0,%r0)
nop
.procend
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,73 +0,0 @@
/* Assembler macros for HP/PA.
Copyright (C) 1999-2024 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/generic/sysdep.h>
#undef ASM_LINE_SEP
#define ASM_LINE_SEP !
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ALIGNARG(log2) log2
/* Define an entry point visible from C.
There is currently a bug in gdb which prevents us from specifying
incomplete stabs information. Fake some entries here which specify
the current source file. */
#define ENTRY(name) \
.SPACE $TEXT$ ASM_LINE_SEP \
.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
.align ALIGNARG(4) ASM_LINE_SEP \
.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
.EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\
C_LABEL(name) \
CALL_MCOUNT
#undef END
#define END(name) \
.PROCEND
/* GCC does everything for us. */
#ifdef PROF
#define CALL_MCOUNT
#else
#define CALL_MCOUNT /* Do nothing. */
#endif
#define PSEUDO(name, syscall_name, args) \
ENTRY (name) \
DO_CALL (syscall_name, args)
#undef PSEUDO_END
#define PSEUDO_END(name) \
END (name)
#undef JUMPTARGET
#define JUMPTARGET(name) name
#define SYSCALL_PIC_SETUP /* Nothing. */
/* Local label name for asm code. */
#ifndef L
#define L(name) name
#endif
#endif /* __ASSEMBLER__ */

View File

@@ -1,118 +0,0 @@
/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 <asm/fpu.h>
/*
* Arguments for __libc_start_main:
* out0: main
* out1: argc
* out2: argv
* out3: init
* out4: fini
* out5: rtld_fini
* out6: stack_end
*/
.align 32
.global _start
.proc _start
.type _start,@function
_start:
.prologue
.save rp, r0
.body
.prologue
{ .mlx
alloc r2 = ar.pfs,0,0,7,0
movl r3 = FPSR_DEFAULT
}
{ .mlx
adds out2 = 16, sp /* get address of argc value */
movl gp = @gprel(0f)
;;
}
0: { .mmi
ld8 out1 = [out2], 8 /* load argc and move out2 to become argv */
mov.m r10 = ar.bsp /* fetch rbs base address */
mov r9 = ip
;;
}
{ .mii
mov ar.fpsr = r3
sub gp = r9, gp /* back-compute gp value */
adds out6 = 16, sp /* highest non-environment stack address */
;;
}
{
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
addl out0 = @ltoff(@fptr(main)), gp
addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
;;
}
{ .mmi
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
ld8 out0 = [out0] /* pointer to `main' function descriptor */
addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
;;
}
{ .mmi
ld8 out3 = [out3] /* pointer to `init' function descriptor */
ld8 out4 = [out4] /* pointer to `fini' function descriptor */
nop 0
}
.body
{ .mib
st8 [r3] = r10
mov out5 = ret0 /* dynamic linker destructor */
br.call.sptk.few rp = __libc_start_main
}
{ .mib
break 0 /* break miserably if we ever return */
}
.endp _start
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start
.common __libc_ia64_register_backing_store_base, 8, 8

View File

@@ -1,15 +0,0 @@
#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
/* MicroBlaze has selectable endianness. */
#ifdef _BIG_ENDIAN
# define __BYTE_ORDER __BIG_ENDIAN
#else
# define __BYTE_ORDER __LITTLE_ENDIAN
#endif
#endif /* bits/endianness.h */

View File

@@ -1,90 +0,0 @@
/* Special .init and .fini section support for MicroBlaze.
Copyright (C) 2012-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI. */
#include <libc-symbols.h>
#include <sysdep.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
.section .init,"ax",@progbits
.align 2
.globl _init
.hidden _init
.type _init, @function
_init:
addik r1,r1,-32
swi r20,r1,28
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r3,r20,PREINIT_FUNCTION@GOT
#if PREINIT_FUNCTION_WEAK
beqid r3,$Lno_weak_fn:
swi r15,r1,0
brlid r15,PREINIT_FUNCTION@PLT
$Lno_weak_fn:
#else
swi r15,r1,0
brald r15,r3
#endif
nop # Unfilled delay slot
.section .fini,"ax",@progbits
.align 2
.globl _fini
.hidden _fini
.type _fini, @function
_fini:
addik r1,r1,-32
swi r20,r1,28
swi r15,r1,0
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8

View File

@@ -1,51 +0,0 @@
/* Special .init and .fini section support for MicroBlaze.
Copyright (C) 1995-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
#include <sysdep.h>
.section .init,"ax",@progbits
lwi r15,r1,0
lwi r20,r1,28
rtsd r15,8
addik r1,r1,32
.section .fini,"ax",@progbits
lwi r15,r1,0
lwi r20,r1,28
rtsd r15,8
addik r1,r1,32

View File

@@ -1,84 +0,0 @@
/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
.text
.globl _start
.type _start,@function
_start:
/* On entry the stack contains the following args:
r1+0 - argc
r1+4 - argv[0]
...
r1+4*(argc-1) - argv[argc-1]
r1+4*argc - NULL
r1+4*argc + 4 - envp[0]
...
NULL
*/
addk r3,r0,r0
addk r5,r1,r0
1:
addik r5,r5,4
lw r4,r5,r0
bneid r4,1b
addik r3,r3,1
addik r6,r3,-1
sw r6,r1,r0
addik r7,r1,4
addik r1,r1,-24
#ifdef SHARED
/* Setup PIC. */
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r5,r20,main@GOT
lwi r8,r20,__libc_csu_init@GOT
lwi r9,r20,__libc_csu_fini@GOT
brid __libc_start_main@PLT
addk r10,r0,r0
#else
addik r5,r0,main
addik r8,r0,__libc_csu_init
addik r9,r0,__libc_csu_fini
brid __libc_start_main
addk r10,r0,r0
#endif
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,84 +0,0 @@
/* Copyright (C) 1995-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
.text
.globl _start
.type _start,@function
_start:
/* On entry the stack contains the following args:
r1+0 - argc
r1+4 - argv[0]
...
r1+4*(argc-1) - argv[argc-1]
r1+4*argc - NULL
r1+4*argc + 4 - envp[0]
...
NULL
*/
addk r3,r0,r0
addk r5,r1,r0
1:
addik r5,r5,4
lw r4,r5,r0
bneid r4,1b
addik r3,r3,1
addik r6,r3,-1
sw r6,r1,r0
addik r7,r1,4
addik r1,r1,-24
#ifdef SHARED
/* Setup PIC. */
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r5,r20,main@GOT
addk r8,r0,r0 /* Used to be init. */
addk r9,r0,r0 /* Used to be fini. */
brid __libc_start_main@PLT
addk r10,r0,r0
#else
addik r5,r0,main
addk r8,r0,r0 /* Used to be init. */
addk r9,r0,r0 /* Used to be fini. */
brid __libc_start_main
addk r10,r0,r0
#endif
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,85 +0,0 @@
/* Copyright (C) 1997-2024 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/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
# define ALIGNARG(log2) log2
# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
/* Define an entry point visible from C. */
# define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),@function; \
.align ALIGNARG(2); \
C_LABEL(name) \
CALL_MCOUNT
# undef END
# define END(name) ASM_SIZE_DIRECTIVE(name)
/* If compiled for profiling, call `_mcount' at the start of each function. */
# ifdef PROF
/* The mcount code relies on a normal frame pointer being on the stack
to locate our caller, so push one just for its benefit. */
# define CALL_MCOUNT \
addik r1,r1,-4; \
swi r15,r1,0; \
brlid r15,JUMPTARGET(mcount); \
nop; \
lwi r15,r1,0; \
addik r1,r1,4;
# else
# define CALL_MCOUNT /* Do nothing. */
# endif
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
# define syscall_error __syscall_error
# define mcount _mcount
# define PSEUDO(name, syscall_name, args) \
.globl syscall_error; \
ENTRY (name) \
DO_CALL (syscall_name, args);
# define ret \
rtsd r15,8; nop;
# undef PSEUDO_END
# define PSEUDO_END(name) \
END (name)
# undef JUMPTARGET
# ifdef PIC
# define JUMPTARGET(name) name##@PLTPC
# else
# define JUMPTARGET(name) name
# endif
/* Local label name for asm code. */
# ifndef L
# define L(name) $L##name
# endif
# endif /* __ASSEMBLER__ */

View File

@@ -1,65 +0,0 @@
/* Assembler macros for Nios II.
Copyright (C) 2015-2024 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/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT;
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(name)
#ifdef PROF
# ifdef __PIC__
# define CALL_MCOUNT \
mov r8, ra; \
nextpc r2; \
1: \
movhi r3, %hiadj(_gp_got - 1b); \
addi r3, r3, %lo(_gp_got - 1b); \
add r2, r2, r3; \
ldw r2, %call(_mcount)(r2); \
callr r2; \
mov ra, r8; \
ret;
# else
# define CALL_MCOUNT \
mov r8, ra; \
call _mount; \
mov ra, r8; \
ret;
# endif
#else
# define CALL_MCOUNT /* Do nothing. */
#endif
#endif /* __ASSEMBLER__ */

View File

@@ -1,104 +0,0 @@
/* Special .init and .fini section support for S/390.
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI. */
#include <libc-symbols.h>
#include <sysdep.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
.section .init,"ax",@progbits
.globl _init
.hidden _init
.type _init,@function
.align 4
_init:
stm %r6,%r15,24(%r15)
bras %r13,1f
0:
#if PREINIT_FUNCTION_WEAK
.long PREINIT_FUNCTION@GOT
#else
.long PREINIT_FUNCTION-0b
#endif
.long _GLOBAL_OFFSET_TABLE_-0b
1: lr %r1,%r15
ahi %r15,-96
st %r1,0(%r15)
l %r12,4(%r13)
ar %r12,%r13
l %r1,0(%r13)
#if PREINIT_FUNCTION_WEAK
l %r1,0(%r1,%r12)
ltr %r1,%r1
je 2f
#else
la %r1,0(%r1,%r13)
#endif
basr %r14,%r1
.align 4,0x07
2:
.section .fini,"ax",@progbits
.globl _fini
.hidden _fini
.type _fini,@function
.align 4
_fini:
stm %r6,%r15,24(%r15)
bras %r13,1f
0: .long _GLOBAL_OFFSET_TABLE_-0b
1: lr %r1,%r15
ahi %r15,-96
st %r1,0(%r15)
l %r12,0(%r13)
ar %r12,%r13
.align 4,0x07

View File

@@ -1,47 +0,0 @@
/* Special .init and .fini section support for S/390.
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
.section .init,"ax",@progbits
l %r4,152(%r15)
lm %r6,%r15,120(%r15)
br %r4
.section .fini,"ax",@progbits
l %r4,152(%r15)
lm %r6,%r15,120(%r15)
br %r4

View File

@@ -1,219 +0,0 @@
/* Startup code compliant to the ELF s390 ABI.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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>
/*
This is the canonical entry point, usually the first thing in the text
segment. Most registers' values are unspecified, except for:
%r14 Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
%r15 The stack contains the arguments and environment:
0(%r15) argc
4(%r15) argv[0]
...
(4*argc)(%r15) NULL
(4*(argc+1))(%r15) envp[0]
...
NULL
*/
.text
.globl _start
.type _start,@function
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
/* zig patch: r14 -> %r14. revert with llvm 20. */
cfi_undefined (%r14)
/* Check if the kernel provides highgprs facility if needed by
the binary. */
lr %r6,%r15
la %r6,4(%r6) /* Skip the argument counter. */
.L11: l %r5,0(%r6) /* Skip the argument vector. */
la %r6,4(%r6)
ltr %r5,%r5
jne .L11
.L12: l %r5,0(%r6) /* Skip the environment vector. */
la %r6,4(%r6)
ltr %r5,%r5
jne .L12
/* Usually the auxiliary vector can be expected directly after
the environment variables. But we have to skip extra zeros
because the loader might have removed unsecure variables for
setuid programs. */
.L26: l %r5,0(%r6)
la %r6,4(%r6)
ltr %r5,%r5
jz .L26
ahi %r6,-4
/* Obtain the needed values from the auxiliary vector. */
lhi %r7,16 /* AT_HWCAP */
lhi %r8,3 /* AT_PHDR */
lhi %r9,5 /* AT_PHNUM */
lhi %r2,4 /* AT_PHENT */
.L13: l %r5,0(%r6)
clr %r5,%r7
jne .L15
l %r10,4(%r6) /* r10 = AT_HWCAP value. */
.L15: clr %r5,%r8
jne .L16
l %r11,4(%r6) /* r11 = AT_PHDR value. */
.L16: clr %r5,%r9
jne .L17
l %r12,4(%r6) /* r12 = AT_PHNUM value. */
.L17: clr %r5,%r2
jne .L18
l %r0,4(%r6) /* r0 = AT_PHENT value. */
.L18: ltr %r5,%r5
la %r6,8(%r6)
jnz .L13
/* Locate the ELF header by looking for the first PT_LOAD
segment with a p_offset of zero. */
lr %r4,%r11 /* Backup AT_PHDR. */
lhi %r7,1 /* PT_LOAD id */
lhi %r8,0
.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
jne .L20
cl %r8,4(%r4) /* p_offset == 0? */
jne .L20
l %r9,8(%r4) /* r9 = PT_LOAD.p_vaddr <- ELF header address */
j .L24
.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
brct %r12,.L19
j .+2 /* Trap, there must be such a phdr. */
.L24: lr %r4,%r11 /* Backup AT_PHDR. */
lhi %r2,6 /* PT_PHDR id */
.L23: cl %r2,0(%r4)
jne .L22
l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
j .L25
.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
brct %r12,.L23
j .L14 /* No PT_PHDR found - skip checking. */
.L25: slr %r11,%r3 /* AT_PHDR - PT_PHDR.p_vaddr (relocation offset)*/
alr %r9,%r11 /* PT_LOAD.p_vaddr += relocation offset */
l %r5,36(%r9) /* Load the e_flags field. */
tml %r5,1
jz .L14 /* Binary does not require highgprs facility. */
tml %r10,512 /* Check the AT_HWCAP value. */
jz 2 /* Trap if no highgprs facility available. */
.L14:
/* Setup pointer to literal pool of _start */
basr %r13,0
.L0: ahi %r13,.Llit-.L0
/* load argc and argv from stack */
la %r4,4(%r15) # get argv
l %r3,0(%r15) # get argc
/* align the stack to a double word boundary */
lhi %r0,-8
nr %r15,%r0
/* Setup a stack frame and a parameter area */
ahi %r15,-104 # make room on stack
xc 0(4,%r15),0(%r15) # clear back-chain
/* set up arguments for __libc_start_main:
main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
Note that envp will be determined later in __libc_start_main
*/
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
la %r7,96(%r15)
l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
l %r2,.L3-.Llit(%r13) # load pointer to main
l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
#ifdef PIC
l %r12,.L5-.Llit(%r13) # load .got pointer
la %r6,0(%r13,%r6)
la %r5,0(%r13,%r5)
la %r12,0(%r13,%r12)
l %r2,0(%r12,%r2)
la %r1,0(%r13,%r1)
#endif
/* ok, now branch to the libc main routine */
basr %r14,%r1
/* crash if __libc_start_main returns */
.word 0
cfi_endproc
.Llit:
#ifndef PIC
.L1: .long __libc_csu_init
.L2: .long __libc_csu_fini
.L3: .long main
.L4: .long __libc_start_main
#else
.L1: .long __libc_csu_init-.Llit
.L2: .long __libc_csu_fini-.Llit
.L3: .long main@GOT
.L4: .long __libc_start_main@plt-.Llit
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
#endif
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,212 +0,0 @@
/* Startup code compliant to the ELF s390 ABI.
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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>
/*
This is the canonical entry point, usually the first thing in the text
segment. Most registers' values are unspecified, except for:
%r14 Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
%r15 The stack contains the arguments and environment:
0(%r15) argc
4(%r15) argv[0]
...
(4*argc)(%r15) NULL
(4*(argc+1))(%r15) envp[0]
...
NULL
*/
.text
.globl _start
.type _start,@function
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
/* zig patch: r14 -> %r14. revert with llvm 20. */
cfi_undefined (%r14)
/* Check if the kernel provides highgprs facility if needed by
the binary. */
lr %r6,%r15
la %r6,4(%r6) /* Skip the argument counter. */
.L11: l %r5,0(%r6) /* Skip the argument vector. */
la %r6,4(%r6)
ltr %r5,%r5
jne .L11
.L12: l %r5,0(%r6) /* Skip the environment vector. */
la %r6,4(%r6)
ltr %r5,%r5
jne .L12
/* Usually the auxiliary vector can be expected directly after
the environment variables. But we have to skip extra zeros
because the loader might have removed insecure variables for
setuid programs. */
.L26: l %r5,0(%r6)
la %r6,4(%r6)
ltr %r5,%r5
jz .L26
ahi %r6,-4
/* Obtain the needed values from the auxiliary vector. */
lhi %r7,16 /* AT_HWCAP */
lhi %r8,3 /* AT_PHDR */
lhi %r9,5 /* AT_PHNUM */
lhi %r2,4 /* AT_PHENT */
.L13: l %r5,0(%r6)
clr %r5,%r7
jne .L15
l %r10,4(%r6) /* r10 = AT_HWCAP value. */
.L15: clr %r5,%r8
jne .L16
l %r11,4(%r6) /* r11 = AT_PHDR value. */
.L16: clr %r5,%r9
jne .L17
l %r12,4(%r6) /* r12 = AT_PHNUM value. */
.L17: clr %r5,%r2
jne .L18
l %r0,4(%r6) /* r0 = AT_PHENT value. */
.L18: ltr %r5,%r5
la %r6,8(%r6)
jnz .L13
/* Locate the ELF header by looking for the first PT_LOAD
segment with a p_offset of zero. */
lr %r4,%r11 /* Backup AT_PHDR. */
lhi %r7,1 /* PT_LOAD id */
lhi %r8,0
.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
jne .L20
cl %r8,4(%r4) /* p_offset == 0? */
jne .L20
l %r9,8(%r4) /* r9 = PT_LOAD.p_vaddr <- ELF header address */
j .L24
.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
brct %r12,.L19
j .+2 /* Trap, there must be such a phdr. */
.L24: lr %r4,%r11 /* Backup AT_PHDR. */
lhi %r2,6 /* PT_PHDR id */
.L23: cl %r2,0(%r4)
jne .L22
l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
j .L25
.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
brct %r12,.L23
j .L14 /* No PT_PHDR found - skip checking. */
.L25: slr %r11,%r3 /* AT_PHDR - PT_PHDR.p_vaddr (relocation offset)*/
alr %r9,%r11 /* PT_LOAD.p_vaddr += relocation offset */
l %r5,36(%r9) /* Load the e_flags field. */
tml %r5,1
jz .L14 /* Binary does not require highgprs facility. */
tml %r10,512 /* Check the AT_HWCAP value. */
jz 2 /* Trap if no highgprs facility available. */
.L14:
/* Setup pointer to literal pool of _start */
basr %r13,0
.L0: ahi %r13,.Llit-.L0
/* load argc and argv from stack */
la %r4,4(%r15) # get argv
l %r3,0(%r15) # get argc
/* align the stack to a double word boundary */
lhi %r0,-8
nr %r15,%r0
/* Setup a stack frame and a parameter area */
ahi %r15,-104 # make room on stack
xc 0(4,%r15),0(%r15) # clear back-chain
/* set up arguments for __libc_start_main:
main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
Note that envp will be determined later in __libc_start_main
*/
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
la %r7,96(%r15)
l %r2,.L3-.Llit(%r13) # load pointer to main
l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
#ifdef PIC
l %r12,.L5-.Llit(%r13) # load .got pointer
la %r12,0(%r13,%r12)
l %r2,0(%r12,%r2)
la %r1,0(%r13,%r1)
#endif
lhi %r6, 0 # Used to fini.
lhi %r5, 0 # Used to init.
/* ok, now branch to the libc main routine */
basr %r14,%r1
/* crash if __libc_start_main returns */
.word 0
cfi_endproc
.Llit:
#ifndef PIC
.L3: .long main
.L4: .long __libc_start_main
#else
.L3: .long main@GOT
.L4: .long __libc_start_main@plt-.Llit
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
#endif
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@@ -1,21 +0,0 @@
/* Hacks needed for symbol manipulation. s390 version.
Copyright (C) 2017-2024 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/wordsize-32/divdi3-symbol-hacks.h>
#include_next "symbol-hacks.h"

View File

@@ -1,100 +0,0 @@
/* Assembler macros for s390.
Copyright (C) 2000-2024 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/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
#define ALIGNARG(log2) 1<<log2
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
/* Define an entry point visible from C. */
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),@function; \
.align ALIGNARG(4); \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(name) \
/* If compiled for profiling, call `mcount' at the start of each function. */
#ifdef PROF
#ifdef PIC
#define CALL_MCOUNT \
lr 0,14 ; bras 14,.+12 ; .long _GLOBAL_OFFSET_TABLE_ - . ; .long 0f-. ; \
lr 1,14 ; al 1,4(14) ; al 14,0(14) ; l 14,_mcount@GOT(14) ; \
basr 14,14 ; lr 14,0 ; .data ; .align 4 ; 0: .long 0 ; .text ;
#else
#define CALL_MCOUNT \
lr 0,14 ; bras 14,.+12 ; .long _mcount ; .long 0f ; \
l 1,4(14) ; l 14,0(14) ; basr 14,14 ; lr 14,0 ; \
.data ; .align 4 ; 0: .long 0 ; .text ;
#endif
#else
#define CALL_MCOUNT /* Do nothing. */
#endif
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
#define syscall_error __syscall_error
#define mcount _mcount
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
lose: SYSCALL_PIC_SETUP \
basr %r1,0; \
0: al %r1,1f-0b(%r1); \
br %r1; \
1: .long JUMPTARGET(syscall_error) - 0b; \
.globl syscall_error; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
jm lose
#undef PSEUDO_END
#define PSEUDO_END(name) \
END (name)
#undef JUMPTARGET
#ifdef SHARED
#define JUMPTARGET(name) name##@PLT
#define SYSCALL_PIC_SETUP \
bras %r12,1f; \
0: .long _GLOBAL_OFFSET_TABLE_-0b; \
1: al %r12,0(%r12)
#else
#define JUMPTARGET(name) name
#define SYSCALL_PIC_SETUP /* Nothing. */
#endif
/* Local label name for asm code. */
#ifndef L
#define L(name) .L##name
#endif
#endif /* __ASSEMBLER__ */

View File

@@ -1,15 +0,0 @@
#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
/* SH has selectable endianness. */
#ifdef __LITTLE_ENDIAN__
#define __BYTE_ORDER __LITTLE_ENDIAN
#else
#define __BYTE_ORDER __BIG_ENDIAN
#endif
#endif /* bits/endianness.h */

View File

@@ -1,122 +0,0 @@
/* Special .init and .fini section support for SH.
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI. */
#include <libc-symbols.h>
#include <sysdep.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
.section .init,"ax",@progbits
.align 5
.global _init
.hidden _init
.type _init, @function
_init:
mov.l r12,@-r15
mova .L12,r0
mov.l .L12,r12
mov.l r14,@-r15
add r0,r12
sts.l pr,@-r15
#if PREINIT_FUNCTION_WEAK
mov.l .L13,r0
mov.l @(r0,r12),r1
tst r1,r1
bt/s .L8
mov r15,r14
mov.l .L14,r1
bsrf r1
.LPCS0:
nop
.L8:
#else
mova .L13,r0
mov.l .L13,r1
add r0,r1
jsr @r1
mov r15,r14
#endif
bra 1f
nop
.align 2
.L12:
.long _GLOBAL_OFFSET_TABLE_
#if PREINIT_FUNCTION_WEAK
.L13:
.long PREINIT_FUNCTION@GOT
.L14:
.long PREINIT_FUNCTION@PLT-(.LPCS0+2-(.))
#else
.L13:
.long PREINIT_FUNCTION@PLT
#endif
1:
.section .fini,"ax",@progbits
.align 5
.global _fini
.hidden _fini
.type _fini, @function
_fini:
mov.l r12,@-r15
mova .L19,r0
mov.l r14,@-r15
sts.l pr,@-r15
mov.l .L19,r12
mov r15,r14
add r0,r12
bra 0f
nop
.align 2
.L19:
.long _GLOBAL_OFFSET_TABLE_
0:

View File

@@ -1,53 +0,0 @@
/* Special .init and .fini section support for SH.
Copyright (C) 2000-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
.section .init,"ax",@progbits
mov r14,r15
lds.l @r15+,pr
mov.l @r15+,r14
mov.l @r15+,r12
rts
nop
.section .fini,"ax",@progbits
mov r14,r15
lds.l @r15+,pr
mov.l @r15+,r14
mov.l @r15+,r12
rts
nop

View File

@@ -1,111 +0,0 @@
/* Startup code for SH & ELF.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 is the canonical entry point, usually the first thing in the text
segment.
Note that the code in the .init section has already been run.
This includes _init and _libc_init
At this entry point, most registers' values are unspecified, except:
r4 Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
sp The stack contains the arguments and environment:
0(sp) argc
4(sp) argv[0]
...
(4*argc)(sp) NULL
(4*(argc+1))(sp) envp[0]
...
NULL
*/
.text
.globl _start
.type _start,@function
_start:
/* Clear the frame pointer since this is the outermost frame. */
mov #0, r14
/* Pop argc off the stack and save a pointer to argv */
mov.l @r15+,r5
mov r15, r6
/* Push the last arguments to main() onto the stack */
mov.l r4,@-r15
mov.l L_fini,r0
mov.l r0,@-r15
/* Set up the other arguments for main() that go in registers */
mov.l L_main,r4
mov.l L_init,r7
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
/* Let the libc call main and exit with its return code. */
mov.l L_libc_start_main,r1
jsr @r1
nop
/* should never get here....*/
mov.l L_abort,r1
jsr @r1
nop
.align 2
L_main:
.long main
L_init:
.long __libc_csu_init
L_fini:
.long __libc_csu_fini
L_libc_start_main:
.long __libc_start_main
L_abort:
.long abort
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start
.global __fpscr_values
__fpscr_values:
.long 0
.long 0x80000

View File

@@ -1,106 +0,0 @@
/* Startup code for SH & ELF.
Copyright (C) 1999-2024 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 is the canonical entry point, usually the first thing in the text
segment.
Note that the code in the .init section has already been run.
This includes _init and _libc_init
At this entry point, most registers' values are unspecified, except:
r4 Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
sp The stack contains the arguments and environment:
0(sp) argc
4(sp) argv[0]
...
(4*argc)(sp) NULL
(4*(argc+1))(sp) envp[0]
...
NULL
*/
.text
.globl _start
.type _start,@function
_start:
/* Clear the frame pointer since this is the outermost frame. */
mov #0, r14
/* Pop argc off the stack and save a pointer to argv */
mov.l @r15+,r5
mov r15, r6
/* Push the last arguments to main() onto the stack */
mov.l r4,@-r15
mov.l r14,@-r15 /* Used to be fini. */
/* Set up the other arguments for main() that go in registers */
mov.l L_main,r4
mov #0,r7 /* Used to be init. */
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
/* Let the libc call main and exit with its return code. */
mov.l L_libc_start_main,r1
jsr @r1
nop
/* should never get here....*/
mov.l L_abort,r1
jsr @r1
nop
.align 2
L_main:
.long main
L_libc_start_main:
.long __libc_start_main
L_abort:
.long abort
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start
.global __fpscr_values
__fpscr_values:
.long 0
.long 0x80000

View File

@@ -1,75 +0,0 @@
/* Assembler macros for SH.
Copyright (C) 1999-2024 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/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ALIGNARG(log2) log2
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
#ifdef SHARED
#define PLTJMP(_x) _x##@PLT
#else
#define PLTJMP(_x) _x
#endif
/* Define an entry point visible from C. */
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),@function; \
.align ALIGNARG(5); \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
/* If compiled for profiling, call `mcount' at the start of each function. */
#ifdef PROF
#define CALL_MCOUNT \
mov.l 1f,r1; \
sts.l pr,@-r15; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (pr, 0); \
mova 2f,r0; \
jmp @r1; \
lds r0,pr; \
.align 2; \
1: .long mcount; \
2: lds.l @r15+,pr; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (pr)
#else
#define CALL_MCOUNT /* Do nothing. */
#endif
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
#define syscall_error __syscall_error
#define mcount _mcount
#endif /* __ASSEMBLER__ */

View File

@@ -1,83 +0,0 @@
/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.
Copyright (C) 2002-2024 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_TYPES_H
# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
#endif
#ifndef _BITS_TYPESIZES_H
#define _BITS_TYPESIZES_H 1
/* See <bits/types.h> for the meaning of these macros. This file exists so
that <bits/types.h> need not vary across different GNU platforms. */
#define __DEV_T_TYPE __U64_TYPE
#define __UID_T_TYPE __U32_TYPE
#define __GID_T_TYPE __U32_TYPE
#define __INO_T_TYPE __U32_TYPE
#define __INO64_T_TYPE __U64_TYPE
#define __MODE_T_TYPE __U32_TYPE
#define __NLINK_T_TYPE __U32_TYPE
#define __OFF_T_TYPE __SLONGWORD_TYPE
#define __OFF64_T_TYPE __S64_TYPE
#define __PID_T_TYPE __S32_TYPE
#define __RLIM_T_TYPE __ULONGWORD_TYPE
#define __RLIM64_T_TYPE __U64_TYPE
#define __BLKCNT_T_TYPE __U32_TYPE
#define __BLKCNT64_T_TYPE __U64_TYPE
#define __FSBLKCNT_T_TYPE __S32_TYPE
#define __FSBLKCNT64_T_TYPE __S64_TYPE
#define __FSFILCNT_T_TYPE __U32_TYPE
#define __FSFILCNT64_T_TYPE __U64_TYPE
#define __ID_T_TYPE __U32_TYPE
#define __CLOCK_T_TYPE __SLONGWORD_TYPE
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __S64_TYPE
#define __SUSECONDS64_T_TYPE __S64_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
#define __TIMER_T_TYPE void *
#define __BLKSIZE_T_TYPE __U32_TYPE
#define __FSID_T_TYPE struct { int __val[2]; }
#define __SSIZE_T_TYPE __SWORD_TYPE
#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
#define __CPU_MASK_TYPE __ULONGWORD_TYPE
#define __FSWORD_T_TYPE __S32_TYPE
/* Tell the libc code that off_t and off64_t are actually the same type
for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */
#define __OFF_T_MATCHES_OFF64_T 1
/* And for __rlim_t and __rlim64_t. */
#define __RLIM_T_MATCHES_RLIM64_T 1
/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 0
/* And for getitimer, setitimer and rusage */
#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
#endif /* bits/typesizes.h */

View File

@@ -1,57 +0,0 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
Copyright (C) 2010-2024 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 _KERNEL_FEATURES_H
#define _KERNEL_FEATURES_H 1
#include_next <kernel-features.h>
/* Support for statfs64 was added in 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_STATFS64
# define __ASSUME_STATFS64 0
#endif
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
/* Support for the renameat2 syscall was added in 3.17. */
#if __LINUX_KERNEL_VERSION < 0x031100
# undef __ASSUME_RENAMEAT2
#endif
/* Support for the execveat syscall was added in 4.2. */
#if __LINUX_KERNEL_VERSION < 0x040200
# undef __ASSUME_EXECVEAT
#endif
/* Support for copy_file_range, statx was added in kernel 4.13. */
#if __LINUX_KERNEL_VERSION < 0x040D00
# undef __ASSUME_MLOCK2
# undef __ASSUME_STATX
#endif
/* Alpha requires old sysvipc even being a 64-bit architecture. */
#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
/* Alpha does not provide clone3. */
#undef __ASSUME_CLONE3
#define __ASSUME_CLONE3 0
#endif /* _KERNEL_FEATURES_H */

View File

@@ -1,316 +0,0 @@
/* Copyright (C) 1992-2024 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 _LINUX_ALPHA_SYSDEP_H
#define _LINUX_ALPHA_SYSDEP_H 1
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
#ifdef __ASSEMBLER__
#include <asm/pal.h>
#include <alpha/regdef.h>
#define __LABEL(x) x##:
#define LEAF(name, framesize) \
.globl name; \
.align 4; \
.ent name, 0; \
__LABEL(name) \
.frame sp, framesize, ra
#define ENTRY(name) \
.globl name; \
.align 4; \
.ent name, 0; \
__LABEL(name) \
.frame sp, 0, ra
/* Mark the end of function SYM. */
#undef END
#define END(sym) .end sym
#ifdef PROF
# define PSEUDO_PROF \
.set noat; \
lda AT, _mcount; \
jsr AT, (AT), _mcount; \
.set at
#else
# define PSEUDO_PROF
#endif
#ifdef PROF
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
ldgp gp,0(pv); \
PSEUDO_PROF; \
.prologue 1
#elif defined PIC
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
.prologue 0
#else
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
ldgp gp,0(pv); \
.prologue 1
#endif /* PROF */
#ifdef PROF
# define USEPV_PROF std
#else
# define USEPV_PROF no
#endif
#undef SYSCALL_ERROR_LABEL
#if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_LABEL $syscall_error
# define SYSCALL_ERROR_HANDLER \
$syscall_error: \
stl v0, rtld_errno(gp) !gprel; \
lda v0, -1; \
ret
# define SYSCALL_ERROR_FALLTHRU
#elif defined(PIC)
# define SYSCALL_ERROR_LABEL __syscall_error !samegp
# define SYSCALL_ERROR_HANDLER
# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
#else
# define SYSCALL_ERROR_LABEL $syscall_error
# define SYSCALL_ERROR_HANDLER \
$syscall_error: \
jmp $31, __syscall_error
# define SYSCALL_ERROR_FALLTHRU
#endif /* RTLD_PRIVATE_ERRNO */
/* Overridden by specific syscalls. */
#undef PSEUDO_PREPARE_ARGS
#define PSEUDO_PREPARE_ARGS /* Nothing. */
#define PSEUDO(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys; \
bne a3, SYSCALL_ERROR_LABEL
#undef PSEUDO_END
#define PSEUDO_END(sym) \
SYSCALL_ERROR_HANDLER; \
END(sym)
#define PSEUDO_NOERRNO(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys;
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(sym) END(sym)
#define ret_NOERRNO ret
#define PSEUDO_ERRVAL(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys;
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(sym) END(sym)
#define ret_ERRVAL ret
#define r0 v0
#define r1 a4
#define MOVE(x,y) mov x,y
#else /* !ASSEMBLER */
#define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr(__NR_##name, args)
#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
internal_syscall##nr(name, args)
/* The normal Alpha calling convention sign-extends 32-bit quantties
no matter what the "real" sign of the 32-bit type. We want to
preserve that when filling in values for the kernel. */
#define syscall_promote(arg) \
(sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
#define internal_syscall_clobbers \
"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
"$22", "$23", "$24", "$25", "$27", "$28", "memory"
/* It is moderately important optimization-wise to limit the lifetime
of the hard-register variables as much as possible. Thus we copy
in/out as close to the asm as possible. */
#define internal_syscall0(name, args...) \
({ \
register long int _sc_19 __asm__("$19"); \
register long int _sc_0 = name; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2" \
: "+v"(_sc_0), "=r"(_sc_19) \
: : internal_syscall_clobbers, \
"$16", "$17", "$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall1(name,arg1) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3" \
: "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
: : internal_syscall_clobbers, \
"$17", "$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall2(name,arg1,arg2) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4" \
: "+v"(_sc_0), "=r"(_sc_19), \
"+r"(_sc_16), "+r"(_sc_17) \
: : internal_syscall_clobbers, \
"$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall3(name,arg1,arg2,arg3) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5" \
: "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18) \
: : internal_syscall_clobbers, "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall4(name,arg1,arg2,arg3,arg4) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18) \
: : internal_syscall_clobbers, "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _tmp_20 = syscall_promote (arg5); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
register long int _sc_20 __asm__("$20") = _tmp_20; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
: : internal_syscall_clobbers, "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _tmp_20 = syscall_promote (arg5); \
register long int _tmp_21 = syscall_promote (arg6); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
register long int _sc_20 __asm__("$20") = _tmp_20; \
register long int _sc_21 __asm__("$21") = _tmp_21; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
"+r"(_sc_21) \
: : internal_syscall_clobbers); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#endif /* ASSEMBLER */
#endif /* _LINUX_ALPHA_SYSDEP_H */

View File

@@ -1,14 +0,0 @@
/* Versions of the 'struct stat' data structure used in compatibility xstat
functions. */
#define _STAT_VER_KERNEL 0
#define _STAT_VER_GLIBC2 1
#define _STAT_VER_GLIBC2_1 2
#define _STAT_VER_KERNEL64 3
#define _STAT_VER_GLIBC2_3_4 3
#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX
/* Versions of the 'xmknod' interface used in compatibility xmknod
functions. */
#define _MKNOD_VER_LINUX 0
#define _MKNOD_VER _MKNOD_VER_LINUX

View File

@@ -1,35 +0,0 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
Copyright (C) 2006-2024 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_next <kernel-features.h>
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
/* Support for the execveat syscall was added in 4.0. */
#if __LINUX_KERNEL_VERSION < 0x040000
# undef __ASSUME_EXECVEAT
#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS 1
/* QEMU does not support set_robust_list. */
#undef __ASSUME_SET_ROBUST_LIST

View File

@@ -1,482 +0,0 @@
/* Assembler macros for PA-RISC.
Copyright (C) 1999-2024 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 _LINUX_HPPA_SYSDEP_H
#define _LINUX_HPPA_SYSDEP_H 1
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/hppa/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
#include <tls.h>
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
#include <errno.h>
#endif
#undef ASM_LINE_SEP
#define ASM_LINE_SEP !
#undef SYS_ify
#define SYS_ify(syscall_name) (__NR_##syscall_name)
/* The vfork, fork, and clone syscalls clobber r19
* and r21. We list r21 as either clobbered or as an
* input to a 6-argument syscall. We must save and
* restore r19 in both PIC and non-PIC cases.
*/
/* WARNING: TREG must be a callee saves register so
that it doesn't have to be restored after a call
to another function */
#define TREG 4
#define SAVE_PIC(SREG) \
copy %r19, SREG
#define LOAD_PIC(LREG) \
copy LREG , %r19
/* Inline assembly defines */
#define TREG_ASM "%r4" /* Can't clobber r3, it holds framemarker */
#define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n"
#define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n"
#define CLOB_TREG TREG_ASM ,
#define PIC_REG_DEF register unsigned long __r19 asm("r19");
#define PIC_REG_USE , "r" (__r19)
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ALIGNARG(log2) log2
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
/* ELF-like local names start with `.L'. */
#undef L
#define L(name) .L##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 %eax
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. */
/* We don't want the label for the error handle to be global when we define
it here. */
/*#ifdef PIC
# define SYSCALL_ERROR_LABEL 0f
#else
# define SYSCALL_ERROR_LABEL syscall_error
#endif*/
/* Argument manipulation from the stack for preparing to
make a syscall */
#define DOARGS_0 /* nothing */
#define DOARGS_1 /* nothing */
#define DOARGS_2 /* nothing */
#define DOARGS_3 /* nothing */
#define DOARGS_4 /* nothing */
#define DOARGS_5 ldw -52(%sp), %r22 ASM_LINE_SEP
#define DOARGS_6 DOARGS_5 ldw -56(%sp), %r21 ASM_LINE_SEP
#define UNDOARGS_0 /* nothing */
#define UNDOARGS_1 /* nothing */
#define UNDOARGS_2 /* nothing */
#define UNDOARGS_3 /* nothing */
#define UNDOARGS_4 /* nothing */
#define UNDOARGS_5 /* nothing */
#define UNDOARGS_6 /* nothing */
/* Define an entry point visible from C.
There is currently a bug in gdb which prevents us from specifying
incomplete stabs information. Fake some entries here which specify
the current source file. */
#undef ENTRY
#define ENTRY(name) \
.text ASM_LINE_SEP \
.align ALIGNARG(4) ASM_LINE_SEP \
.export C_SYMBOL_NAME(name) ASM_LINE_SEP \
.type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
cfi_startproc ASM_LINE_SEP \
C_LABEL(name) ASM_LINE_SEP \
.PROC ASM_LINE_SEP \
.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
.ENTRY ASM_LINE_SEP \
/* SAVE_RP says we do */ ASM_LINE_SEP \
stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
.cfi_offset 2, -20 ASM_LINE_SEP \
/*FIXME: Call mcount? (careful with stack!) */
/* Some syscall wrappers do not call other functions, and
hence are classified as leaf, so add NO_CALLS for gdb */
#define ENTRY_LEAF(name) \
.text ASM_LINE_SEP \
.align ALIGNARG(4) ASM_LINE_SEP \
.export C_SYMBOL_NAME(name) ASM_LINE_SEP \
.type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
cfi_startproc ASM_LINE_SEP \
C_LABEL(name) ASM_LINE_SEP \
.PROC ASM_LINE_SEP \
.CALLINFO FRAME=64,NO_CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
.ENTRY ASM_LINE_SEP \
/* SAVE_RP says we do */ ASM_LINE_SEP \
stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
.cfi_offset 2, -20 ASM_LINE_SEP \
/*FIXME: Call mcount? (careful with stack!) */
#undef END
#define END(name) \
.EXIT ASM_LINE_SEP \
.PROCEND ASM_LINE_SEP \
cfi_endproc ASM_LINE_SEP \
.size C_SYMBOL_NAME(name), .-C_SYMBOL_NAME(name) ASM_LINE_SEP
/* If compiled for profiling, call `mcount' at the start
of each function. No, don't bother. gcc will put the
call in for us. */
#define CALL_MCOUNT /* Do nothing. */
/* syscall wrappers consist of
#include <sysdep.h>
PSEUDO(...)
ret
PSEUDO_END(...)
which means
ENTRY(name)
DO_CALL(...)
bv,n 0(2)
*/
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
ENTRY (name) ASM_LINE_SEP \
/* If necc. load args from stack */ ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL (syscall_name, args) ASM_LINE_SEP \
UNDOARGS_##args ASM_LINE_SEP
#define ret \
/* Return value set by ERRNO code */ ASM_LINE_SEP \
bv,n 0(2) ASM_LINE_SEP
#undef PSEUDO_END
#define PSEUDO_END(name) \
END (name)
/* We don't set the errno on the return from the syscall */
#define PSEUDO_NOERRNO(name, syscall_name, args) \
ENTRY_LEAF (name) ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL_NOERRNO (syscall_name, args) ASM_LINE_SEP \
UNDOARGS_##args ASM_LINE_SEP
#define ret_NOERRNO ret
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(name) \
END (name)
/* This has to return the error value */
#undef PSEUDO_ERRVAL
#define PSEUDO_ERRVAL(name, syscall_name, args) \
ENTRY_LEAF (name) ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL_ERRVAL (syscall_name, args) ASM_LINE_SEP \
UNDOARGS_##args ASM_LINE_SEP
#define ret_ERRVAL ret
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(name) \
END(name)
#undef JUMPTARGET
#define JUMPTARGET(name) name
#define SYSCALL_PIC_SETUP /* Nothing. */
/* FIXME: This comment is not true.
* All the syscall assembly macros rely on finding the appropriate
SYSCALL_ERROR_LABEL or rather HANDLER. */
/* int * __errno_location(void) so you have to store your value
into the return address! */
#define DEFAULT_SYSCALL_ERROR_HANDLER \
.import __errno_location,code ASM_LINE_SEP \
/* branch to errno handler */ ASM_LINE_SEP \
bl __errno_location,%rp ASM_LINE_SEP
/* Here are the myriad of configuration options that the above can
work for... what we've done is provide the framework for future
changes if required to each section */
#ifdef PIC
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
# else /* !RTLD_PRIVATE_ERRNO */
# if defined _LIBC_REENTRANT
# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
# else /* !_LIBC_REENTRANT */
# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
# endif /* _LIBC_REENTRANT */
# endif /* RTLD_PRIVATE_ERRNO */
#else
# ifndef _LIBC_REENTRANT
# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
# else
# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
# endif
#endif
/* Linux takes system call arguments in registers:
syscall number gr20
arg 1 gr26
arg 2 gr25
arg 3 gr24
arg 4 gr23
arg 5 gr22
arg 6 gr21
The compiler calls us by the C convention:
syscall number in the DO_CALL macro
arg 1 gr26
arg 2 gr25
arg 3 gr24
arg 4 gr23
arg 5 -52(sp)
arg 6 -56(sp)
gr22 and gr21 are caller-saves, so we can just load the arguments
there and generally be happy. */
/* the cmpb...no_error code below inside DO_CALL
* is intended to mimic the if (__sys_res...)
* code inside INLINE_SYSCALL
*/
#define NO_ERROR -0x1000
#undef DO_CALL
#define DO_CALL(syscall_name, args) \
/* Create a frame */ ASM_LINE_SEP \
stwm TREG, 64(%sp) ASM_LINE_SEP \
.cfi_def_cfa_offset -64 ASM_LINE_SEP \
.cfi_offset TREG, 0 ASM_LINE_SEP \
stw %sp, -4(%sp) ASM_LINE_SEP \
stw %r19, -32(%sp) ASM_LINE_SEP \
.cfi_offset 19, 32 ASM_LINE_SEP \
/* Save r19 */ ASM_LINE_SEP \
SAVE_PIC(TREG) ASM_LINE_SEP \
/* Do syscall, delay loads # */ ASM_LINE_SEP \
ble 0x100(%sr2,%r0) ASM_LINE_SEP \
ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
ldi NO_ERROR,%r1 ASM_LINE_SEP \
cmpb,>>=,n %r1,%ret0,L(pre_end) ASM_LINE_SEP \
/* Restore r19 from TREG */ ASM_LINE_SEP \
LOAD_PIC(TREG) /* delay */ ASM_LINE_SEP \
SYSCALL_ERROR_HANDLER ASM_LINE_SEP \
/* Use TREG for temp storage */ ASM_LINE_SEP \
copy %ret0, TREG /* delay */ ASM_LINE_SEP \
/* OPTIMIZE: Don't reload r19 */ ASM_LINE_SEP \
/* do a -1*syscall_ret0 */ ASM_LINE_SEP \
sub %r0, TREG, TREG ASM_LINE_SEP \
/* Store into errno location */ ASM_LINE_SEP \
stw TREG, 0(%sr0,%ret0) ASM_LINE_SEP \
/* return -1 as error */ ASM_LINE_SEP \
ldo -1(%r0), %ret0 ASM_LINE_SEP \
L(pre_end): ASM_LINE_SEP \
/* Restore our frame, restoring TREG */ ASM_LINE_SEP \
ldwm -64(%sp), TREG ASM_LINE_SEP \
/* Restore return pointer */ ASM_LINE_SEP \
ldw -20(%sp),%rp ASM_LINE_SEP
/* We do nothing with the return, except hand it back to someone else */
#undef DO_CALL_NOERRNO
#define DO_CALL_NOERRNO(syscall_name, args) \
/* No need to store r19 */ ASM_LINE_SEP \
ble 0x100(%sr2,%r0) ASM_LINE_SEP \
ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
/* Caller will restore r19 */ ASM_LINE_SEP
/* Here, we return the ERRVAL in assembly, note we don't call the
error handler function, but we do 'negate' the return _IF_
it's an error. Not sure if this is the right semantic. */
#undef DO_CALL_ERRVAL
#define DO_CALL_ERRVAL(syscall_name, args) \
/* No need to store r19 */ ASM_LINE_SEP \
ble 0x100(%sr2,%r0) ASM_LINE_SEP \
ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
/* Caller will restore r19 */ ASM_LINE_SEP \
ldi NO_ERROR,%r1 ASM_LINE_SEP \
cmpb,>>=,n %r1,%ret0,0f ASM_LINE_SEP \
sub %r0, %ret0, %ret0 ASM_LINE_SEP \
0: ASM_LINE_SEP
#else
/* GCC has to be warned that a syscall may clobber all the ABI
registers listed as "caller-saves", see page 8, Table 2
in section 2.2.6 of the PA-RISC RUN-TIME architecture
document. However! r28 is the result and will conflict with
the clobber list so it is left out. Also the input arguments
registers r20 -> r26 will conflict with the list so they
are treated specially. Although r19 is clobbered by the syscall
we cannot say this because it would violate ABI, thus we say
TREG is clobbered and use that register to save/restore r19
across the syscall. */
#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
"%r20", "%r29", "%r31"
/* Similar to INLINE_SYSCALL but we don't set errno */
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \
({ \
long __sys_res; \
{ \
LOAD_ARGS_##nr(args) \
register unsigned long __res asm("r28"); \
PIC_REG_DEF \
LOAD_REGS_##nr \
/* FIXME: HACK save/load r19 around syscall */ \
asm volatile( \
SAVE_ASM_PIC \
" ble 0x100(%%sr2, %%r0)\n" \
" ldi %1, %%r20\n" \
LOAD_ASM_PIC \
: "=r" (__res) \
: "i" (SYS_ify(name)) PIC_REG_USE ASM_ARGS_##nr \
: "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \
); \
__sys_res = (long)__res; \
} \
__sys_res; \
})
/* The _NCS variant allows non-constant syscall numbers. */
#undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \
long __sys_res; \
{ \
LOAD_ARGS_##nr(args) \
register unsigned long __res asm("r28"); \
PIC_REG_DEF \
LOAD_REGS_##nr \
/* FIXME: HACK save/load r19 around syscall */ \
asm volatile( \
SAVE_ASM_PIC \
" ble 0x100(%%sr2, %%r0)\n" \
" copy %1, %%r20\n" \
LOAD_ASM_PIC \
: "=r" (__res) \
: "r" (name) PIC_REG_USE ASM_ARGS_##nr \
: "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \
); \
__sys_res = (long)__res; \
} \
__sys_res; \
})
#define LOAD_ARGS_0()
#define LOAD_REGS_0
#define LOAD_ARGS_1(a1) \
register unsigned long __x26 = (unsigned long)(a1); \
LOAD_ARGS_0()
#define LOAD_REGS_1 \
register unsigned long __r26 __asm__("r26") = __x26; \
LOAD_REGS_0
#define LOAD_ARGS_2(a1,a2) \
register unsigned long __x25 = (unsigned long)(a2); \
LOAD_ARGS_1(a1)
#define LOAD_REGS_2 \
register unsigned long __r25 __asm__("r25") = __x25; \
LOAD_REGS_1
#define LOAD_ARGS_3(a1,a2,a3) \
register unsigned long __x24 = (unsigned long)(a3); \
LOAD_ARGS_2(a1,a2)
#define LOAD_REGS_3 \
register unsigned long __r24 __asm__("r24") = __x24; \
LOAD_REGS_2
#define LOAD_ARGS_4(a1,a2,a3,a4) \
register unsigned long __x23 = (unsigned long)(a4); \
LOAD_ARGS_3(a1,a2,a3)
#define LOAD_REGS_4 \
register unsigned long __r23 __asm__("r23") = __x23; \
LOAD_REGS_3
#define LOAD_ARGS_5(a1,a2,a3,a4,a5) \
register unsigned long __x22 = (unsigned long)(a5); \
LOAD_ARGS_4(a1,a2,a3,a4)
#define LOAD_REGS_5 \
register unsigned long __r22 __asm__("r22") = __x22; \
LOAD_REGS_4
#define LOAD_ARGS_6(a1,a2,a3,a4,a5,a6) \
register unsigned long __x21 = (unsigned long)(a6); \
LOAD_ARGS_5(a1,a2,a3,a4,a5)
#define LOAD_REGS_6 \
register unsigned long __r21 __asm__("r21") = __x21; \
LOAD_REGS_5
/* Even with zero args we use r20 for the syscall number */
#define ASM_ARGS_0
#define ASM_ARGS_1 ASM_ARGS_0, "r" (__r26)
#define ASM_ARGS_2 ASM_ARGS_1, "r" (__r25)
#define ASM_ARGS_3 ASM_ARGS_2, "r" (__r24)
#define ASM_ARGS_4 ASM_ARGS_3, "r" (__r23)
#define ASM_ARGS_5 ASM_ARGS_4, "r" (__r22)
#define ASM_ARGS_6 ASM_ARGS_5, "r" (__r21)
/* The registers not listed as inputs but clobbered */
#define CLOB_ARGS_6
#define CLOB_ARGS_5 CLOB_ARGS_6, "%r21"
#define CLOB_ARGS_4 CLOB_ARGS_5, "%r22"
#define CLOB_ARGS_3 CLOB_ARGS_4, "%r23"
#define CLOB_ARGS_2 CLOB_ARGS_3, "%r24"
#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"
#define VDSO_NAME "LINUX_6.11"
#define VDSO_HASH 182951793
#ifdef __LP64__
# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
#else
# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
#endif /* __LP64__ */
#endif /* __ASSEMBLER__ */
#endif /* _LINUX_HPPA_SYSDEP_H */

View File

@@ -1,13 +0,0 @@
/* Versions of the 'struct stat' data structure used in compatibility xstat
functions. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
#define _STAT_VER_SVR4 2
#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX
/* Versions of the 'xmknod' interface used in compatibility xmknod
functions. */
#define _MKNOD_VER_LINUX 1
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX

View File

@@ -1,66 +0,0 @@
/* Copyright (C) 2011-2024 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 <endian.h>
/* All supported kernel versions for MicroBlaze have these syscalls. */
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
#include_next <kernel-features.h>
/* Support for the pselect6, preadv and pwritev syscalls was added in
3.15. */
#if __LINUX_KERNEL_VERSION < 0x030f00
# undef __ASSUME_PSELECT
# undef __ASSUME_PREADV
# undef __ASSUME_PWRITEV
#endif
/* Support for the sendmmsg syscall was added in 3.3. */
#if __LINUX_KERNEL_VERSION < 0x030300
# undef __ASSUME_SENDMMSG_SYSCALL
#endif
/* Support for the renameat2 syscall was added in 3.17. */
#if __LINUX_KERNEL_VERSION < 0x031100
# undef __ASSUME_RENAMEAT2
#endif
/* Support for the execveat syscall was added in 4.0. */
#if __LINUX_KERNEL_VERSION < 0x040000
# undef __ASSUME_EXECVEAT
#endif
/* Support for the mlock2 syscall was added in 4.7. */
#if __LINUX_KERNEL_VERSION < 0x040700
# undef __ASSUME_MLOCK2
#endif
/* Support for statx was added in kernel 4.12. */
#if __LINUX_KERNEL_VERSION < 0X040C00
# undef __ASSUME_STATX
#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS3
#if __BYTE_ORDER == __BIG_ENDIAN
# define __ASSUME_SYSVIPC_BROKEN_MODE_T
#endif
#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64

View File

@@ -1,54 +0,0 @@
/* Definition of `struct stat' used in the kernel
Copyright (C) 2013-2024 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/>. */
struct kernel_stat
{
unsigned long st_dev; /* Device. */
unsigned long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
unsigned int st_nlink; /* Link count. */
unsigned int st_uid; /* User ID of the file's owner. */
unsigned int st_gid; /* Group ID of the file's group. */
unsigned long st_rdev; /* Device number, if device. */
unsigned long __pad2;
#define _HAVE_STAT___PAD2
#define _HAVE_STAT64___PAD2
long st_size; /* Size of file, in bytes. */
int st_blksize; /* Optimal block size for I/O. */
int __pad3;
#define _HAVE_STAT___PAD3
#define _HAVE_STAT64___PAD3
long st_blocks; /* Number 512-byte blocks allocated. */
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
#define _HAVE_STAT_NSEC
#define _HAVE_STAT64_NSEC
unsigned int __glibc_reserved4;
#define _HAVE_STAT___UNUSED4
#define _HAVE_STAT64___UNUSED4
unsigned int __glibc_reserved5;
#define _HAVE_STAT___UNUSED5
#define _HAVE_STAT64___UNUSED5
};
#define STAT_IS_KERNEL_STAT 0
#define STAT64_IS_KERNEL_STAT64 1
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@@ -1,312 +0,0 @@
/* Copyright (C) 2000-2024 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 _LINUX_MICROBLAZE_SYSDEP_H
#define _LINUX_MICROBLAZE_SYSDEP_H 1
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/microblaze/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
#include <tls.h>
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
# include <errno.h>
#endif
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
#ifdef __ASSEMBLER__
/* In microblaze ABI function call arguments are passed in registers
r5...r10. The return value is stored in r3 (or r3:r4 register pair).
Linux syscall uses the same convention with the addition that the
syscall number is passed in r12. To enter the kernel "brki r14,8"
instruction is used.
None of the abovementioned registers are presumed across function call
or syscall.
*/
/* 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 %d0 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. */
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
# undef SYSCALL_ERROR_LABEL
# ifdef PIC
# define SYSCALL_ERROR_LABEL 0f
# else
# define SYSCALL_ERROR_LABEL __syscall_error
# endif
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
addik r12,r0,-4095; \
cmpu r12,r12,r3; \
bgei r12,SYSCALL_ERROR_LABEL;
# undef PSEUDO_END
# define PSEUDO_END(name) \
SYSCALL_ERROR_HANDLER; \
END (name)
# undef PSEUDO_NOERRNO
# define PSEUDO_NOERRNO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args);
# undef PSEUDO_END_NOERRNO
# define PSEUDO_END_NOERRNO(name) \
END (name)
/* The function has to return the error code. */
# undef PSEUDO_ERRVAL
# define PSEUDO_ERRVAL(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
# undef PSEUDO_END_ERRVAL
# define PSEUDO_END_ERRVAL(name) \
END (name)
# define ret_NOERRNO \
rtsd r15,8; addk r0,r0,r0;
# define ret_ERRVAL \
rtsd r15,8; rsubk r3,r3,r0;
# ifdef PIC
# define SYSCALL_ERROR_LABEL_DCL 0
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
mfs r12,rpc; \
addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
lwi r12,r12,rtld_errno@GOT; \
rsubk r3,r3,r0; \
swi r3,r12,0; \
rtsd r15,8; \
addik r3,r0,-1;
# else /* !RTLD_PRIVATE_ERRNO. */
/* Store (-r3) into errno through the GOT. */
# if defined _LIBC_REENTRANT
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
addik r1,r1,-16; \
swi r15,r1,0; \
swi r20,r1,8; \
rsubk r3,r3,r0; \
swi r3,r1,12; \
mfs r20,rpc; \
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8; \
brlid r15,__errno_location@PLT; \
nop; \
lwi r4,r1,12; \
swi r4,r3,0; \
lwi r20,r1,8; \
lwi r15,r1,0; \
addik r1,r1,16; \
rtsd r15,8; \
addik r3,r0,-1;
# else /* !_LIBC_REENTRANT. */
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
mfs r12,rpc; \
addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
lwi r12,r12,errno@GOT; \
rsubk r3,r3,r0; \
swi r3,r12,0; \
rtsd r15,8; \
addik r3,r0,-1;
# endif /* _LIBC_REENTRANT. */
# endif /* RTLD_PRIVATE_ERRNO. */
# else
# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
# endif /* PIC. */
# define DO_CALL(syscall_name, args) \
addik r12,r0,SYS_ify (syscall_name); \
brki r14,8; \
addk r0,r0,r0;
#else /* not __ASSEMBLER__ */
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
gave back. */
# undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, nr, args...) \
inline_syscall##nr(SYS_ify(name), args)
# undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
inline_syscall##nr(name, args)
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
# define SYSCALL_CLOBBERS_3 "r8", SYSCALL_CLOBBERS_4
# define SYSCALL_CLOBBERS_2 "r7", SYSCALL_CLOBBERS_3
# define SYSCALL_CLOBBERS_1 "r6", SYSCALL_CLOBBERS_2
# define SYSCALL_CLOBBERS_0 "r5", SYSCALL_CLOBBERS_1
# define inline_syscall0(name,dummy) \
({ \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r12) \
: SYSCALL_CLOBBERS_0 ); __ret; \
})
# define inline_syscall1(name,arg1) \
({ \
long int __arg1 = (long int) (arg1); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r12) \
: SYSCALL_CLOBBERS_1 ); __ret; \
})
# define inline_syscall2(name,arg1,arg2) \
({ \
long int __arg1 = (long int) (arg1); \
long int __arg2 = (long int) (arg2); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
register long int __r6 __asm__("r6") = __arg2; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r12) \
: SYSCALL_CLOBBERS_2 ); __ret; \
})
# define inline_syscall3(name,arg1,arg2,arg3) \
({ \
long int __arg1 = (long int) (arg1); \
long int __arg2 = (long int) (arg2); \
long int __arg3 = (long int) (arg3); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
register long int __r6 __asm__("r6") = __arg2; \
register long int __r7 __asm__("r7") = __arg3; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \
: SYSCALL_CLOBBERS_3 ); __ret; \
})
# define inline_syscall4(name,arg1,arg2,arg3,arg4) \
({ \
long int __arg1 = (long int) (arg1); \
long int __arg2 = (long int) (arg2); \
long int __arg3 = (long int) (arg3); \
long int __arg4 = (long int) (arg4); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
register long int __r6 __asm__("r6") = __arg2; \
register long int __r7 __asm__("r7") = __arg3; \
register long int __r8 __asm__("r8") = __arg4; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \
: SYSCALL_CLOBBERS_4 ); __ret; \
})
# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
({ \
long int __arg1 = (long int) (arg1); \
long int __arg2 = (long int) (arg2); \
long int __arg3 = (long int) (arg3); \
long int __arg4 = (long int) (arg4); \
long int __arg5 = (long int) (arg5); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
register long int __r6 __asm__("r6") = __arg2; \
register long int __r7 __asm__("r7") = __arg3; \
register long int __r8 __asm__("r8") = __arg4; \
register long int __r9 __asm__("r9") = __arg5; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \
: SYSCALL_CLOBBERS_5 ); __ret; \
})
# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
long int __arg1 = (long int) (arg1); \
long int __arg2 = (long int) (arg2); \
long int __arg3 = (long int) (arg3); \
long int __arg4 = (long int) (arg4); \
long int __arg5 = (long int) (arg5); \
long int __arg6 = (long int) (arg6); \
register long int __ret __asm__("r3"); \
register long int __r12 __asm__("r12") = name; \
register long int __r5 __asm__("r5") = __arg1; \
register long int __r6 __asm__("r6") = __arg2; \
register long int __r7 __asm__("r7") = __arg3; \
register long int __r8 __asm__("r8") = __arg4; \
register long int __r9 __asm__("r9") = __arg5; \
register long int __r10 __asm__("r10") = __arg6; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \
"r"(__r12) \
: SYSCALL_CLOBBERS_6 ); __ret; \
})
#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
#endif /* not __ASSEMBLER__ */
#endif /* _LINUX_MICROBLAZE_SYSDEP_H */

View File

@@ -1,13 +0,0 @@
/* Versions of the 'struct stat' data structure used in compatibility xstat
functions. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
#define _STAT_VER_SVR4 2
#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
/* Versions of the 'xmknod' interface used in compatibility xmknod
functions. */
#define _MKNOD_VER_LINUX 1
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX

View File

@@ -1,21 +0,0 @@
/* Internal definitions for stat functions. Linux/nios2.
Copyright (C) 2021-2024 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 STAT_IS_KERNEL_STAT 1
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0

View File

@@ -1,223 +0,0 @@
/* Assembler macros for Nios II.
Copyright (C) 2000-2024 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 _LINUX_NIOS2_SYSDEP_H
#define _LINUX_NIOS2_SYSDEP_H 1
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/nios2/sysdep.h>
/* For RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
#ifdef __ASSEMBLER__
#undef SYSCALL_ERROR_LABEL
#define SYSCALL_ERROR_LABEL __local_syscall_error
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
ENTRY (name) \
DO_CALL (syscall_name, args) \
bne r7, zero, SYSCALL_ERROR_LABEL; \
#undef PSEUDO_END
#define PSEUDO_END(name) \
SYSCALL_ERROR_HANDLER \
END (name)
#undef PSEUDO_NOERRNO
#define PSEUDO_NOERRNO(name, syscall_name, args) \
ENTRY (name) \
DO_CALL (syscall_name, args)
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(name) \
END (name)
#undef ret_NOERRNO
#define ret_NOERRNO ret
#undef DO_CALL
#define DO_CALL(syscall_name, args) \
DOARGS_##args \
movi r2, SYS_ify(syscall_name); \
trap;
#if defined(__PIC__) || defined(PIC)
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL: \
nextpc r3; \
1: \
movhi r8, %hiadj(rtld_errno - 1b); \
addi r8, r8, %lo(rtld_errno - 1b); \
add r3, r3, r8; \
stw r2, 0(r3); \
movi r2, -1; \
ret;
# else
# if IS_IN (libc)
# define SYSCALL_ERROR_ERRNO __libc_errno
# else
# define SYSCALL_ERROR_ERRNO errno
# endif
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL: \
nextpc r3; \
1: \
movhi r8, %hiadj(_gp_got - 1b); \
addi r8, r8, %lo(_gp_got - 1b); \
add r3, r3, r8; \
ldw r3, %tls_ie(SYSCALL_ERROR_ERRNO)(r3); \
add r3, r23, r3; \
stw r2, 0(r3); \
movi r2, -1; \
ret;
# endif
#else
/* We can use a single error handler in the static library. */
#define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL: \
jmpi __syscall_error;
#endif
#define DOARGS_0 /* nothing */
#define DOARGS_1 /* nothing */
#define DOARGS_2 /* nothing */
#define DOARGS_3 /* nothing */
#define DOARGS_4 /* nothing */
#define DOARGS_5 ldw r8, 0(sp);
#define DOARGS_6 ldw r9, 4(sp); ldw r8, 0(sp);
/* The function has to return the error code. */
#undef PSEUDO_ERRVAL
#define PSEUDO_ERRVAL(name, syscall_name, args) \
ENTRY (name) \
DO_CALL (syscall_name, args)
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(name) \
END (name)
#define ret_ERRVAL ret
#else /* __ASSEMBLER__ */
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#include <errno.h>
#undef INTERNAL_SYSCALL_RAW
#define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ unsigned int _sys_result; \
{ \
/* Load argument values in temporary variables
to perform side effects like function calls
before the call-used registers are set. */ \
LOAD_ARGS_##nr (args) \
LOAD_REGS_##nr \
register int _r2 asm ("r2") = (int)(name); \
register int _err asm ("r7"); \
asm volatile ("trap" \
: "+r" (_r2), "=r" (_err) \
: ASM_ARGS_##nr \
: __SYSCALL_CLOBBERS); \
_sys_result = _err != 0 ? -_r2 : _r2; \
} \
(int) _sys_result; })
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
#undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW(number, nr, args)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
#define ASM_ARGS_0
#define LOAD_ARGS_1(a1) \
LOAD_ARGS_0 () \
int __arg1 = (int) (a1);
#define LOAD_REGS_1 \
register int _r4 asm ("r4") = __arg1; \
LOAD_REGS_0
#define ASM_ARGS_1 "r" (_r4)
#define LOAD_ARGS_2(a1, a2) \
LOAD_ARGS_1 (a1) \
int __arg2 = (int) (a2);
#define LOAD_REGS_2 \
register int _r5 asm ("r5") = __arg2; \
LOAD_REGS_1
#define ASM_ARGS_2 ASM_ARGS_1, "r" (_r5)
#define LOAD_ARGS_3(a1, a2, a3) \
LOAD_ARGS_2 (a1, a2) \
int __arg3 = (int) (a3);
#define LOAD_REGS_3 \
register int _r6 asm ("r6") = __arg3; \
LOAD_REGS_2
#define ASM_ARGS_3 ASM_ARGS_2, "r" (_r6)
#define LOAD_ARGS_4(a1, a2, a3, a4) \
LOAD_ARGS_3 (a1, a2, a3) \
int __arg4 = (int) (a4);
#define LOAD_REGS_4 \
register int _r7 asm ("r7") = __arg4; \
LOAD_REGS_3
#define ASM_ARGS_4 ASM_ARGS_3, "r" (_r7)
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
LOAD_ARGS_4 (a1, a2, a3, a4) \
int __arg5 = (int) (a5);
#define LOAD_REGS_5 \
register int _r8 asm ("r8") = __arg5; \
LOAD_REGS_4
#define ASM_ARGS_5 ASM_ARGS_4, "r" (_r8)
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
int __arg6 = (int) (a6);
#define LOAD_REGS_6 \
register int _r9 asm ("r9") = __arg6; \
LOAD_REGS_5
#define ASM_ARGS_6 ASM_ARGS_5, "r" (_r9)
#define __SYSCALL_CLOBBERS "memory"
#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
#endif /* __ASSEMBLER__ */
#endif /* linux/nios2/sysdep.h */

View File

@@ -1,180 +0,0 @@
/* Copyright (C) 2000-2024 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 _LINUX_S390_SYSDEP_H
#define _LINUX_S390_SYSDEP_H
#include <sysdeps/s390/s390-32/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/s390/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
/* in newer 2.1 kernels __NR_syscall is missing so we define it here */
#define __NR_syscall 0
#ifdef __ASSEMBLER__
/* 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 gpr2 is a real error
number. Linus said he will make sure that no syscall returns a value
in -1 .. -4095 as a valid result so we can safely test with -4095. */
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
lhi %r4,-4095 ; \
clr %r2,%r4 ; \
jnl SYSCALL_ERROR_LABEL
#undef PSEUDO_END
#define PSEUDO_END(name) \
SYSCALL_ERROR_HANDLER; \
END (name)
#undef PSEUDO_NOERRNO
#define PSEUDO_NOERRNO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args)
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(name) \
END (name)
#undef PSEUDO_ERRVAL
#define PSEUDO_ERRVAL(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
lcr %r2,%r2
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(name) \
END (name)
#undef SYSCALL_ERROR_LABEL
#ifndef PIC
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
1: l %r1,2f-1b(%r1); \
br %r1; \
2: .long syscall_error
#else
# if RTLD_PRIVATE_ERRNO
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
1: al %r1,2f-1b(%r1); \
lcr %r2,%r2; \
st %r2,0(%r1); \
lhi %r2,-1; \
br %r14; \
2: .long rtld_errno-1b
# elif defined _LIBC_REENTRANT
# if IS_IN (libc)
# define SYSCALL_ERROR_ERRNO __libc_errno
# else
# define SYSCALL_ERROR_ERRNO errno
# endif
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: lcr %r0,%r2; \
basr %r1,0; \
1: al %r1,2f-1b(%r1); \
l %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1); \
ear %r2,%a0; \
st %r0,0(%r1,%r2); \
lhi %r2,-1; \
br %r14; \
2: .long _GLOBAL_OFFSET_TABLE_-1b
# else
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
1: al %r1,2f-1b(%r1); \
l %r1,errno@GOT(%r1); \
lcr %r2,%r2; \
st %r2,0(%r1); \
lhi %r2,-1; \
br %r14; \
2: .long _GLOBAL_OFFSET_TABLE_-1b
# endif /* _LIBC_REENTRANT */
#endif /* PIC */
/* Linux takes system call arguments in registers:
syscall number 1 call-clobbered
arg 1 2 call-clobbered
arg 2 3 call-clobbered
arg 3 4 call-clobbered
arg 4 5 call-clobbered
arg 5 6 call-saved
arg 6 7 call-saved
(Of course a function with say 3 arguments does not have entries for
arguments 4 and 5.)
For system calls with 6 parameters a stack operation is required
to load the 6th parameter to register 7. Call saved register 7 is
moved to register 0 and back to avoid an additional stack frame.
*/
#define DO_CALL(syscall, args) \
.if args > 5; \
lr %r0,%r7; \
l %r7,96(%r15); \
.endif; \
lhi %r1,SYS_ify (syscall); \
svc 0; \
.if args > 5; \
lr %r7,%r0; \
.endif
#define ret \
br 14
#define ret_NOERRNO \
br 14
#define ret_ERRVAL \
br 14
#else
# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
#endif /* __ASSEMBLER__ */
#endif /* _LINUX_S390_SYSDEP_H */

View File

@@ -1,62 +0,0 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. SH version.
Copyright (C) 1999-2024 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 __KERNEL_FEATURES_SH__
# define __KERNEL_FEATURES_SH__
#include <endian.h>
/* These syscalls were added for SH in 2.6.37. */
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
#include_next <kernel-features.h>
/* SH4 ABI does not really require argument alignment for 64-bits, but
the kernel interface for p{read,write}64 adds a dummy long argument
before the offset. */
#define __ASSUME_PRW_DUMMY_ARG 1
/* sh only supports ipc syscall before 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
# define __ASSUME_SYSVIPC_BROKEN_MODE_T
#endif
/* Support for several syscalls was added in 4.8. */
#if __LINUX_KERNEL_VERSION < 0x040800
# undef __ASSUME_RENAMEAT2
# undef __ASSUME_EXECVEAT
# undef __ASSUME_MLOCK2
#endif
/* sh does not support the statx system call before 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_STATX
#endif
/* sh does not provide clone3. */
#undef __ASSUME_CLONE3
#define __ASSUME_CLONE3 0
#endif

View File

@@ -1,4 +0,0 @@
/* 4 instruction cycles not accessing cache and TLB are needed after
trapa instruction to avoid an SH-4 silicon bug. */
#define NEED_SYSCALL_INST_PAD
#include <sysdeps/unix/sysv/linux/sh/sysdep.h>

View File

@@ -1,318 +0,0 @@
/* Copyright (C) 1992-2024 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 _LINUX_SH_SYSDEP_H
#define _LINUX_SH_SYSDEP_H 1
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/sh/sysdep.h>
#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) (__NR_##syscall_name)
#ifdef __ASSEMBLER__
/* 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. */
#define _IMM1 #-1
#define _IMM12 #-12
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name); \
DO_CALL (syscall_name, args); \
mov r0,r1; \
mov _IMM12,r2; \
shad r2,r1; \
not r1,r1; \
tst r1,r1; \
bf .Lpseudo_end; \
SYSCALL_ERROR_HANDLER; \
.Lpseudo_end:
#undef PSEUDO_END
#define PSEUDO_END(name) \
END (name)
#undef PSEUDO_NOERRNO
#define PSEUDO_NOERRNO(name, syscall_name, args) \
.text; \
ENTRY (name); \
DO_CALL (syscall_name, args)
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(name) \
END (name)
#define ret_NOERRNO ret
#define PSEUDO_ERRVAL(name, syscall_name, args) \
.text; \
ENTRY (name); \
DO_CALL (syscall_name, args);
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(name) \
END (name)
#define ret_ERRVAL ret
#ifndef PIC
# define SYSCALL_ERROR_HANDLER \
mov.l 0f,r1; \
jmp @r1; \
mov r0,r4; \
.align 2; \
0: .long __syscall_error
#else
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
mov r12,r2; \
cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
mov.l 1f,r0; \
mov.l r1,@(r0,r12); \
mov r2,r12; \
cfi_restore (r12); \
bra .Lpseudo_end; \
mov _IMM1,r0; \
.align 2; \
0: .long _GLOBAL_OFFSET_TABLE_; \
1: .long rtld_errno@GOTOFF
# elif defined _LIBC_REENTRANT
# if IS_IN (libc)
# define SYSCALL_ERROR_ERRNO __libc_errno
# else
# define SYSCALL_ERROR_ERRNO errno
# endif
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
mov r12,r2; \
cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
mov.l 1f,r0; \
stc gbr, r4; \
mov.l @(r0,r12),r0; \
mov r2,r12; \
cfi_restore (r12); \
add r4,r0; \
mov.l r1,@r0; \
bra .Lpseudo_end; \
mov _IMM1,r0; \
.align 2; \
0: .long _GLOBAL_OFFSET_TABLE_; \
1: .long SYSCALL_ERROR_ERRNO@GOTTPOFF
# else
/* Store (-r0) into errno through the GOT. */
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
mov r12,r2; \
cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
mov.l 1f,r0; \
mov.l @(r0,r12),r0; \
mov r2,r12; \
cfi_restore (r12); \
mov.l r1,@r0; \
bra .Lpseudo_end; \
mov _IMM1,r0; \
.align 2; \
0: .long _GLOBAL_OFFSET_TABLE_; \
1: .long errno@GOT
# endif /* _LIBC_REENTRANT */
#endif /* PIC */
# ifdef NEED_SYSCALL_INST_PAD
# define SYSCALL_INST_PAD \
or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0
# else
# define SYSCALL_INST_PAD
# endif
#define SYSCALL_INST0 trapa #0x10
#define SYSCALL_INST1 trapa #0x11
#define SYSCALL_INST2 trapa #0x12
#define SYSCALL_INST3 trapa #0x13
#define SYSCALL_INST4 trapa #0x14
#define SYSCALL_INST5 mov.l @(0,r15),r0; trapa #0x15
#define SYSCALL_INST6 mov.l @(0,r15),r0; mov.l @(4,r15),r1; trapa #0x16
#undef DO_CALL
#define DO_CALL(syscall_name, args) \
mov.l 1f,r3; \
SYSCALL_INST##args; \
SYSCALL_INST_PAD; \
bra 2f; \
nop; \
.align 2; \
1: .long SYS_ify (syscall_name); \
2:
#else /* not __ASSEMBLER__ */
#define SYSCALL_INST_STR0 "trapa #0x10\n\t"
#define SYSCALL_INST_STR1 "trapa #0x11\n\t"
#define SYSCALL_INST_STR2 "trapa #0x12\n\t"
#define SYSCALL_INST_STR3 "trapa #0x13\n\t"
#define SYSCALL_INST_STR4 "trapa #0x14\n\t"
#define SYSCALL_INST_STR5 "trapa #0x15\n\t"
#define SYSCALL_INST_STR6 "trapa #0x16\n\t"
# ifdef NEED_SYSCALL_INST_PAD
# define SYSCALL_INST_PAD "\
or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0"
# else
# define SYSCALL_INST_PAD
# endif
#define ASMFMT_0
#define ASMFMT_1 \
, "r" (r4)
#define ASMFMT_2 \
, "r" (r4), "r" (r5)
#define ASMFMT_3 \
, "r" (r4), "r" (r5), "r" (r6)
#define ASMFMT_4 \
, "r" (r4), "r" (r5), "r" (r6), "r" (r7)
#define ASMFMT_5 \
, "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0)
#define ASMFMT_6 \
, "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1)
#define ASMFMT_7 \
, "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1), "r" (r2)
#define SUBSTITUTE_ARGS_0()
#define SUBSTITUTE_ARGS_1(arg1) \
long int _arg1 = (long int) (arg1); \
register long int r4 asm ("%r4") = (long int) (_arg1)
#define SUBSTITUTE_ARGS_2(arg1, arg2) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
register long int r4 asm ("%r4") = (long int) (_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2)
#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
long int _arg3 = (long int) (arg3); \
register long int r4 asm ("%r4") = (long int) (_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2); \
register long int r6 asm ("%r6") = (long int) (_arg3)
#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
long int _arg3 = (long int) (arg3); \
long int _arg4 = (long int) (arg4); \
register long int r4 asm ("%r4") = (long int) (_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2); \
register long int r6 asm ("%r6") = (long int) (_arg3); \
register long int r7 asm ("%r7") = (long int) (_arg4)
#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
long int _arg3 = (long int) (arg3); \
long int _arg4 = (long int) (arg4); \
long int _arg5 = (long int) (arg5); \
register long int r4 asm ("%r4") = (long int) (_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2); \
register long int r6 asm ("%r6") = (long int) (_arg3); \
register long int r7 asm ("%r7") = (long int) (_arg4); \
register long int r0 asm ("%r0") = (long int) (_arg5)
#define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
long int _arg3 = (long int) (arg3); \
long int _arg4 = (long int) (arg4); \
long int _arg5 = (long int) (arg5); \
long int _arg6 = (long int) (arg6); \
register long int r4 asm ("%r4") = (long int)(_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2); \
register long int r6 asm ("%r6") = (long int) (_arg3); \
register long int r7 asm ("%r7") = (long int) (_arg4); \
register long int r0 asm ("%r0") = (long int) (_arg5); \
register long int r1 asm ("%r1") = (long int) (_arg6)
#define SUBSTITUTE_ARGS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \
long int _arg3 = (long int) (arg3); \
long int _arg4 = (long int) (arg4); \
long int _arg5 = (long int) (arg5); \
long int _arg6 = (long int) (arg6); \
long int _arg7 = (long int) (arg7); \
register long int r4 asm ("%r4") = (long int) (_arg1); \
register long int r5 asm ("%r5") = (long int) (_arg2); \
register long int r6 asm ("%r6") = (long int) (_arg3); \
register long int r7 asm ("%r7") = (long int) (_arg4); \
register long int r0 asm ("%r0") = (long int) (_arg5); \
register long int r1 asm ("%r1") = (long int) (_arg6); \
register long int r2 asm ("%r2") = (long int) (_arg7)
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \
({ \
unsigned long int resultvar; \
register long int r3 asm ("%r3") = SYS_ify (name); \
SUBSTITUTE_ARGS_##nr(args); \
\
asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
: "=z" (resultvar) \
: "r" (r3) ASMFMT_##nr \
: "memory", "t"); \
\
(int) resultvar; })
/* The _NCS variant allows non-constant syscall numbers. */
#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \
unsigned long int resultvar; \
register long int r3 asm ("%r3") = (name); \
SUBSTITUTE_ARGS_##nr(args); \
\
asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
: "=z" (resultvar) \
: "r" (r3) ASMFMT_##nr \
: "memory", "t"); \
\
(int) resultvar; })
#endif /* __ASSEMBLER__ */
#endif /* linux/sh/sysdep.h */

View File

@@ -1,13 +0,0 @@
/* Versions of the 'struct stat' data structure used in compatibility xstat
functions. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
#define _STAT_VER_SVR4 2
#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX
/* Versions of the 'xmknod' interface used in compatibility xmknod
functions. */
#define _MKNOD_VER_LINUX 1
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX

View File

@@ -1,3 +0,0 @@
#if !__SH_FPU_ANY__ && !__SH4__
#include "../fenv.c"
#endif

View File

@@ -1,81 +0,0 @@
#if __SH_FPU_ANY__ || __SH4__
.global fegetround
.type fegetround, @function
fegetround:
sts fpscr, r0
rts
and #3, r0
.global __fesetround
.hidden __fesetround
.type __fesetround, @function
__fesetround:
sts fpscr, r0
mov #-4, r1
and r1, r0
or r4, r0
lds r0, fpscr
rts
mov #0, r0
.global fetestexcept
.type fetestexcept, @function
fetestexcept:
sts fpscr, r0
and r4, r0
rts
and #0x7c, r0
.global feclearexcept
.type feclearexcept, @function
feclearexcept:
mov r4, r0
and #0x7c, r0
not r0, r4
sts fpscr, r0
and r4, r0
lds r0, fpscr
rts
mov #0, r0
.global feraiseexcept
.type feraiseexcept, @function
feraiseexcept:
mov r4, r0
and #0x7c, r0
sts fpscr, r4
or r4, r0
lds r0, fpscr
rts
mov #0, r0
.global fegetenv
.type fegetenv, @function
fegetenv:
sts fpscr, r0
mov.l r0, @r4
rts
mov #0, r0
.global fesetenv
.type fesetenv, @function
fesetenv:
mov r4, r0
cmp/eq #-1, r0
bf 1f
! the default environment is complicated by the fact that we need to
! preserve the current precision bit, which we do not know a priori
sts fpscr, r0
mov #8, r1
swap.w r1, r1
bra 2f
and r1, r0
1: mov.l @r4, r0 ! non-default environment
2: lds r0, fpscr
rts
mov #0, r0
#endif

View File

@@ -1,6 +0,0 @@
#include <features.h>
hidden int __shcall(void *arg, int (*func)(void *))
{
return func(arg);
}

View File

@@ -1,6 +0,0 @@
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
brid __dlsym
add r7, r15, r0

View File

@@ -1,3 +0,0 @@
#define __dlsym __dlsym_redir_time64
#define dlsym __dlsym_time64
#include "dlsym.s"

View File

@@ -1,6 +0,0 @@
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
l.j __dlsym
l.ori r5, r9, 0

View File

@@ -1,3 +0,0 @@
#define __dlsym __dlsym_redir_time64
#define dlsym __dlsym_time64
#include "dlsym.s"

View File

@@ -1,11 +0,0 @@
.text
.global dlsym
.hidden __dlsym
.type dlsym, @function
dlsym:
mov.l L1, r0
1: braf r0
sts pr, r6
.align 2
L1: .long __dlsym@PLT-(1b+4-.)

View File

@@ -1,3 +0,0 @@
#define __dlsym __dlsym_redir_time64
#define dlsym __dlsym_time64
#include "dlsym.s"

View File

@@ -1,20 +0,0 @@
.global vfork
.type vfork,@function
vfork:
mov #95, r3
add r3, r3
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
mov r0, r4
mov.l 1f, r0
2: braf r0
nop
.align 2
.hidden __syscall_ret
1: .long __syscall_ret@PLT-(2b+4-.)

View File

@@ -1,29 +0,0 @@
.global _longjmp
.global longjmp
.type _longjmp,@function
.type longjmp,@function
_longjmp:
longjmp:
addi r3, r6, 0
bnei r3, 1f
addi r3, r3, 1
1: lwi r1, r5, 0
lwi r15, r5, 4
lwi r2, r5, 8
lwi r13, r5, 12
lwi r18, r5, 16
lwi r19, r5, 20
lwi r20, r5, 24
lwi r21, r5, 28
lwi r22, r5, 32
lwi r23, r5, 36
lwi r24, r5, 40
lwi r25, r5, 44
lwi r26, r5, 48
lwi r27, r5, 52
lwi r28, r5, 56
lwi r29, r5, 60
lwi r30, r5, 64
lwi r31, r5, 68
rtsd r15, 8
nop

View File

@@ -1,32 +0,0 @@
.global ___setjmp
.hidden ___setjmp
.global __setjmp
.global _setjmp
.global setjmp
.type __setjmp,@function
.type _setjmp,@function
.type setjmp,@function
___setjmp:
__setjmp:
_setjmp:
setjmp:
swi r1, r5, 0
swi r15, r5, 4
swi r2, r5, 8
swi r13, r5, 12
swi r18, r5, 16
swi r19, r5, 20
swi r20, r5, 24
swi r21, r5, 28
swi r22, r5, 32
swi r23, r5, 36
swi r24, r5, 40
swi r25, r5, 44
swi r26, r5, 48
swi r27, r5, 52
swi r28, r5, 56
swi r29, r5, 60
swi r30, r5, 64
swi r31, r5, 68
rtsd r15, 8
ori r3, r0, 0

View File

@@ -1,25 +0,0 @@
.global _longjmp
.global longjmp
.type _longjmp,@function
.type longjmp,@function
_longjmp:
longjmp:
l.sfeqi r4, 0
l.bnf 1f
l.addi r11, r4,0
l.ori r11, r0, 1
1: l.lwz r1, 0(r3)
l.lwz r2, 4(r3)
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

View File

@@ -1,27 +0,0 @@
.global ___setjmp
.hidden ___setjmp
.global __setjmp
.global _setjmp
.global setjmp
.type __setjmp,@function
.type _setjmp,@function
.type setjmp,@function
___setjmp:
__setjmp:
_setjmp:
setjmp:
l.sw 0(r3), r1
l.sw 4(r3), r2
l.sw 8(r3), r9
l.sw 12(r3), r10
l.sw 16(r3), r14
l.sw 20(r3), r16
l.sw 24(r3), r18
l.sw 28(r3), r20
l.sw 32(r3), r22
l.sw 36(r3), r24
l.sw 40(r3), r26
l.sw 44(r3), r28
l.sw 48(r3), r30
l.jr r9
l.ori r11,r0,0

View File

@@ -1,28 +0,0 @@
.global _longjmp
.global longjmp
.type _longjmp, @function
.type longjmp, @function
_longjmp:
longjmp:
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
lds.l @r4+, pr
#if __SH_FPU_ANY__ || __SH4__
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
#endif
tst r5, r5
movt r0
add r5, r0
rts
nop

View File

@@ -1,32 +0,0 @@
.global ___setjmp
.hidden ___setjmp
.global __setjmp
.global _setjmp
.global setjmp
.type __setjmp, @function
.type _setjmp, @function
.type setjmp, @function
___setjmp:
__setjmp:
_setjmp:
setjmp:
#if __SH_FPU_ANY__ || __SH4__
add #52, r4
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
#else
add #36, r4
#endif
sts.l pr, @-r4
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
rts
mov #0, r0

View File

@@ -1,13 +0,0 @@
.global __restore
.hidden __restore
.type __restore,@function
__restore:
ori r12, r0, 119
brki r14, 0x8
.global __restore_rt
.hidden __restore_rt
.type __restore_rt,@function
__restore_rt:
ori r12, r0, 173
brki r14, 0x8

View File

@@ -1,22 +0,0 @@
.global sigsetjmp
.global __sigsetjmp
.type sigsetjmp,@function
.type __sigsetjmp,@function
sigsetjmp:
__sigsetjmp:
.hidden ___setjmp
beqi r6, ___setjmp
swi r15,r5,72
swi r19,r5,72+4+8
brlid r15,___setjmp
ori r19,r5,0
ori r6,r3,0
ori r5,r19,0
lwi r15,r5,72
lwi r19,r5,72+4+8
.hidden __sigsetjmp_tail
bri __sigsetjmp_tail

View File

@@ -1,24 +0,0 @@
.global sigsetjmp
.global __sigsetjmp
.type sigsetjmp,@function
.type __sigsetjmp,@function
sigsetjmp:
__sigsetjmp:
l.sfeq r4, r0
.hidden ___setjmp
l.bf ___setjmp
l.sw 52(r3), r9
l.sw 52+4+8(r3), r20
l.jal ___setjmp
l.ori r20, r3, 0
l.ori r4, r11, 0
l.ori r3, r20, 0
l.lwz r9, 52(r3)
.hidden __sigsetjmp_tail
l.j __sigsetjmp_tail
l.lwz r20, 52+4+8(r3)

View File

@@ -1,24 +0,0 @@
.global __restore
.hidden __restore
__restore:
mov #119, r3 !__NR_sigreturn
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
.global __restore_rt
.hidden __restore_rt
__restore_rt:
mov #100, r3 !__NR_rt_sigreturn
add #73, r3
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0

View File

@@ -1,41 +0,0 @@
.global sigsetjmp
.global __sigsetjmp
.type sigsetjmp,@function
.type __sigsetjmp,@function
sigsetjmp:
__sigsetjmp:
tst r5, r5
bt 9f
mov r4, r6
add #60, r6
sts pr, r0
mov.l r0, @r6
mov.l r8, @(4+8,r6)
mov.l 1f, r0
2: bsrf r0
mov r4, r8
mov r0, r5
mov r8, r4
mov r4, r6
add #60, r6
mov.l @r6, r0
lds r0, pr
mov.l 3f, r0
4: braf r0
mov.l @(4+8,r6), r8
9: mov.l 5f, r0
6: braf r0
nop
.align 2
.hidden ___setjmp
1: .long ___setjmp@PLT-(2b+4-.)
.hidden __sigsetjmp_tail
3: .long __sigsetjmp_tail@PLT-(4b+4-.)
5: .long ___setjmp@PLT-(6b+4-.)

View File

@@ -1,7 +0,0 @@
.global __set_thread_area
.hidden __set_thread_area
.type __set_thread_area,@function
__set_thread_area:
ori r21, r5, 0
rtsd r15, 8
ori r3, r0, 0

View File

@@ -1,8 +0,0 @@
.global __unmapself
.type __unmapself,@function
__unmapself:
ori r12, r0, 91
brki r14, 0x8
ori r12, r0, 1
brki r14, 0x8
nop

View File

@@ -1,31 +0,0 @@
.global __clone
.hidden __clone
.type __clone,@function
# r5, r6, r7, r8, r9, r10, stack
# fn, st, fl, ar, pt, tl, ct
# fl, st, __, pt, ct, tl
__clone:
andi r6, r6, -16
addi r6, r6, -16
swi r5, r6, 0
swi r8, r6, 4
ori r5, r7, 0
ori r8, r9, 0
lwi r9, r1, 28
ori r12, r0, 120
brki r14, 8
beqi r3, 1f
rtsd r15, 8
nop
1: add r19, r0, r0
lwi r3, r1, 0
lwi r5, r1, 4
brald r15, r3
nop
ori r12, r0, 1
brki r14, 8

View File

@@ -1,27 +0,0 @@
.global __cp_begin
.hidden __cp_begin
.global __cp_end
.hidden __cp_end
.global __cp_cancel
.hidden __cp_cancel
.hidden __cancel
.global __syscall_cp_asm
.hidden __syscall_cp_asm
.type __syscall_cp_asm,@function
__syscall_cp_asm:
__cp_begin:
lwi r5, r5, 0
bnei r5, __cp_cancel
addi r12, r6, 0
add r5, r7, r0
add r6, r8, r0
add r7, r9, r0
add r8, r10, r0
lwi r9, r1, 28
lwi r10, r1, 32
brki r14, 0x8
__cp_end:
rtsd r15, 8
nop
__cp_cancel:
bri __cancel

View File

@@ -1,7 +0,0 @@
.global __set_thread_area
.hidden __set_thread_area
.type __set_thread_area,@function
__set_thread_area:
l.ori r10, r3, 0
l.jr r9
l.ori r11, r0, 0

View File

@@ -1,8 +0,0 @@
.global __unmapself
.type __unmapself,@function
__unmapself:
l.ori r11, r0, 215 /* __NR_munmap */
l.sys 1
l.ori r3, r0, 0
l.ori r11, r0, 93 /* __NR_exit */
l.sys 1

View File

@@ -1,32 +0,0 @@
/* int clone(fn, stack, flags, arg, ptid, tls, ctid)
* r3 r4 r5 r6 sp+0 sp+4 sp+8
* sys_clone(flags, stack, ptid, ctid, tls)
*/
.global __clone
.hidden __clone
.type __clone,@function
__clone:
l.addi r4, r4, -8
l.sw 0(r4), r3
l.sw 4(r4), r6
/* (fn, st, fl, ar, pt, tl, ct) => (fl, st, pt, ct, tl) */
l.ori r3, r5, 0
l.lwz r5, 0(r1)
l.lwz r6, 8(r1)
l.lwz r7, 4(r1)
l.ori r11, r0, 220 /* __NR_clone */
l.sys 1
l.sfeqi r11, 0
l.bf 1f
l.nop
l.jr r9
l.nop
1: l.ori r2, r0, 0
l.lwz r11, 0(r1)
l.jalr r11
l.lwz r3, 4(r1)
l.ori r11, r0, 93 /* __NR_exit */
l.sys 1

View File

@@ -1,29 +0,0 @@
.global __cp_begin
.hidden __cp_begin
.global __cp_end
.hidden __cp_end
.global __cp_cancel
.hidden __cp_cancel
.hidden __cancel
.global __syscall_cp_asm
.hidden __syscall_cp_asm
.type __syscall_cp_asm,@function
__syscall_cp_asm:
__cp_begin:
l.lwz r3, 0(r3)
l.sfeqi r3, 0
l.bnf __cp_cancel
l.ori r11, r4, 0
l.ori r3, r5, 0
l.ori r4, r6, 0
l.ori r5, r7, 0
l.ori r6, r8, 0
l.lwz r7, 0(r1)
l.lwz r8, 4(r1)
l.sys 1
__cp_end:
l.jr r9
l.nop
__cp_cancel:
l.j __cancel
l.nop

View File

@@ -1,37 +0,0 @@
#include "pthread_impl.h"
#include "libc.h"
#include <elf.h>
/* Also perform sh-specific init */
#define CPU_HAS_LLSC 0x0040
#define CPU_HAS_CAS_L 0x0400
extern hidden const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[];
hidden const void *__sh_cas_ptr;
hidden unsigned __sh_nommu;
int __set_thread_area(void *p)
{
size_t *aux;
__asm__ __volatile__ ( "ldc %0, gbr" : : "r"(p) : "memory" );
#ifndef __SH4A__
__sh_cas_ptr = __sh_cas_gusa;
#if !defined(__SH3__) && !defined(__SH4__)
for (aux=libc.auxv; *aux; aux+=2) {
if (*aux != AT_PLATFORM) continue;
const char *s = (void *)aux[1];
if (s[0]!='s' || s[1]!='h' || s[2]!='2' || s[3]-'0'<10u) break;
__sh_cas_ptr = __sh_cas_imask;
__sh_nommu = 1;
}
#endif
if (__hwcap & CPU_HAS_CAS_L)
__sh_cas_ptr = __sh_cas_cas_l;
else if (__hwcap & CPU_HAS_LLSC)
__sh_cas_ptr = __sh_cas_llsc;
#endif
return 0;
}

View File

@@ -1,24 +0,0 @@
#include "pthread_impl.h"
hidden void __unmapself_sh_mmu(void *, size_t);
hidden void __unmapself_sh_nommu(void *, size_t);
#if !defined(__SH3__) && !defined(__SH4__)
#define __unmapself __unmapself_sh_nommu
#include "dynlink.h"
#undef CRTJMP
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"mov.l @%0+,r0 ; mov.l @%0,r12 ; jmp @r0 ; mov %1,r15" \
: : "r"(pc), "r"(sp) : "r0", "memory" )
#include "../__unmapself.c"
#undef __unmapself
extern hidden unsigned __sh_nommu;
#else
#define __sh_nommu 0
#endif
void __unmapself(void *base, size_t size)
{
if (__sh_nommu) __unmapself_sh_nommu(base, size);
else __unmapself_sh_mmu(base, size);
}

View File

@@ -1,23 +0,0 @@
.text
.global __unmapself_sh_mmu
.hidden __unmapself_sh_mmu
.type __unmapself_sh_mmu, @function
__unmapself_sh_mmu:
mov #91, r3 ! SYS_munmap
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
mov #1, r3 ! SYS_exit
mov #0, r4
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0

View File

@@ -1,65 +0,0 @@
/* Contract for all versions is same as cas.l r2,r3,@r0
* pr and r1 are also clobbered (by jsr & r1 as temp).
* r0,r2,r4-r15 must be preserved.
* r3 contains result (==r2 iff cas succeeded). */
.align 2
.global __sh_cas_gusa
.hidden __sh_cas_gusa
__sh_cas_gusa:
mov.l r5,@-r15
mov.l r4,@-r15
mov r0,r4
mova 1f,r0
mov r15,r1
mov #(0f-1f),r15
0: mov.l @r4,r5
cmp/eq r5,r2
bf 1f
mov.l r3,@r4
1: mov r1,r15
mov r5,r3
mov r4,r0
mov.l @r15+,r4
rts
mov.l @r15+,r5
.global __sh_cas_llsc
.hidden __sh_cas_llsc
__sh_cas_llsc:
mov r0,r1
.word 0x00ab /* synco */
0: .word 0x0163 /* movli.l @r1,r0 */
cmp/eq r0,r2
bf 1f
mov r3,r0
.word 0x0173 /* movco.l r0,@r1 */
bf 0b
mov r2,r0
1: .word 0x00ab /* synco */
mov r0,r3
rts
mov r1,r0
.global __sh_cas_imask
.hidden __sh_cas_imask
__sh_cas_imask:
mov r0,r1
stc sr,r0
mov.l r0,@-r15
or #0xf0,r0
ldc r0,sr
mov.l @r1,r0
cmp/eq r0,r2
bf 1f
mov.l r3,@r1
1: ldc.l @r15+,sr
mov r0,r3
rts
mov r1,r0
.global __sh_cas_cas_l
.hidden __sh_cas_cas_l
__sh_cas_cas_l:
rts
.word 0x2323 /* cas.l r2,r3,@r0 */

View File

@@ -1,54 +0,0 @@
.text
.global __clone
.hidden __clone
.type __clone, @function
__clone:
! incoming: fn stack flags arg ptid tls ctid
! r4 r5 r6 r7 @r15 @(4,r15) @(8,r15)
mov #-16, r0
and r0, r5
mov r4, r1 ! r1 = fn
mov r7, r2 ! r2 = arg
mov #120, r3 ! r3 = __NR_clone
mov r6, r4 ! r4 = flags
!mov r5, r5 ! r5 = stack
mov.l @r15, r6 ! r6 = ptid
mov.l @(8,r15), r7 ! r7 = ctid
mov.l @(4,r15), r0 ! r0 = tls
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
cmp/eq #0, r0
bt 1f
! we are the parent, return
rts
nop
1: ! we are the child, call fn(arg)
mov.l 1f, r0
mov r1, r5
bsrf r0
mov r2, r4
2: mov #1, r3 ! __NR_exit
mov r0, r4
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
.align 2
.hidden __shcall
1: .long __shcall@PCREL+(.-2b)

View File

@@ -1,45 +0,0 @@
.text
.global __cp_begin
.hidden __cp_begin
.global __cp_end
.hidden __cp_end
.global __cp_cancel
.hidden __cp_cancel
.hidden __cancel
.global __syscall_cp_asm
.hidden __syscall_cp_asm
.type __syscall_cp_asm, @function
__syscall_cp_asm:
__cp_begin:
mov.l @r4, r4
tst r4, r4
bf __cp_cancel
mov r5, r3
mov r6, r4
mov r7, r5
mov.l @r15, r6
mov.l @(4,r15), r7
mov.l @(8,r15), r0
mov.l @(12,r15), r1
trapa #31
__cp_end:
! work around hardware bug
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
rts
nop
__cp_cancel:
mov.l 2f, r0
braf r0
nop
1:
.align 2
2: .long __cancel@PCREL-(1b-.)

View File

@@ -1,27 +0,0 @@
.global pipe
.type pipe, @function
pipe:
mov #42, r3
trapa #31
! work around hardware bug
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
cmp/pz r0
bt 1f
mov.l L1, r1
braf r1
mov r0, r4
1: mov.l r0, @(0,r4)
mov.l r1, @(4,r4)
rts
mov #0, r0
.align 2
L1: .long __syscall_ret@PLT-(1b-.)

View File

@@ -685,8 +685,6 @@ const src_files = [_][]const u8{
"musl/src/fenv/riscv64/fenv.S",
"musl/src/fenv/riscv64/fenv-sf.c",
"musl/src/fenv/s390x/fenv.c",
"musl/src/fenv/sh/fenv-nofpu.c",
"musl/src/fenv/sh/fenv.S",
"musl/src/fenv/x32/fenv.s",
"musl/src/fenv/x86_64/fenv.s",
"musl/src/internal/defsysinfo.c",
@@ -697,7 +695,6 @@ const src_files = [_][]const u8{
"musl/src/internal/libc.c",
"musl/src/internal/procfdname.c",
"musl/src/internal/shgetc.c",
"musl/src/internal/sh/__shcall.c",
"musl/src/internal/syscall_ret.c",
"musl/src/internal/vdso.c",
"musl/src/internal/version.c",
@@ -734,15 +731,11 @@ const src_files = [_][]const u8{
"musl/src/ldso/loongarch64/dlsym.s",
"musl/src/ldso/m68k/dlsym.s",
"musl/src/ldso/m68k/dlsym_time64.S",
"musl/src/ldso/microblaze/dlsym.s",
"musl/src/ldso/microblaze/dlsym_time64.S",
"musl/src/ldso/mips64/dlsym.s",
"musl/src/ldso/mips/dlsym.s",
"musl/src/ldso/mips/dlsym_time64.S",
"musl/src/ldso/mipsn32/dlsym.s",
"musl/src/ldso/mipsn32/dlsym_time64.S",
"musl/src/ldso/or1k/dlsym.s",
"musl/src/ldso/or1k/dlsym_time64.S",
"musl/src/ldso/powerpc64/dlsym.s",
"musl/src/ldso/powerpc/dlsym.s",
"musl/src/ldso/powerpc/dlsym_time64.S",
@@ -750,8 +743,6 @@ const src_files = [_][]const u8{
"musl/src/ldso/riscv64/dlsym.s",
"musl/src/ldso/riscv64/tlsdesc.s",
"musl/src/ldso/s390x/dlsym.s",
"musl/src/ldso/sh/dlsym.s",
"musl/src/ldso/sh/dlsym_time64.S",
"musl/src/ldso/tlsdesc.c",
"musl/src/ldso/x32/dlsym.s",
"musl/src/ldso/x86_64/dlsym.s",
@@ -1596,7 +1587,6 @@ const src_files = [_][]const u8{
"musl/src/process/posix_spawnp.c",
"musl/src/process/riscv64/vfork.s",
"musl/src/process/s390x/vfork.s",
"musl/src/process/sh/vfork.s",
"musl/src/process/system.c",
"musl/src/process/vfork.c",
"musl/src/process/wait.c",
@@ -1643,16 +1633,12 @@ const src_files = [_][]const u8{
"musl/src/setjmp/loongarch64/setjmp.S",
"musl/src/setjmp/m68k/longjmp.s",
"musl/src/setjmp/m68k/setjmp.s",
"musl/src/setjmp/microblaze/longjmp.s",
"musl/src/setjmp/microblaze/setjmp.s",
"musl/src/setjmp/mips64/longjmp.S",
"musl/src/setjmp/mips64/setjmp.S",
"musl/src/setjmp/mips/longjmp.S",
"musl/src/setjmp/mipsn32/longjmp.S",
"musl/src/setjmp/mipsn32/setjmp.S",
"musl/src/setjmp/mips/setjmp.S",
"musl/src/setjmp/or1k/longjmp.s",
"musl/src/setjmp/or1k/setjmp.s",
"musl/src/setjmp/powerpc64/longjmp.s",
"musl/src/setjmp/powerpc64/setjmp.s",
"musl/src/setjmp/powerpc/longjmp.S",
@@ -1664,8 +1650,6 @@ const src_files = [_][]const u8{
"musl/src/setjmp/s390x/longjmp.s",
"musl/src/setjmp/s390x/setjmp.s",
"musl/src/setjmp/setjmp.c",
"musl/src/setjmp/sh/longjmp.S",
"musl/src/setjmp/sh/setjmp.S",
"musl/src/setjmp/x32/longjmp.s",
"musl/src/setjmp/x32/setjmp.s",
"musl/src/setjmp/x86_64/longjmp.s",
@@ -1683,12 +1667,9 @@ const src_files = [_][]const u8{
"musl/src/signal/loongarch64/restore.s",
"musl/src/signal/loongarch64/sigsetjmp.s",
"musl/src/signal/m68k/sigsetjmp.s",
"musl/src/signal/microblaze/restore.s",
"musl/src/signal/microblaze/sigsetjmp.s",
"musl/src/signal/mips64/sigsetjmp.s",
"musl/src/signal/mipsn32/sigsetjmp.s",
"musl/src/signal/mips/sigsetjmp.s",
"musl/src/signal/or1k/sigsetjmp.s",
"musl/src/signal/powerpc64/restore.s",
"musl/src/signal/powerpc64/sigsetjmp.s",
"musl/src/signal/powerpc/restore.s",
@@ -1704,8 +1685,6 @@ const src_files = [_][]const u8{
"musl/src/signal/s390x/restore.s",
"musl/src/signal/s390x/sigsetjmp.s",
"musl/src/signal/setitimer.c",
"musl/src/signal/sh/restore.s",
"musl/src/signal/sh/sigsetjmp.s",
"musl/src/signal/sigaction.c",
"musl/src/signal/sigaddset.c",
"musl/src/signal/sigaltstack.c",
@@ -2027,10 +2006,6 @@ const src_files = [_][]const u8{
"musl/src/thread/m68k/clone.s",
"musl/src/thread/m68k/__m68k_read_tp.s",
"musl/src/thread/m68k/syscall_cp.s",
"musl/src/thread/microblaze/clone.s",
"musl/src/thread/microblaze/__set_thread_area.s",
"musl/src/thread/microblaze/syscall_cp.s",
"musl/src/thread/microblaze/__unmapself.s",
"musl/src/thread/mips64/clone.s",
"musl/src/thread/mips64/syscall_cp.s",
"musl/src/thread/mips64/__unmapself.s",
@@ -2046,10 +2021,6 @@ const src_files = [_][]const u8{
"musl/src/thread/mtx_timedlock.c",
"musl/src/thread/mtx_trylock.c",
"musl/src/thread/mtx_unlock.c",
"musl/src/thread/or1k/clone.s",
"musl/src/thread/or1k/__set_thread_area.s",
"musl/src/thread/or1k/syscall_cp.s",
"musl/src/thread/or1k/__unmapself.s",
"musl/src/thread/powerpc64/clone.s",
"musl/src/thread/powerpc64/__set_thread_area.s",
"musl/src/thread/powerpc64/syscall_cp.s",
@@ -2167,12 +2138,6 @@ const src_files = [_][]const u8{
"musl/src/thread/sem_unlink.c",
"musl/src/thread/sem_wait.c",
"musl/src/thread/__set_thread_area.c",
"musl/src/thread/sh/atomics.s",
"musl/src/thread/sh/clone.s",
"musl/src/thread/sh/__set_thread_area.c",
"musl/src/thread/sh/syscall_cp.s",
"musl/src/thread/sh/__unmapself.c",
"musl/src/thread/sh/__unmapself_mmu.s",
"musl/src/thread/synccall.c",
"musl/src/thread/__syscall_cp.c",
"musl/src/thread/syscall_cp.c",
@@ -2305,7 +2270,6 @@ const src_files = [_][]const u8{
"musl/src/unistd/setsid.c",
"musl/src/unistd/setuid.c",
"musl/src/unistd/setxid.c",
"musl/src/unistd/sh/pipe.s",
"musl/src/unistd/sleep.c",
"musl/src/unistd/symlinkat.c",
"musl/src/unistd/symlink.c",