authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-21 02:47:29+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-21 09:30:16+01:00
logf1f269c6ee6b08e9d649072b0481dd8d1fda36b7
tree7e83efafabacb516ace63436737a70a8ae6d9cf1
parent0595feb34128db22fbebea843af929de3ede8190

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

Namely: * alpha * hppa * ia64 * microblaze * nios2 * or1k * s390 * sh

89 files changed, 0 insertions(+), 5926 deletions(-)

lib/libc/glibc/sysdeps/alpha/bits/endianness.h deleted-11
......@@ -1,11 +0,0 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* Alpha is little-endian. */
9#define __BYTE_ORDER __LITTLE_ENDIAN
10
11#endif /* bits/endianness.h */
lib/libc/glibc/sysdeps/alpha/crti.S deleted-101
......@@ -1,101 +0,0 @@
1/* Special .init and .fini section support for Alpha.
2 Copyright (C) 2001-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crti.S puts a function prologue at the beginning of the .init and
37 .fini sections and defines global symbols for those addresses, so
38 they can be called as functions. The symbols _init and _fini are
39 magic and cause the linker to emit DT_INIT and DT_FINI.
40
41 This differs from what would be generated for ordinary code in that
42 we save and restore the GP within the function. In order for linker
43 relaxation to work, the value in the GP register on exit from a function
44 must be valid for the function entry point. Normally, a function is
45 contained within one object file and this is not an issue, provided
46 that the function reloads the gp after making any function calls.
47 However, _init and _fini are constructed from pieces of many object
48 files, all of which may have different GP values. So we must reload
49 the GP value from crti.o in crtn.o. */
50
51#include <libc-symbols.h>
52#include <sysdep.h>
53
54#ifndef PREINIT_FUNCTION
55# define PREINIT_FUNCTION __gmon_start__
56#endif
57
58#ifndef PREINIT_FUNCTION_WEAK
59# define PREINIT_FUNCTION_WEAK 1
60#endif
61
62#if PREINIT_FUNCTION_WEAK
63 weak_extern (PREINIT_FUNCTION)
64#else
65 .hidden PREINIT_FUNCTION
66#endif
67
68 .section .init, "ax", @progbits
69 .globl _init
70 .hidden _init
71 .type _init, @function
72 .usepv _init, std
73_init:
74 ldgp $29, 0($27)
75 subq $30, 16, $30
76#if PREINIT_FUNCTION_WEAK
77 lda $27, PREINIT_FUNCTION
78#endif
79 stq $26, 0($30)
80 stq $29, 8($30)
81#if PREINIT_FUNCTION_WEAK
82 beq $27, 1f
83 jsr $26, ($27), PREINIT_FUNCTION
84 ldq $29, 8($30)
851:
86#else
87 bsr $26, PREINIT_FUNCTION !samegp
88#endif
89 .p2align 3
90
91 .section .fini, "ax", @progbits
92 .globl _fini
93 .hidden _fini
94 .type _fini,@function
95 .usepv _fini,std
96_fini:
97 ldgp $29, 0($27)
98 subq $30, 16, $30
99 stq $26, 0($30)
100 stq $29, 8($30)
101 .p2align 3
lib/libc/glibc/sysdeps/alpha/crtn.S deleted-49
......@@ -1,49 +0,0 @@
1/* Special .init and .fini section support for Alpha.
2 Copyright (C) 2001-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crtn.S puts function epilogues in the .init and .fini sections
37 corresponding to the prologues in crti.S. */
38
39 .section .init, "ax", @progbits
40 ldq $26, 0($30)
41 ldq $29, 8($30)
42 addq $30, 16, $30
43 ret
44
45 .section .fini, "ax", @progbits
46 ldq $26, 0($30)
47 ldq $29, 8($30)
48 addq $30, 16, $30
49 ret
lib/libc/glibc/sysdeps/alpha/dl-dtprocnum.h deleted-3
......@@ -1,3 +0,0 @@
1/* Number of extra dynamic section entries for this architecture. By
2 default there are none. */
3#define DT_THISPROCNUM DT_ALPHA_NUM
lib/libc/glibc/sysdeps/alpha/start-2.33.S deleted-85
......@@ -1,85 +0,0 @@
1/* Startup code for Alpha/ELF.
2 Copyright (C) 1993-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Richard Henderson <rth@tamu.edu>
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 In addition to the permissions in the GNU Lesser General Public
12 License, the Free Software Foundation gives you unlimited
13 permission to link the compiled version of this file with other
14 programs, and to distribute those programs without any restriction
15 coming from the use of this file. (The GNU Lesser General Public
16 License restrictions do apply in other respects; for example, they
17 cover modification of the file, and distribution when not linked
18 into another program.)
19
20 Note that people who make modified versions of this file are not
21 obligated to grant this special exception for their modified
22 versions; it is their choice whether to do so. The GNU Lesser
23 General Public License gives permission to release a modified
24 version without this exception; this exception also makes it
25 possible to release a modified version which carries forward this
26 exception.
27
28 The GNU C Library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31 Lesser General Public License for more details.
32
33 You should have received a copy of the GNU Lesser General Public
34 License along with the GNU C Library. If not, see
35 <https://www.gnu.org/licenses/>. */
36
37#include <sysdep.h>
38
39 .text
40 .align 3
41 .globl _start
42 .ent _start, 0
43 .type _start,@function
44_start:
45 .frame $15, 0, $15
46 br gp, 1f
471: ldgp gp, 0(gp)
48 subq sp, 16, sp
49 mov 0, $15
50 .prologue 0
51
52 /* Load address of the user's main function. */
53 lda a0, main
54
55 ldl a1, 16(sp) /* get argc */
56 lda a2, 24(sp) /* get argv */
57
58 /* Load address of our own entry points to .fini and .init. */
59 lda a3, __libc_csu_init
60 lda a4, __libc_csu_fini
61
62 /* Store address of the shared library termination function. */
63 mov v0, a5
64
65 /* Provide the highest stack address to the user code. */
66 stq sp, 0(sp)
67
68 /* Call the user's main function, and exit with its value.
69 But let the libc call main. */
70 jsr ra, __libc_start_main
71
72 /* Die very horribly if exit returns. Call_pal hlt is callable from
73 kernel mode only; this will result in an illegal instruction trap. */
74 call_pal 0
75 .end _start
76
77/* For ECOFF backwards compatibility. */
78weak_alias (_start, __start)
79
80/* Define a symbol for the first piece of initialized data. */
81 .data
82 .globl __data_start
83__data_start:
84 .weak data_start
85 data_start = __data_start
lib/libc/glibc/sysdeps/alpha/start.S deleted-83
......@@ -1,83 +0,0 @@
1/* Startup code for Alpha/ELF.
2 Copyright (C) 1993-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36#include <sysdep.h>
37
38 .text
39 .align 3
40 .globl _start
41 .ent _start, 0
42 .type _start,@function
43_start:
44 .frame $15, 0, $15
45 br gp, 1f
461: ldgp gp, 0(gp)
47 subq sp, 16, sp
48 mov 0, $15
49 .prologue 0
50
51 /* Load address of the user's main function. */
52 lda a0, main
53
54 ldl a1, 16(sp) /* get argc */
55 lda a2, 24(sp) /* get argv */
56
57 mov $r31, a3 /* Used to be init. */
58 mov $r31, a4 /* Used to be fini. */
59
60 /* Store address of the shared library termination function. */
61 mov v0, a5
62
63 /* Provide the highest stack address to the user code. */
64 stq sp, 0(sp)
65
66 /* Call the user's main function, and exit with its value.
67 But let the libc call main. */
68 jsr ra, __libc_start_main
69
70 /* Die very horribly if exit returns. Call_pal hlt is callable from
71 kernel mode only; this will result in an illegal instruction trap. */
72 call_pal 0
73 .end _start
74
75/* For ECOFF backwards compatibility. */
76weak_alias (_start, __start)
77
78/* Define a symbol for the first piece of initialized data. */
79 .data
80 .globl __data_start
81__data_start:
82 .weak data_start
83 data_start = __data_start
lib/libc/glibc/sysdeps/hppa/bits/endianness.h deleted-11
......@@ -1,11 +0,0 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* HP-PA is big-endian. */
9#define __BYTE_ORDER __BIG_ENDIAN
10
11#endif /* bits/endianness.h */
lib/libc/glibc/sysdeps/hppa/crti.S deleted-162
......@@ -1,162 +0,0 @@
1/* Special .init and .fini section support for HPPA
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crti.S puts a function prologue at the beginning of the .init and
37 .fini sections and defines global symbols for those addresses, so
38 they can be called as functions. The symbols _init and _fini are
39 magic and cause the linker to emit DT_INIT and DT_FINI. */
40
41#include <libc-symbols.h>
42#include <sysdep.h>
43
44#ifndef PREINIT_FUNCTION
45# define PREINIT_FUNCTION __gmon_start__
46#endif
47
48#ifndef PREINIT_FUNCTION_WEAK
49# define PREINIT_FUNCTION_WEAK 1
50#endif
51
52#if PREINIT_FUNCTION_WEAK
53 weak_extern (PREINIT_FUNCTION)
54#else
55 .hidden PREINIT_FUNCTION
56#endif
57
58
59/* If we have working .init_array support, we want to keep the .init
60 section empty (apart from the mandatory prologue/epilogue. This
61 ensures that the default unwind conventions (return-pointer in b0,
62 frame state in ar.pfs, etc.) will do the Right Thing. To ensure
63 an empty .init section, we register gmon_initializer() via the
64 .init_array.
65
66 --davidm 02/10/29 */
67
68#if PREINIT_FUNCTION_WEAK
69/* This blob of assembly code is one simple C function:
70
71static void
72__attribute__ ((used))
73gmon_initializer (void)
74{
75 extern void weak_function __gmon_start__ (void);
76
77 if (__gmon_start__)
78 (*__gmon_start__)();
79}
80
81In a final executable, PLABEL32 relocations for function pointers are
82resolved at link time. Typically, binutils/ld resolves __gmon_start__
83using an external shared library. __gmon_start__ is always called if
84it is found at link time. If __gmon_start__ is not found at runtime
85due to a library update, then the function pointer will point at a null
86function descriptor and calling it will cause a segmentation fault.
87So, we call __canonicalize_funcptr_for_compare to obtain the canonicalized
88address of __gmon_start__ and skip calling __gmon_start__ if it is zero.
89
90 */
91 .type __canonicalize_funcptr_for_compare,@function
92 .type $$dyncall,@function
93
94 .section .data.rel.ro,"aw",@progbits
95 .align 4
96.LC0:
97 .type __gmon_start__,@function
98 .word P%__gmon_start__
99
100 .text
101 .align 4
102 .type gmon_initializer,@function
103gmon_initializer:
104 .PROC
105 .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=4
106 .ENTRY
107 stw %r2,-20(%r30)
108 stwm %r4,64(%r30)
109 stw %r3,-60(%r30)
110 addil LT'.LC0,%r19
111 ldw RT'.LC0(%r1),%r28
112 ldw 0(%r28),%r3
113 comib,= 0,%r3,1f
114 copy %r19,%r4
115 stw %r19,-32(%r30)
116 bl __canonicalize_funcptr_for_compare,%r2
117 copy %r3,%r26
118 comib,= 0,%r28,1f
119 copy %r4,%r19
120 copy %r3,%r22
121 .CALL ARGW0=GR
122 bl $$dyncall,%r31
123 copy %r31,%r2
1241:
125 ldw -84(%r30),%r2
126 ldw -60(%r30),%r3
127 bv %r0(%r2)
128 ldwm -64(%r30),%r4
129 .EXIT
130 .PROCEND
131 .size gmon_initializer, .-gmon_initializer
132
133# undef PREINIT_FUNCTION
134# define PREINIT_FUNCTION gmon_initializer
135#endif
136
137 .section .init_array, "aw"
138 .word P% PREINIT_FUNCTION
139
140
141/* _init prologue. */
142 .section .init, "ax", %progbits
143 .align 4
144 .globl _init
145 .hidden _init
146 .type _init,@function
147_init:
148 stw %rp,-20(%sp)
149 stwm %r4,64(%sp)
150 stw %r19,-32(%sp)
151
152/* _fini prologue. */
153 .section .fini,"ax",%progbits
154 .align 4
155 .globl _fini
156 .hidden _fini
157 .type _fini,@function
158_fini:
159 stw %rp,-20(%sp)
160 stwm %r4,64(%sp)
161 stw %r19,-32(%sp)
162 copy %r19,%r4
lib/libc/glibc/sysdeps/hppa/crtn.S deleted-66
......@@ -1,66 +0,0 @@
1/* Special .init and .fini section support for HPPA
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36#include <sysdep.h>
37
38/* crtn.S puts function epilogues in the .init and .fini sections
39 corresponding to the prologues in crti.S. */
40
41 .section .init, "ax", @progbits
42 ldw -84(%sp),%rp
43 copy %r4,%r19
44 bv %r0(%rp)
45_end_init:
46 ldwm -64(%sp),%r4
47
48/* Our very own unwind info, because the assembler can't handle
49 functions split into two or more pieces. */
50 .section .PARISC.unwind
51 .extern _init
52 .word _init, _end_init
53 .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
54
55/* Here is the tail end of _fini. */
56 .section .fini, "ax", @progbits
57 ldw -84(%sp),%rp
58 copy %r4,%r19
59 bv %r0(%rp)
60_end_fini:
61 ldwm -64(%sp),%r4
62
63 .section .PARISC.unwind
64 .extern _fini
65 .word _fini, _end_fini
66 .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
lib/libc/glibc/sysdeps/hppa/entry.h deleted-8
......@@ -1,8 +0,0 @@
1extern void _start (void);
2
3/* Lives in libgcc.so and canonicalizes function pointers for comparison. */
4extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr);
5
6/* The function's entry point is stored in the first word of the
7 function descriptor (plabel) of _start(). */
8#define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start)
lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h deleted-46
......@@ -1,46 +0,0 @@
1/* Copyright (C) 2005-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_PTHREADTYPES_ARCH_H
19#define _BITS_PTHREADTYPES_ARCH_H 1
20
21/* Linuxthread type sizes (bytes):
22 sizeof(pthread_attr_t) = 0x24 (36)
23 sizeof(pthread_barrier_t) = 0x30 (48)
24 sizeof(pthread_barrierattr_t) = 0x4 (4)
25 sizeof(pthread_cond_t) = 0x30 (48)
26 sizeof(pthread_condattr_t) = 0x4 (4)
27 sizeof(pthread_mutex_t) = 0x30 (48)
28 sizeof(pthread_mutexattr_t) = 0x4 (4)
29 sizeof(pthread_rwlock_t) = 0x40 (64)
30 sizeof(pthread_rwlockattr_t) = 0x8 (8)
31 sizeof(pthread_spinlock_t) = 0x10 (16) */
32
33#define __SIZEOF_PTHREAD_ATTR_T 36
34#define __SIZEOF_PTHREAD_MUTEX_T 48
35#define __SIZEOF_PTHREAD_BARRIER_T 48
36#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
37#define __SIZEOF_PTHREAD_COND_T 48
38#define __SIZEOF_PTHREAD_CONDATTR_T 4
39#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
40#define __SIZEOF_PTHREAD_RWLOCK_T 64
41#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
42
43#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
44#define __ONCE_ALIGNMENT
45
46#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/hppa/start-2.33.S deleted-152
......@@ -1,152 +0,0 @@
1/* ELF startup code for HPPA.
2 Copyright (C) 2002-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36 .import main, code
37 .import $global$, data
38 .import __libc_start_main, code
39 .import __libc_csu_fini, code
40 .import __libc_csu_init, code
41
42 /* Have the linker create plabel words so we get PLABEL32
43 relocs and not 21/14. The use of 21/14 relocs is only
44 supported in the latest dynamic linker. */
45#ifdef PIC
46 .section .data.rel.ro,"aw",@progbits
47#else
48 .section .rodata,"a",@progbits
49#endif
50 .align 4
51.Lpmain:
52 .word P%main
53.Lp__libc_start_main:
54 .word P%__libc_start_main
55.Lp__libc_csu_fini:
56 .word P%__libc_csu_fini
57.Lp__libc_csu_init:
58 .word P%__libc_csu_init
59
60 .text
61 .align 4
62 .globl _start
63 .export _start, ENTRY
64 .type _start,@function
65_start:
66 /* At entry to the function we have:
67
68 r26 - Unused
69 r25 - argc
70 r24 - argv
71 r23 - False _dl_fini plabel address
72
73 This function is called from the lower half of RTLD_START.
74
75 The call to __libc_start_main expects:
76
77 1. r26 - Application main
78 2. r25 - argc
79 3. r24 - argv
80 4. r23 - __libc_csu_init
81 5. sp-52 - __libc_csu_fini
82 6. sp-56 - rtld_fini
83 7. sp-60 - stackend */
84
85 .proc
86 .callinfo
87 /* Clear previous-sp. */
88 stw %r0, -4(%sp)
89 /* Setup the stack and frame. */
90 stw %rp, -20(%sp)
91 ldo 64(%sp), %sp
92 stw %sp, -4(%sp)
93 stw %r19, -32(%sp)
94
95 /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
96 /* void (*rtld_fini) (void) (6th argument) */
97 stw %r23, -56(%sp)
98
99 /* Need to setup 1, 4, 5, and 7th arguments */
100
101#ifdef PIC
102 /* Load $global$ address into %dp */
103 bl .+8, %dp
104 addil L'$global$-$PIC_pcrel$0+1, %dp
105 ldo R'$global$-$PIC_pcrel$0+5(%r1), %dp
106
107 /* load main (1st argument) */
108 addil LT'.Lpmain, %r19
109 ldw RT'.Lpmain(%r1), %r26
110 ldw 0(%r26),%r26
111 /* void (*init) (void) (4th argument) */
112 addil LT'.Lp__libc_csu_init, %r19
113 ldw RT'.Lp__libc_csu_init(%r1), %r23
114 ldw 0(%r23), %r23
115 /* void (*fini) (void) (5th argument) */
116 addil LT'.Lp__libc_csu_fini, %r19
117 ldw RT'.Lp__libc_csu_fini(%r1), %r22
118 ldw 0(%r22), %r22
119#else
120 /* Load $global$ address into %dp */
121 ldil L%$global$, %dp
122 ldo R%$global$(%dp), %dp
123
124 /* load main (1st argument) */
125 ldil LR'.Lpmain, %r26
126 ldw RR'.Lpmain(%r26), %r26
127 /* void (*init) (void) (4th argument) */
128 ldil LR'.Lp__libc_csu_init, %r23
129 ldw RR'.Lp__libc_csu_init(%r23), %r23
130 /* void (*fini) (void) (5th argument) */
131 ldil LR'.Lp__libc_csu_fini, %r22
132 ldw RR'.Lp__libc_csu_fini(%r22), %r22
133#endif
134 /* Store 5th argument */
135 stw %r22, -52(%sp)
136 /* void *stack_end (7th argument) */
137 stw %sp, -60(%sp)
138 bl __libc_start_main,%r2
139 nop
140 /* die horribly if it returned (it shouldn't) */
141 iitlbp %r0,(%sr0,%r0)
142 nop
143
144 .procend
145
146/* Define a symbol for the first piece of initialized data. */
147 .data
148 .globl __data_start
149__data_start:
150 .long 0
151 .weak data_start
152 data_start = __data_start
lib/libc/glibc/sysdeps/hppa/start.S deleted-134
......@@ -1,134 +0,0 @@
1/* ELF startup code for HPPA.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36 .import main, code
37 .import $global$, data
38 .import __libc_start_main, code
39
40 /* Have the linker create plabel words so we get PLABEL32
41 relocs and not 21/14. The use of 21/14 relocs is only
42 supported in the latest dynamic linker. */
43#ifdef PIC
44 .section .data.rel.ro,"aw",@progbits
45#else
46 .section .rodata,"a",@progbits
47#endif
48 .align 4
49.Lpmain:
50 .word P%main
51.Lp__libc_start_main:
52 .word P%__libc_start_main
53
54 .text
55 .align 4
56 .globl _start
57 .export _start, ENTRY
58 .type _start,@function
59_start:
60 /* At entry to the function we have:
61
62 r26 - Unused
63 r25 - argc
64 r24 - argv
65 r23 - False _dl_fini plabel address
66
67 This function is called from the lower half of RTLD_START.
68
69 The call to __libc_start_main expects:
70
71 1. r26 - Application main
72 2. r25 - argc
73 3. r24 - argv
74 4. r23 - init (unused)
75 5. sp-52 - fini (unused)
76 6. sp-56 - rtld_fini
77 7. sp-60 - stackend */
78
79 .proc
80 .callinfo
81 /* Clear previous-sp. */
82 stw %r0, -4(%sp)
83 /* Setup the stack and frame. */
84 stw %rp, -20(%sp)
85 ldo 64(%sp), %sp
86 stw %sp, -4(%sp)
87 stw %r19, -32(%sp)
88
89 /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
90 /* void (*rtld_fini) (void) (6th argument) */
91 stw %r23, -56(%sp)
92
93 /* Need to setup 1, 4, 5, and 7th arguments */
94
95#ifdef PIC
96 /* Load $global$ address into %dp */
97 bl .+8, %dp
98 addil L'$global$-$PIC_pcrel$0+1, %dp
99 ldo R'$global$-$PIC_pcrel$0+5(%r1), %dp
100
101 /* load main (1st argument) */
102 addil LT'.Lpmain, %r19
103 ldw RT'.Lpmain(%r1), %r26
104 ldw 0(%r26),%r26
105#else
106 /* Load $global$ address into %dp */
107 ldil L%$global$, %dp
108 ldo R%$global$(%dp), %dp
109
110 /* load main (1st argument) */
111 ldil LR'.Lpmain, %r26
112 ldw RR'.Lpmain(%r26), %r26
113#endif
114 ldi 0,%r23 /* Used to be init. */
115 ldi 0,%r22 /* Used to be fini. */
116 /* Store 5th argument */
117 stw %r22, -52(%sp)
118 /* void *stack_end (7th argument) */
119 stw %sp, -60(%sp)
120 bl __libc_start_main,%r2
121 nop
122 /* die horribly if it returned (it shouldn't) */
123 iitlbp %r0,(%sr0,%r0)
124 nop
125
126 .procend
127
128/* Define a symbol for the first piece of initialized data. */
129 .data
130 .globl __data_start
131__data_start:
132 .long 0
133 .weak data_start
134 data_start = __data_start
lib/libc/glibc/sysdeps/hppa/sysdep.h deleted-73
......@@ -1,73 +0,0 @@
1/* Assembler macros for HP/PA.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20
21#undef ASM_LINE_SEP
22#define ASM_LINE_SEP !
23
24#ifdef __ASSEMBLER__
25
26/* Syntactic details of assembler. */
27
28#define ALIGNARG(log2) log2
29
30
31/* Define an entry point visible from C.
32
33 There is currently a bug in gdb which prevents us from specifying
34 incomplete stabs information. Fake some entries here which specify
35 the current source file. */
36#define ENTRY(name) \
37 .SPACE $TEXT$ ASM_LINE_SEP \
38 .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
39 .align ALIGNARG(4) ASM_LINE_SEP \
40 .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
41 .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\
42 C_LABEL(name) \
43 CALL_MCOUNT
44
45#undef END
46#define END(name) \
47 .PROCEND
48
49/* GCC does everything for us. */
50#ifdef PROF
51#define CALL_MCOUNT
52#else
53#define CALL_MCOUNT /* Do nothing. */
54#endif
55
56#define PSEUDO(name, syscall_name, args) \
57 ENTRY (name) \
58 DO_CALL (syscall_name, args)
59
60#undef PSEUDO_END
61#define PSEUDO_END(name) \
62 END (name)
63
64#undef JUMPTARGET
65#define JUMPTARGET(name) name
66#define SYSCALL_PIC_SETUP /* Nothing. */
67
68/* Local label name for asm code. */
69#ifndef L
70#define L(name) name
71#endif
72
73#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/ia64/start-2.33.S deleted-118
......@@ -1,118 +0,0 @@
1/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36#include <sysdep.h>
37
38#include <asm/fpu.h>
39
40/*
41 * Arguments for __libc_start_main:
42 * out0: main
43 * out1: argc
44 * out2: argv
45 * out3: init
46 * out4: fini
47 * out5: rtld_fini
48 * out6: stack_end
49 */
50
51 .align 32
52 .global _start
53
54 .proc _start
55 .type _start,@function
56_start:
57 .prologue
58 .save rp, r0
59 .body
60 .prologue
61 { .mlx
62 alloc r2 = ar.pfs,0,0,7,0
63 movl r3 = FPSR_DEFAULT
64 }
65 { .mlx
66 adds out2 = 16, sp /* get address of argc value */
67 movl gp = @gprel(0f)
68 ;;
69 }
700: { .mmi
71 ld8 out1 = [out2], 8 /* load argc and move out2 to become argv */
72 mov.m r10 = ar.bsp /* fetch rbs base address */
73 mov r9 = ip
74 ;;
75 }
76 { .mii
77 mov ar.fpsr = r3
78 sub gp = r9, gp /* back-compute gp value */
79 adds out6 = 16, sp /* highest non-environment stack address */
80 ;;
81 }
82 {
83 addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
84 addl out0 = @ltoff(@fptr(main)), gp
85 addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
86 ;;
87 }
88 { .mmi
89 ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
90 ld8 out0 = [out0] /* pointer to `main' function descriptor */
91 addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
92 ;;
93 }
94 { .mmi
95 ld8 out3 = [out3] /* pointer to `init' function descriptor */
96 ld8 out4 = [out4] /* pointer to `fini' function descriptor */
97 nop 0
98 }
99 .body
100 { .mib
101 st8 [r3] = r10
102 mov out5 = ret0 /* dynamic linker destructor */
103 br.call.sptk.few rp = __libc_start_main
104 }
105 { .mib
106 break 0 /* break miserably if we ever return */
107 }
108 .endp _start
109
110/* Define a symbol for the first piece of initialized data. */
111 .data
112 .globl __data_start
113__data_start:
114 .long 0
115 .weak data_start
116 data_start = __data_start
117
118 .common __libc_ia64_register_backing_store_base, 8, 8
lib/libc/glibc/sysdeps/microblaze/bits/endianness.h deleted-15
......@@ -1,15 +0,0 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* MicroBlaze has selectable endianness. */
9#ifdef _BIG_ENDIAN
10# define __BYTE_ORDER __BIG_ENDIAN
11#else
12# define __BYTE_ORDER __LITTLE_ENDIAN
13#endif
14
15#endif /* bits/endianness.h */
lib/libc/glibc/sysdeps/microblaze/crti.S deleted-90
......@@ -1,90 +0,0 @@
1/* Special .init and .fini section support for MicroBlaze.
2 Copyright (C) 2012-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crti.S puts a function prologue at the beginning of the .init and
37 .fini sections and defines global symbols for those addresses, so
38 they can be called as functions. The symbols _init and _fini are
39 magic and cause the linker to emit DT_INIT and DT_FINI. */
40
41#include <libc-symbols.h>
42#include <sysdep.h>
43
44#ifndef PREINIT_FUNCTION
45# define PREINIT_FUNCTION __gmon_start__
46#endif
47
48#ifndef PREINIT_FUNCTION_WEAK
49# define PREINIT_FUNCTION_WEAK 1
50#endif
51
52#if PREINIT_FUNCTION_WEAK
53 weak_extern (PREINIT_FUNCTION)
54#else
55 .hidden PREINIT_FUNCTION
56#endif
57
58 .section .init,"ax",@progbits
59 .align 2
60 .globl _init
61 .hidden _init
62 .type _init, @function
63_init:
64 addik r1,r1,-32
65 swi r20,r1,28
66 mfs r20,rpc
67 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
68 lwi r3,r20,PREINIT_FUNCTION@GOT
69#if PREINIT_FUNCTION_WEAK
70 beqid r3,$Lno_weak_fn:
71 swi r15,r1,0
72 brlid r15,PREINIT_FUNCTION@PLT
73$Lno_weak_fn:
74#else
75 swi r15,r1,0
76 brald r15,r3
77#endif
78 nop # Unfilled delay slot
79
80 .section .fini,"ax",@progbits
81 .align 2
82 .globl _fini
83 .hidden _fini
84 .type _fini, @function
85_fini:
86 addik r1,r1,-32
87 swi r20,r1,28
88 swi r15,r1,0
89 mfs r20,rpc
90 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lib/libc/glibc/sysdeps/microblaze/crtn.S deleted-51
......@@ -1,51 +0,0 @@
1/* Special .init and .fini section support for MicroBlaze.
2 Copyright (C) 1995-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crtn.S puts function epilogues in the .init and .fini sections
37 corresponding to the prologues in crti.S. */
38
39#include <sysdep.h>
40
41 .section .init,"ax",@progbits
42 lwi r15,r1,0
43 lwi r20,r1,28
44 rtsd r15,8
45 addik r1,r1,32
46
47 .section .fini,"ax",@progbits
48 lwi r15,r1,0
49 lwi r20,r1,28
50 rtsd r15,8
51 addik r1,r1,32
lib/libc/glibc/sysdeps/microblaze/start-2.33.S deleted-84
......@@ -1,84 +0,0 @@
1/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36 .text
37 .globl _start
38 .type _start,@function
39_start:
40 /* On entry the stack contains the following args:
41 r1+0 - argc
42 r1+4 - argv[0]
43 ...
44 r1+4*(argc-1) - argv[argc-1]
45 r1+4*argc - NULL
46 r1+4*argc + 4 - envp[0]
47 ...
48 NULL
49 */
50 addk r3,r0,r0
51 addk r5,r1,r0
521:
53 addik r5,r5,4
54 lw r4,r5,r0
55 bneid r4,1b
56 addik r3,r3,1
57 addik r6,r3,-1
58 sw r6,r1,r0
59 addik r7,r1,4
60 addik r1,r1,-24
61#ifdef SHARED
62 /* Setup PIC. */
63 mfs r20,rpc
64 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
65 lwi r5,r20,main@GOT
66 lwi r8,r20,__libc_csu_init@GOT
67 lwi r9,r20,__libc_csu_fini@GOT
68 brid __libc_start_main@PLT
69 addk r10,r0,r0
70#else
71 addik r5,r0,main
72 addik r8,r0,__libc_csu_init
73 addik r9,r0,__libc_csu_fini
74 brid __libc_start_main
75 addk r10,r0,r0
76#endif
77
78/* Define a symbol for the first piece of initialized data. */
79 .data
80 .globl __data_start
81__data_start:
82 .long 0
83 .weak data_start
84 data_start = __data_start
lib/libc/glibc/sysdeps/microblaze/start.S deleted-84
......@@ -1,84 +0,0 @@
1/* Copyright (C) 1995-2024 Free Software Foundation, Inc.
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library. If not, see
34 <https://www.gnu.org/licenses/>. */
35
36 .text
37 .globl _start
38 .type _start,@function
39_start:
40 /* On entry the stack contains the following args:
41 r1+0 - argc
42 r1+4 - argv[0]
43 ...
44 r1+4*(argc-1) - argv[argc-1]
45 r1+4*argc - NULL
46 r1+4*argc + 4 - envp[0]
47 ...
48 NULL
49 */
50 addk r3,r0,r0
51 addk r5,r1,r0
521:
53 addik r5,r5,4
54 lw r4,r5,r0
55 bneid r4,1b
56 addik r3,r3,1
57 addik r6,r3,-1
58 sw r6,r1,r0
59 addik r7,r1,4
60 addik r1,r1,-24
61#ifdef SHARED
62 /* Setup PIC. */
63 mfs r20,rpc
64 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
65 lwi r5,r20,main@GOT
66 addk r8,r0,r0 /* Used to be init. */
67 addk r9,r0,r0 /* Used to be fini. */
68 brid __libc_start_main@PLT
69 addk r10,r0,r0
70#else
71 addik r5,r0,main
72 addk r8,r0,r0 /* Used to be init. */
73 addk r9,r0,r0 /* Used to be fini. */
74 brid __libc_start_main
75 addk r10,r0,r0
76#endif
77
78/* Define a symbol for the first piece of initialized data. */
79 .data
80 .globl __data_start
81__data_start:
82 .long 0
83 .weak data_start
84 data_start = __data_start
lib/libc/glibc/sysdeps/microblaze/sysdep.h deleted-85
......@@ -1,85 +0,0 @@
1/* Copyright (C) 1997-2024 Free Software Foundation, Inc.
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* Syntactic details of assembler. */
24
25# define ALIGNARG(log2) log2
26# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
27
28/* Define an entry point visible from C. */
29# define ENTRY(name) \
30 .globl C_SYMBOL_NAME(name); \
31 .type C_SYMBOL_NAME(name),@function; \
32 .align ALIGNARG(2); \
33 C_LABEL(name) \
34 CALL_MCOUNT
35
36# undef END
37# define END(name) ASM_SIZE_DIRECTIVE(name)
38
39
40/* If compiled for profiling, call `_mcount' at the start of each function. */
41# ifdef PROF
42/* The mcount code relies on a normal frame pointer being on the stack
43 to locate our caller, so push one just for its benefit. */
44# define CALL_MCOUNT \
45 addik r1,r1,-4; \
46 swi r15,r1,0; \
47 brlid r15,JUMPTARGET(mcount); \
48 nop; \
49 lwi r15,r1,0; \
50 addik r1,r1,4;
51# else
52# define CALL_MCOUNT /* Do nothing. */
53# endif
54
55/* Since C identifiers are not normally prefixed with an underscore
56 on this system, the asm identifier `syscall_error' intrudes on the
57 C name space. Make sure we use an innocuous name. */
58# define syscall_error __syscall_error
59# define mcount _mcount
60
61# define PSEUDO(name, syscall_name, args) \
62 .globl syscall_error; \
63 ENTRY (name) \
64 DO_CALL (syscall_name, args);
65
66# define ret \
67 rtsd r15,8; nop;
68
69# undef PSEUDO_END
70# define PSEUDO_END(name) \
71 END (name)
72
73# undef JUMPTARGET
74# ifdef PIC
75# define JUMPTARGET(name) name##@PLTPC
76# else
77# define JUMPTARGET(name) name
78# endif
79
80/* Local label name for asm code. */
81# ifndef L
82# define L(name) $L##name
83# endif
84
85# endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/nios2/sysdep.h deleted-65
......@@ -1,65 +0,0 @@
1/* Assembler macros for Nios II.
2 Copyright (C) 2015-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* Syntactic details of assembler. */
24
25#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
26
27#define ENTRY(name) \
28 .globl C_SYMBOL_NAME(name); \
29 .type C_SYMBOL_NAME(name),%function; \
30 C_LABEL(name) \
31 cfi_startproc; \
32 CALL_MCOUNT;
33
34#undef END
35#define END(name) \
36 cfi_endproc; \
37 ASM_SIZE_DIRECTIVE(name)
38
39#ifdef PROF
40
41# ifdef __PIC__
42# define CALL_MCOUNT \
43 mov r8, ra; \
44 nextpc r2; \
451: \
46 movhi r3, %hiadj(_gp_got - 1b); \
47 addi r3, r3, %lo(_gp_got - 1b); \
48 add r2, r2, r3; \
49 ldw r2, %call(_mcount)(r2); \
50 callr r2; \
51 mov ra, r8; \
52 ret;
53# else
54# define CALL_MCOUNT \
55 mov r8, ra; \
56 call _mount; \
57 mov ra, r8; \
58 ret;
59# endif
60
61#else
62# define CALL_MCOUNT /* Do nothing. */
63#endif
64
65#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/s390/s390-32/crti.S deleted-104
......@@ -1,104 +0,0 @@
1/* Special .init and .fini section support for S/390.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crti.S puts a function prologue at the beginning of the .init and
37 .fini sections and defines global symbols for those addresses, so
38 they can be called as functions. The symbols _init and _fini are
39 magic and cause the linker to emit DT_INIT and DT_FINI. */
40
41#include <libc-symbols.h>
42#include <sysdep.h>
43
44#ifndef PREINIT_FUNCTION
45# define PREINIT_FUNCTION __gmon_start__
46#endif
47
48#ifndef PREINIT_FUNCTION_WEAK
49# define PREINIT_FUNCTION_WEAK 1
50#endif
51
52#if PREINIT_FUNCTION_WEAK
53 weak_extern (PREINIT_FUNCTION)
54#else
55 .hidden PREINIT_FUNCTION
56#endif
57
58 .section .init,"ax",@progbits
59 .globl _init
60 .hidden _init
61 .type _init,@function
62 .align 4
63_init:
64 stm %r6,%r15,24(%r15)
65 bras %r13,1f
660:
67#if PREINIT_FUNCTION_WEAK
68 .long PREINIT_FUNCTION@GOT
69#else
70 .long PREINIT_FUNCTION-0b
71#endif
72 .long _GLOBAL_OFFSET_TABLE_-0b
731: lr %r1,%r15
74 ahi %r15,-96
75 st %r1,0(%r15)
76 l %r12,4(%r13)
77 ar %r12,%r13
78 l %r1,0(%r13)
79#if PREINIT_FUNCTION_WEAK
80 l %r1,0(%r1,%r12)
81 ltr %r1,%r1
82 je 2f
83#else
84 la %r1,0(%r1,%r13)
85#endif
86 basr %r14,%r1
87 .align 4,0x07
882:
89
90 .section .fini,"ax",@progbits
91 .globl _fini
92 .hidden _fini
93 .type _fini,@function
94 .align 4
95_fini:
96 stm %r6,%r15,24(%r15)
97 bras %r13,1f
980: .long _GLOBAL_OFFSET_TABLE_-0b
991: lr %r1,%r15
100 ahi %r15,-96
101 st %r1,0(%r15)
102 l %r12,0(%r13)
103 ar %r12,%r13
104 .align 4,0x07
lib/libc/glibc/sysdeps/s390/s390-32/crtn.S deleted-47
......@@ -1,47 +0,0 @@
1/* Special .init and .fini section support for S/390.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crtn.S puts function epilogues in the .init and .fini sections
37 corresponding to the prologues in crti.S. */
38
39 .section .init,"ax",@progbits
40 l %r4,152(%r15)
41 lm %r6,%r15,120(%r15)
42 br %r4
43
44 .section .fini,"ax",@progbits
45 l %r4,152(%r15)
46 lm %r6,%r15,120(%r15)
47 br %r4
lib/libc/glibc/sysdeps/s390/s390-32/start-2.33.S deleted-219
......@@ -1,219 +0,0 @@
1/* Startup code compliant to the ELF s390 ABI.
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 In addition to the permissions in the GNU Lesser General Public
12 License, the Free Software Foundation gives you unlimited
13 permission to link the compiled version of this file with other
14 programs, and to distribute those programs without any restriction
15 coming from the use of this file. (The GNU Lesser General Public
16 License restrictions do apply in other respects; for example, they
17 cover modification of the file, and distribution when not linked
18 into another program.)
19
20 Note that people who make modified versions of this file are not
21 obligated to grant this special exception for their modified
22 versions; it is their choice whether to do so. The GNU Lesser
23 General Public License gives permission to release a modified
24 version without this exception; this exception also makes it
25 possible to release a modified version which carries forward this
26 exception.
27
28 The GNU C Library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31 Lesser General Public License for more details.
32
33 You should have received a copy of the GNU Lesser General Public
34 License along with the GNU C Library; if not, see
35 <https://www.gnu.org/licenses/>. */
36
37#include <sysdep.h>
38
39/*
40 This is the canonical entry point, usually the first thing in the text
41 segment. Most registers' values are unspecified, except for:
42
43 %r14 Contains a function pointer to be registered with `atexit'.
44 This is how the dynamic linker arranges to have DT_FINI
45 functions called for shared libraries that have been loaded
46 before this code runs.
47
48 %r15 The stack contains the arguments and environment:
49 0(%r15) argc
50 4(%r15) argv[0]
51 ...
52 (4*argc)(%r15) NULL
53 (4*(argc+1))(%r15) envp[0]
54 ...
55 NULL
56*/
57
58 .text
59 .globl _start
60 .type _start,@function
61_start:
62 cfi_startproc
63 /* Mark r14 as undefined in order to stop unwinding here! */
64 /* zig patch: r14 -> %r14. revert with llvm 20. */
65 cfi_undefined (%r14)
66
67 /* Check if the kernel provides highgprs facility if needed by
68 the binary. */
69
70 lr %r6,%r15
71 la %r6,4(%r6) /* Skip the argument counter. */
72
73.L11: l %r5,0(%r6) /* Skip the argument vector. */
74 la %r6,4(%r6)
75 ltr %r5,%r5
76 jne .L11
77
78.L12: l %r5,0(%r6) /* Skip the environment vector. */
79 la %r6,4(%r6)
80 ltr %r5,%r5
81 jne .L12
82
83 /* Usually the auxiliary vector can be expected directly after
84 the environment variables. But we have to skip extra zeros
85 because the loader might have removed unsecure variables for
86 setuid programs. */
87
88.L26: l %r5,0(%r6)
89 la %r6,4(%r6)
90 ltr %r5,%r5
91 jz .L26
92
93 ahi %r6,-4
94
95 /* Obtain the needed values from the auxiliary vector. */
96
97 lhi %r7,16 /* AT_HWCAP */
98 lhi %r8,3 /* AT_PHDR */
99 lhi %r9,5 /* AT_PHNUM */
100 lhi %r2,4 /* AT_PHENT */
101.L13: l %r5,0(%r6)
102 clr %r5,%r7
103 jne .L15
104 l %r10,4(%r6) /* r10 = AT_HWCAP value. */
105.L15: clr %r5,%r8
106 jne .L16
107 l %r11,4(%r6) /* r11 = AT_PHDR value. */
108.L16: clr %r5,%r9
109 jne .L17
110 l %r12,4(%r6) /* r12 = AT_PHNUM value. */
111.L17: clr %r5,%r2
112 jne .L18
113 l %r0,4(%r6) /* r0 = AT_PHENT value. */
114.L18: ltr %r5,%r5
115 la %r6,8(%r6)
116 jnz .L13
117
118 /* Locate the ELF header by looking for the first PT_LOAD
119 segment with a p_offset of zero. */
120
121 lr %r4,%r11 /* Backup AT_PHDR. */
122 lhi %r7,1 /* PT_LOAD id */
123 lhi %r8,0
124.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
125 jne .L20
126 cl %r8,4(%r4) /* p_offset == 0? */
127 jne .L20
128 l %r9,8(%r4) /* r9 = PT_LOAD.p_vaddr <- ELF header address */
129 j .L24
130.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
131 brct %r12,.L19
132
133 j .+2 /* Trap, there must be such a phdr. */
134
135.L24: lr %r4,%r11 /* Backup AT_PHDR. */
136 lhi %r2,6 /* PT_PHDR id */
137.L23: cl %r2,0(%r4)
138 jne .L22
139 l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
140 j .L25
141.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
142 brct %r12,.L23
143
144 j .L14 /* No PT_PHDR found - skip checking. */
145
146.L25: slr %r11,%r3 /* AT_PHDR - PT_PHDR.p_vaddr (relocation offset)*/
147 alr %r9,%r11 /* PT_LOAD.p_vaddr += relocation offset */
148
149 l %r5,36(%r9) /* Load the e_flags field. */
150 tml %r5,1
151 jz .L14 /* Binary does not require highgprs facility. */
152
153 tml %r10,512 /* Check the AT_HWCAP value. */
154 jz 2 /* Trap if no highgprs facility available. */
155.L14:
156
157 /* Setup pointer to literal pool of _start */
158 basr %r13,0
159.L0: ahi %r13,.Llit-.L0
160
161 /* load argc and argv from stack */
162 la %r4,4(%r15) # get argv
163 l %r3,0(%r15) # get argc
164
165 /* align the stack to a double word boundary */
166 lhi %r0,-8
167 nr %r15,%r0
168
169 /* Setup a stack frame and a parameter area */
170 ahi %r15,-104 # make room on stack
171 xc 0(4,%r15),0(%r15) # clear back-chain
172
173 /* set up arguments for __libc_start_main:
174 main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
175 Note that envp will be determined later in __libc_start_main
176 */
177 stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
178 la %r7,96(%r15)
179 l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
180 l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
181 l %r2,.L3-.Llit(%r13) # load pointer to main
182 l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
183#ifdef PIC
184 l %r12,.L5-.Llit(%r13) # load .got pointer
185 la %r6,0(%r13,%r6)
186 la %r5,0(%r13,%r5)
187 la %r12,0(%r13,%r12)
188 l %r2,0(%r12,%r2)
189 la %r1,0(%r13,%r1)
190#endif
191
192 /* ok, now branch to the libc main routine */
193 basr %r14,%r1
194
195 /* crash if __libc_start_main returns */
196 .word 0
197
198 cfi_endproc
199.Llit:
200#ifndef PIC
201.L1: .long __libc_csu_init
202.L2: .long __libc_csu_fini
203.L3: .long main
204.L4: .long __libc_start_main
205#else
206.L1: .long __libc_csu_init-.Llit
207.L2: .long __libc_csu_fini-.Llit
208.L3: .long main@GOT
209.L4: .long __libc_start_main@plt-.Llit
210.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
211#endif
212
213/* Define a symbol for the first piece of initialized data. */
214 .data
215 .globl __data_start
216__data_start:
217 .long 0
218 .weak data_start
219 data_start = __data_start
lib/libc/glibc/sysdeps/s390/s390-32/start.S deleted-212
......@@ -1,212 +0,0 @@
1/* Startup code compliant to the ELF s390 ABI.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36#include <sysdep.h>
37
38/*
39 This is the canonical entry point, usually the first thing in the text
40 segment. Most registers' values are unspecified, except for:
41
42 %r14 Contains a function pointer to be registered with `atexit'.
43 This is how the dynamic linker arranges to have DT_FINI
44 functions called for shared libraries that have been loaded
45 before this code runs.
46
47 %r15 The stack contains the arguments and environment:
48 0(%r15) argc
49 4(%r15) argv[0]
50 ...
51 (4*argc)(%r15) NULL
52 (4*(argc+1))(%r15) envp[0]
53 ...
54 NULL
55*/
56
57 .text
58 .globl _start
59 .type _start,@function
60_start:
61 cfi_startproc
62 /* Mark r14 as undefined in order to stop unwinding here! */
63 /* zig patch: r14 -> %r14. revert with llvm 20. */
64 cfi_undefined (%r14)
65
66 /* Check if the kernel provides highgprs facility if needed by
67 the binary. */
68
69 lr %r6,%r15
70 la %r6,4(%r6) /* Skip the argument counter. */
71
72.L11: l %r5,0(%r6) /* Skip the argument vector. */
73 la %r6,4(%r6)
74 ltr %r5,%r5
75 jne .L11
76
77.L12: l %r5,0(%r6) /* Skip the environment vector. */
78 la %r6,4(%r6)
79 ltr %r5,%r5
80 jne .L12
81
82 /* Usually the auxiliary vector can be expected directly after
83 the environment variables. But we have to skip extra zeros
84 because the loader might have removed insecure variables for
85 setuid programs. */
86
87.L26: l %r5,0(%r6)
88 la %r6,4(%r6)
89 ltr %r5,%r5
90 jz .L26
91
92 ahi %r6,-4
93
94 /* Obtain the needed values from the auxiliary vector. */
95
96 lhi %r7,16 /* AT_HWCAP */
97 lhi %r8,3 /* AT_PHDR */
98 lhi %r9,5 /* AT_PHNUM */
99 lhi %r2,4 /* AT_PHENT */
100.L13: l %r5,0(%r6)
101 clr %r5,%r7
102 jne .L15
103 l %r10,4(%r6) /* r10 = AT_HWCAP value. */
104.L15: clr %r5,%r8
105 jne .L16
106 l %r11,4(%r6) /* r11 = AT_PHDR value. */
107.L16: clr %r5,%r9
108 jne .L17
109 l %r12,4(%r6) /* r12 = AT_PHNUM value. */
110.L17: clr %r5,%r2
111 jne .L18
112 l %r0,4(%r6) /* r0 = AT_PHENT value. */
113.L18: ltr %r5,%r5
114 la %r6,8(%r6)
115 jnz .L13
116
117 /* Locate the ELF header by looking for the first PT_LOAD
118 segment with a p_offset of zero. */
119
120 lr %r4,%r11 /* Backup AT_PHDR. */
121 lhi %r7,1 /* PT_LOAD id */
122 lhi %r8,0
123.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
124 jne .L20
125 cl %r8,4(%r4) /* p_offset == 0? */
126 jne .L20
127 l %r9,8(%r4) /* r9 = PT_LOAD.p_vaddr <- ELF header address */
128 j .L24
129.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
130 brct %r12,.L19
131
132 j .+2 /* Trap, there must be such a phdr. */
133
134.L24: lr %r4,%r11 /* Backup AT_PHDR. */
135 lhi %r2,6 /* PT_PHDR id */
136.L23: cl %r2,0(%r4)
137 jne .L22
138 l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
139 j .L25
140.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
141 brct %r12,.L23
142
143 j .L14 /* No PT_PHDR found - skip checking. */
144
145.L25: slr %r11,%r3 /* AT_PHDR - PT_PHDR.p_vaddr (relocation offset)*/
146 alr %r9,%r11 /* PT_LOAD.p_vaddr += relocation offset */
147
148 l %r5,36(%r9) /* Load the e_flags field. */
149 tml %r5,1
150 jz .L14 /* Binary does not require highgprs facility. */
151
152 tml %r10,512 /* Check the AT_HWCAP value. */
153 jz 2 /* Trap if no highgprs facility available. */
154.L14:
155
156 /* Setup pointer to literal pool of _start */
157 basr %r13,0
158.L0: ahi %r13,.Llit-.L0
159
160 /* load argc and argv from stack */
161 la %r4,4(%r15) # get argv
162 l %r3,0(%r15) # get argc
163
164 /* align the stack to a double word boundary */
165 lhi %r0,-8
166 nr %r15,%r0
167
168 /* Setup a stack frame and a parameter area */
169 ahi %r15,-104 # make room on stack
170 xc 0(4,%r15),0(%r15) # clear back-chain
171
172 /* set up arguments for __libc_start_main:
173 main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
174 Note that envp will be determined later in __libc_start_main
175 */
176 stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
177 la %r7,96(%r15)
178 l %r2,.L3-.Llit(%r13) # load pointer to main
179 l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
180#ifdef PIC
181 l %r12,.L5-.Llit(%r13) # load .got pointer
182 la %r12,0(%r13,%r12)
183 l %r2,0(%r12,%r2)
184 la %r1,0(%r13,%r1)
185#endif
186 lhi %r6, 0 # Used to fini.
187 lhi %r5, 0 # Used to init.
188
189 /* ok, now branch to the libc main routine */
190 basr %r14,%r1
191
192 /* crash if __libc_start_main returns */
193 .word 0
194
195 cfi_endproc
196.Llit:
197#ifndef PIC
198.L3: .long main
199.L4: .long __libc_start_main
200#else
201.L3: .long main@GOT
202.L4: .long __libc_start_main@plt-.Llit
203.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
204#endif
205
206/* Define a symbol for the first piece of initialized data. */
207 .data
208 .globl __data_start
209__data_start:
210 .long 0
211 .weak data_start
212 data_start = __data_start
lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h deleted-21
......@@ -1,21 +0,0 @@
1/* Hacks needed for symbol manipulation. s390 version.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/wordsize-32/divdi3-symbol-hacks.h>
20
21#include_next "symbol-hacks.h"
lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h deleted-100
......@@ -1,100 +0,0 @@
1/* Assembler macros for s390.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* Syntactic details of assembler. */
24
25/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
26#define ALIGNARG(log2) 1<<log2
27#define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
28
29
30/* Define an entry point visible from C. */
31#define ENTRY(name) \
32 .globl C_SYMBOL_NAME(name); \
33 .type C_SYMBOL_NAME(name),@function; \
34 .align ALIGNARG(4); \
35 C_LABEL(name) \
36 cfi_startproc; \
37 CALL_MCOUNT
38
39#undef END
40#define END(name) \
41 cfi_endproc; \
42 ASM_SIZE_DIRECTIVE(name) \
43
44/* If compiled for profiling, call `mcount' at the start of each function. */
45#ifdef PROF
46#ifdef PIC
47#define CALL_MCOUNT \
48 lr 0,14 ; bras 14,.+12 ; .long _GLOBAL_OFFSET_TABLE_ - . ; .long 0f-. ; \
49 lr 1,14 ; al 1,4(14) ; al 14,0(14) ; l 14,_mcount@GOT(14) ; \
50 basr 14,14 ; lr 14,0 ; .data ; .align 4 ; 0: .long 0 ; .text ;
51#else
52#define CALL_MCOUNT \
53 lr 0,14 ; bras 14,.+12 ; .long _mcount ; .long 0f ; \
54 l 1,4(14) ; l 14,0(14) ; basr 14,14 ; lr 14,0 ; \
55 .data ; .align 4 ; 0: .long 0 ; .text ;
56#endif
57#else
58#define CALL_MCOUNT /* Do nothing. */
59#endif
60
61/* Since C identifiers are not normally prefixed with an underscore
62 on this system, the asm identifier `syscall_error' intrudes on the
63 C name space. Make sure we use an innocuous name. */
64#define syscall_error __syscall_error
65#define mcount _mcount
66
67#undef PSEUDO
68#define PSEUDO(name, syscall_name, args) \
69lose: SYSCALL_PIC_SETUP \
70 basr %r1,0; \
710: al %r1,1f-0b(%r1); \
72 br %r1; \
731: .long JUMPTARGET(syscall_error) - 0b; \
74 .globl syscall_error; \
75 ENTRY (name) \
76 DO_CALL (syscall_name, args); \
77 jm lose
78
79#undef PSEUDO_END
80#define PSEUDO_END(name) \
81 END (name)
82
83#undef JUMPTARGET
84#ifdef SHARED
85#define JUMPTARGET(name) name##@PLT
86#define SYSCALL_PIC_SETUP \
87 bras %r12,1f; \
880: .long _GLOBAL_OFFSET_TABLE_-0b; \
891: al %r12,0(%r12)
90#else
91#define JUMPTARGET(name) name
92#define SYSCALL_PIC_SETUP /* Nothing. */
93#endif
94
95/* Local label name for asm code. */
96#ifndef L
97#define L(name) .L##name
98#endif
99
100#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/sh/bits/endianness.h deleted-15
......@@ -1,15 +0,0 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* SH has selectable endianness. */
9#ifdef __LITTLE_ENDIAN__
10#define __BYTE_ORDER __LITTLE_ENDIAN
11#else
12#define __BYTE_ORDER __BIG_ENDIAN
13#endif
14
15#endif /* bits/endianness.h */
lib/libc/glibc/sysdeps/sh/crti.S deleted-122
......@@ -1,122 +0,0 @@
1/* Special .init and .fini section support for SH.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crti.S puts a function prologue at the beginning of the .init and
37 .fini sections and defines global symbols for those addresses, so
38 they can be called as functions. The symbols _init and _fini are
39 magic and cause the linker to emit DT_INIT and DT_FINI. */
40
41#include <libc-symbols.h>
42#include <sysdep.h>
43
44#ifndef PREINIT_FUNCTION
45# define PREINIT_FUNCTION __gmon_start__
46#endif
47
48#ifndef PREINIT_FUNCTION_WEAK
49# define PREINIT_FUNCTION_WEAK 1
50#endif
51
52#if PREINIT_FUNCTION_WEAK
53 weak_extern (PREINIT_FUNCTION)
54#else
55 .hidden PREINIT_FUNCTION
56#endif
57
58 .section .init,"ax",@progbits
59 .align 5
60 .global _init
61 .hidden _init
62 .type _init, @function
63_init:
64 mov.l r12,@-r15
65 mova .L12,r0
66 mov.l .L12,r12
67 mov.l r14,@-r15
68 add r0,r12
69 sts.l pr,@-r15
70#if PREINIT_FUNCTION_WEAK
71 mov.l .L13,r0
72 mov.l @(r0,r12),r1
73 tst r1,r1
74 bt/s .L8
75 mov r15,r14
76 mov.l .L14,r1
77 bsrf r1
78.LPCS0:
79 nop
80.L8:
81#else
82 mova .L13,r0
83 mov.l .L13,r1
84 add r0,r1
85 jsr @r1
86 mov r15,r14
87#endif
88 bra 1f
89 nop
90 .align 2
91.L12:
92 .long _GLOBAL_OFFSET_TABLE_
93#if PREINIT_FUNCTION_WEAK
94.L13:
95 .long PREINIT_FUNCTION@GOT
96.L14:
97 .long PREINIT_FUNCTION@PLT-(.LPCS0+2-(.))
98#else
99.L13:
100 .long PREINIT_FUNCTION@PLT
101#endif
1021:
103
104 .section .fini,"ax",@progbits
105 .align 5
106 .global _fini
107 .hidden _fini
108 .type _fini, @function
109_fini:
110 mov.l r12,@-r15
111 mova .L19,r0
112 mov.l r14,@-r15
113 sts.l pr,@-r15
114 mov.l .L19,r12
115 mov r15,r14
116 add r0,r12
117 bra 0f
118 nop
119 .align 2
120.L19:
121 .long _GLOBAL_OFFSET_TABLE_
1220:
lib/libc/glibc/sysdeps/sh/crtn.S deleted-53
......@@ -1,53 +0,0 @@
1/* Special .init and .fini section support for SH.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* crtn.S puts function epilogues in the .init and .fini sections
37 corresponding to the prologues in crti.S. */
38
39 .section .init,"ax",@progbits
40 mov r14,r15
41 lds.l @r15+,pr
42 mov.l @r15+,r14
43 mov.l @r15+,r12
44 rts
45 nop
46
47 .section .fini,"ax",@progbits
48 mov r14,r15
49 lds.l @r15+,pr
50 mov.l @r15+,r14
51 mov.l @r15+,r12
52 rts
53 nop
lib/libc/glibc/sysdeps/sh/start-2.33.S deleted-111
......@@ -1,111 +0,0 @@
1/* Startup code for SH & ELF.
2 Copyright (C) 1999-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* This is the canonical entry point, usually the first thing in the text
37 segment.
38
39 Note that the code in the .init section has already been run.
40 This includes _init and _libc_init
41
42
43 At this entry point, most registers' values are unspecified, except:
44
45 r4 Contains a function pointer to be registered with `atexit'.
46 This is how the dynamic linker arranges to have DT_FINI
47 functions called for shared libraries that have been loaded
48 before this code runs.
49
50 sp The stack contains the arguments and environment:
51 0(sp) argc
52 4(sp) argv[0]
53 ...
54 (4*argc)(sp) NULL
55 (4*(argc+1))(sp) envp[0]
56 ...
57 NULL
58*/
59
60 .text
61 .globl _start
62 .type _start,@function
63_start:
64 /* Clear the frame pointer since this is the outermost frame. */
65 mov #0, r14
66
67 /* Pop argc off the stack and save a pointer to argv */
68 mov.l @r15+,r5
69 mov r15, r6
70
71 /* Push the last arguments to main() onto the stack */
72 mov.l r4,@-r15
73 mov.l L_fini,r0
74 mov.l r0,@-r15
75
76 /* Set up the other arguments for main() that go in registers */
77 mov.l L_main,r4
78 mov.l L_init,r7
79
80 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
81
82 /* Let the libc call main and exit with its return code. */
83 mov.l L_libc_start_main,r1
84 jsr @r1
85 nop
86 /* should never get here....*/
87 mov.l L_abort,r1
88 jsr @r1
89 nop
90 .align 2
91L_main:
92 .long main
93L_init:
94 .long __libc_csu_init
95L_fini:
96 .long __libc_csu_fini
97L_libc_start_main:
98 .long __libc_start_main
99L_abort:
100 .long abort
101/* Define a symbol for the first piece of initialized data. */
102 .data
103 .globl __data_start
104__data_start:
105 .long 0
106 .weak data_start
107 data_start = __data_start
108 .global __fpscr_values
109__fpscr_values:
110 .long 0
111 .long 0x80000
lib/libc/glibc/sysdeps/sh/start.S deleted-106
......@@ -1,106 +0,0 @@
1/* Startup code for SH & ELF.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
18
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
26
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
31
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, see
34 <https://www.gnu.org/licenses/>. */
35
36/* This is the canonical entry point, usually the first thing in the text
37 segment.
38
39 Note that the code in the .init section has already been run.
40 This includes _init and _libc_init
41
42
43 At this entry point, most registers' values are unspecified, except:
44
45 r4 Contains a function pointer to be registered with `atexit'.
46 This is how the dynamic linker arranges to have DT_FINI
47 functions called for shared libraries that have been loaded
48 before this code runs.
49
50 sp The stack contains the arguments and environment:
51 0(sp) argc
52 4(sp) argv[0]
53 ...
54 (4*argc)(sp) NULL
55 (4*(argc+1))(sp) envp[0]
56 ...
57 NULL
58*/
59
60 .text
61 .globl _start
62 .type _start,@function
63_start:
64 /* Clear the frame pointer since this is the outermost frame. */
65 mov #0, r14
66
67 /* Pop argc off the stack and save a pointer to argv */
68 mov.l @r15+,r5
69 mov r15, r6
70
71 /* Push the last arguments to main() onto the stack */
72 mov.l r4,@-r15
73 mov.l r14,@-r15 /* Used to be fini. */
74
75 /* Set up the other arguments for main() that go in registers */
76 mov.l L_main,r4
77 mov #0,r7 /* Used to be init. */
78
79 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
80
81 /* Let the libc call main and exit with its return code. */
82 mov.l L_libc_start_main,r1
83 jsr @r1
84 nop
85 /* should never get here....*/
86 mov.l L_abort,r1
87 jsr @r1
88 nop
89 .align 2
90L_main:
91 .long main
92L_libc_start_main:
93 .long __libc_start_main
94L_abort:
95 .long abort
96/* Define a symbol for the first piece of initialized data. */
97 .data
98 .globl __data_start
99__data_start:
100 .long 0
101 .weak data_start
102 data_start = __data_start
103 .global __fpscr_values
104__fpscr_values:
105 .long 0
106 .long 0x80000
lib/libc/glibc/sysdeps/sh/sysdep.h deleted-75
......@@ -1,75 +0,0 @@
1/* Assembler macros for SH.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* Syntactic details of assembler. */
24
25#define ALIGNARG(log2) log2
26#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
27
28#ifdef SHARED
29#define PLTJMP(_x) _x##@PLT
30#else
31#define PLTJMP(_x) _x
32#endif
33
34
35/* Define an entry point visible from C. */
36#define ENTRY(name) \
37 .globl C_SYMBOL_NAME(name); \
38 .type C_SYMBOL_NAME(name),@function; \
39 .align ALIGNARG(5); \
40 C_LABEL(name) \
41 cfi_startproc; \
42 CALL_MCOUNT
43
44#undef END
45#define END(name) \
46 cfi_endproc; \
47 ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
48
49/* If compiled for profiling, call `mcount' at the start of each function. */
50#ifdef PROF
51#define CALL_MCOUNT \
52 mov.l 1f,r1; \
53 sts.l pr,@-r15; \
54 cfi_adjust_cfa_offset (4); \
55 cfi_rel_offset (pr, 0); \
56 mova 2f,r0; \
57 jmp @r1; \
58 lds r0,pr; \
59 .align 2; \
601: .long mcount; \
612: lds.l @r15+,pr; \
62 cfi_adjust_cfa_offset (-4); \
63 cfi_restore (pr)
64
65#else
66#define CALL_MCOUNT /* Do nothing. */
67#endif
68
69/* Since C identifiers are not normally prefixed with an underscore
70 on this system, the asm identifier `syscall_error' intrudes on the
71 C name space. Make sure we use an innocuous name. */
72#define syscall_error __syscall_error
73#define mcount _mcount
74
75#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h deleted-83
......@@ -1,83 +0,0 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES_H
20# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
21#endif
22
23#ifndef _BITS_TYPESIZES_H
24#define _BITS_TYPESIZES_H 1
25
26/* See <bits/types.h> for the meaning of these macros. This file exists so
27 that <bits/types.h> need not vary across different GNU platforms. */
28
29#define __DEV_T_TYPE __U64_TYPE
30#define __UID_T_TYPE __U32_TYPE
31#define __GID_T_TYPE __U32_TYPE
32#define __INO_T_TYPE __U32_TYPE
33#define __INO64_T_TYPE __U64_TYPE
34#define __MODE_T_TYPE __U32_TYPE
35#define __NLINK_T_TYPE __U32_TYPE
36#define __OFF_T_TYPE __SLONGWORD_TYPE
37#define __OFF64_T_TYPE __S64_TYPE
38#define __PID_T_TYPE __S32_TYPE
39#define __RLIM_T_TYPE __ULONGWORD_TYPE
40#define __RLIM64_T_TYPE __U64_TYPE
41#define __BLKCNT_T_TYPE __U32_TYPE
42#define __BLKCNT64_T_TYPE __U64_TYPE
43#define __FSBLKCNT_T_TYPE __S32_TYPE
44#define __FSBLKCNT64_T_TYPE __S64_TYPE
45#define __FSFILCNT_T_TYPE __U32_TYPE
46#define __FSFILCNT64_T_TYPE __U64_TYPE
47#define __ID_T_TYPE __U32_TYPE
48#define __CLOCK_T_TYPE __SLONGWORD_TYPE
49#define __TIME_T_TYPE __SLONGWORD_TYPE
50#define __USECONDS_T_TYPE __U32_TYPE
51#define __SUSECONDS_T_TYPE __S64_TYPE
52#define __SUSECONDS64_T_TYPE __S64_TYPE
53#define __DADDR_T_TYPE __S32_TYPE
54#define __KEY_T_TYPE __S32_TYPE
55#define __CLOCKID_T_TYPE __S32_TYPE
56#define __TIMER_T_TYPE void *
57#define __BLKSIZE_T_TYPE __U32_TYPE
58#define __FSID_T_TYPE struct { int __val[2]; }
59#define __SSIZE_T_TYPE __SWORD_TYPE
60#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
61#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
62#define __CPU_MASK_TYPE __ULONGWORD_TYPE
63#define __FSWORD_T_TYPE __S32_TYPE
64
65/* Tell the libc code that off_t and off64_t are actually the same type
66 for all ABI purposes, even if possibly expressed as different base types
67 for C type-checking purposes. */
68#define __OFF_T_MATCHES_OFF64_T 1
69
70/* And for __rlim_t and __rlim64_t. */
71#define __RLIM_T_MATCHES_RLIM64_T 1
72
73/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
74# define __STATFS_MATCHES_STATFS64 0
75
76/* And for getitimer, setitimer and rusage */
77#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
78
79/* Number of descriptors that can fit in an `fd_set'. */
80#define __FD_SETSIZE 1024
81
82
83#endif /* bits/typesizes.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h deleted-57
......@@ -1,57 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _KERNEL_FEATURES_H
21#define _KERNEL_FEATURES_H 1
22
23#include_next <kernel-features.h>
24
25/* Support for statfs64 was added in 5.1. */
26#if __LINUX_KERNEL_VERSION < 0x050100
27# undef __ASSUME_STATFS64
28# define __ASSUME_STATFS64 0
29#endif
30
31#define __ASSUME_RECV_SYSCALL 1
32#define __ASSUME_SEND_SYSCALL 1
33
34/* Support for the renameat2 syscall was added in 3.17. */
35#if __LINUX_KERNEL_VERSION < 0x031100
36# undef __ASSUME_RENAMEAT2
37#endif
38
39/* Support for the execveat syscall was added in 4.2. */
40#if __LINUX_KERNEL_VERSION < 0x040200
41# undef __ASSUME_EXECVEAT
42#endif
43
44/* Support for copy_file_range, statx was added in kernel 4.13. */
45#if __LINUX_KERNEL_VERSION < 0x040D00
46# undef __ASSUME_MLOCK2
47# undef __ASSUME_STATX
48#endif
49
50/* Alpha requires old sysvipc even being a 64-bit architecture. */
51#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
52
53/* Alpha does not provide clone3. */
54#undef __ASSUME_CLONE3
55#define __ASSUME_CLONE3 0
56
57#endif /* _KERNEL_FEATURES_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h deleted-316
......@@ -1,316 +0,0 @@
1/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_ALPHA_SYSDEP_H
19#define _LINUX_ALPHA_SYSDEP_H 1
20
21/* There is some commonality. */
22#include <sysdeps/unix/sysv/linux/sysdep.h>
23#include <sysdeps/unix/sysdep.h>
24#include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
25
26#include <tls.h>
27
28/* For Linux we can use the system call table in the header file
29 /usr/include/asm/unistd.h
30 of the kernel. But these symbols do not follow the SYS_* syntax
31 so we have to redefine the `SYS_ify' macro here. */
32#undef SYS_ify
33#define SYS_ify(syscall_name) __NR_##syscall_name
34
35#ifdef __ASSEMBLER__
36#include <asm/pal.h>
37#include <alpha/regdef.h>
38
39#define __LABEL(x) x##:
40
41#define LEAF(name, framesize) \
42 .globl name; \
43 .align 4; \
44 .ent name, 0; \
45 __LABEL(name) \
46 .frame sp, framesize, ra
47
48#define ENTRY(name) \
49 .globl name; \
50 .align 4; \
51 .ent name, 0; \
52 __LABEL(name) \
53 .frame sp, 0, ra
54
55/* Mark the end of function SYM. */
56#undef END
57#define END(sym) .end sym
58
59#ifdef PROF
60# define PSEUDO_PROF \
61 .set noat; \
62 lda AT, _mcount; \
63 jsr AT, (AT), _mcount; \
64 .set at
65#else
66# define PSEUDO_PROF
67#endif
68
69#ifdef PROF
70# define PSEUDO_PROLOGUE \
71 .frame sp, 0, ra; \
72 ldgp gp,0(pv); \
73 PSEUDO_PROF; \
74 .prologue 1
75#elif defined PIC
76# define PSEUDO_PROLOGUE \
77 .frame sp, 0, ra; \
78 .prologue 0
79#else
80# define PSEUDO_PROLOGUE \
81 .frame sp, 0, ra; \
82 ldgp gp,0(pv); \
83 .prologue 1
84#endif /* PROF */
85
86#ifdef PROF
87# define USEPV_PROF std
88#else
89# define USEPV_PROF no
90#endif
91
92#undef SYSCALL_ERROR_LABEL
93#if RTLD_PRIVATE_ERRNO
94# define SYSCALL_ERROR_LABEL $syscall_error
95# define SYSCALL_ERROR_HANDLER \
96$syscall_error: \
97 stl v0, rtld_errno(gp) !gprel; \
98 lda v0, -1; \
99 ret
100# define SYSCALL_ERROR_FALLTHRU
101#elif defined(PIC)
102# define SYSCALL_ERROR_LABEL __syscall_error !samegp
103# define SYSCALL_ERROR_HANDLER
104# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
105#else
106# define SYSCALL_ERROR_LABEL $syscall_error
107# define SYSCALL_ERROR_HANDLER \
108$syscall_error: \
109 jmp $31, __syscall_error
110# define SYSCALL_ERROR_FALLTHRU
111#endif /* RTLD_PRIVATE_ERRNO */
112
113/* Overridden by specific syscalls. */
114#undef PSEUDO_PREPARE_ARGS
115#define PSEUDO_PREPARE_ARGS /* Nothing. */
116
117#define PSEUDO(name, syscall_name, args) \
118 .globl name; \
119 .align 4; \
120 .ent name,0; \
121__LABEL(name) \
122 PSEUDO_PROLOGUE; \
123 PSEUDO_PREPARE_ARGS \
124 lda v0, SYS_ify(syscall_name); \
125 call_pal PAL_callsys; \
126 bne a3, SYSCALL_ERROR_LABEL
127
128#undef PSEUDO_END
129#define PSEUDO_END(sym) \
130 SYSCALL_ERROR_HANDLER; \
131 END(sym)
132
133#define PSEUDO_NOERRNO(name, syscall_name, args) \
134 .globl name; \
135 .align 4; \
136 .ent name,0; \
137__LABEL(name) \
138 PSEUDO_PROLOGUE; \
139 PSEUDO_PREPARE_ARGS \
140 lda v0, SYS_ify(syscall_name); \
141 call_pal PAL_callsys;
142
143#undef PSEUDO_END_NOERRNO
144#define PSEUDO_END_NOERRNO(sym) END(sym)
145
146#define ret_NOERRNO ret
147
148#define PSEUDO_ERRVAL(name, syscall_name, args) \
149 .globl name; \
150 .align 4; \
151 .ent name,0; \
152__LABEL(name) \
153 PSEUDO_PROLOGUE; \
154 PSEUDO_PREPARE_ARGS \
155 lda v0, SYS_ify(syscall_name); \
156 call_pal PAL_callsys;
157
158#undef PSEUDO_END_ERRVAL
159#define PSEUDO_END_ERRVAL(sym) END(sym)
160
161#define ret_ERRVAL ret
162
163#define r0 v0
164#define r1 a4
165
166#define MOVE(x,y) mov x,y
167
168#else /* !ASSEMBLER */
169
170#define INTERNAL_SYSCALL(name, nr, args...) \
171 internal_syscall##nr(__NR_##name, args)
172
173#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
174 internal_syscall##nr(name, args)
175
176/* The normal Alpha calling convention sign-extends 32-bit quantties
177 no matter what the "real" sign of the 32-bit type. We want to
178 preserve that when filling in values for the kernel. */
179#define syscall_promote(arg) \
180 (sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
181
182#define internal_syscall_clobbers \
183 "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
184 "$22", "$23", "$24", "$25", "$27", "$28", "memory"
185
186/* It is moderately important optimization-wise to limit the lifetime
187 of the hard-register variables as much as possible. Thus we copy
188 in/out as close to the asm as possible. */
189
190#define internal_syscall0(name, args...) \
191({ \
192 register long int _sc_19 __asm__("$19"); \
193 register long int _sc_0 = name; \
194 __asm__ __volatile__ \
195 ("callsys # %0 %1 <= %2" \
196 : "+v"(_sc_0), "=r"(_sc_19) \
197 : : internal_syscall_clobbers, \
198 "$16", "$17", "$18", "$20", "$21"); \
199 _sc_19 != 0 ? -_sc_0 : _sc_0; \
200})
201
202#define internal_syscall1(name,arg1) \
203({ \
204 register long int _tmp_16 = syscall_promote (arg1); \
205 register long int _sc_0 = name; \
206 register long int _sc_16 __asm__("$16") = _tmp_16; \
207 register long int _sc_19 __asm__("$19"); \
208 __asm__ __volatile__ \
209 ("callsys # %0 %1 <= %2 %3" \
210 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
211 : : internal_syscall_clobbers, \
212 "$17", "$18", "$20", "$21"); \
213 _sc_19 != 0 ? -_sc_0 : _sc_0; \
214})
215
216#define internal_syscall2(name,arg1,arg2) \
217({ \
218 register long int _tmp_16 = syscall_promote (arg1); \
219 register long int _tmp_17 = syscall_promote (arg2); \
220 register long int _sc_0 = name; \
221 register long int _sc_16 __asm__("$16") = _tmp_16; \
222 register long int _sc_17 __asm__("$17") = _tmp_17; \
223 register long int _sc_19 __asm__("$19"); \
224 __asm__ __volatile__ \
225 ("callsys # %0 %1 <= %2 %3 %4" \
226 : "+v"(_sc_0), "=r"(_sc_19), \
227 "+r"(_sc_16), "+r"(_sc_17) \
228 : : internal_syscall_clobbers, \
229 "$18", "$20", "$21"); \
230 _sc_19 != 0 ? -_sc_0 : _sc_0; \
231})
232
233#define internal_syscall3(name,arg1,arg2,arg3) \
234({ \
235 register long int _tmp_16 = syscall_promote (arg1); \
236 register long int _tmp_17 = syscall_promote (arg2); \
237 register long int _tmp_18 = syscall_promote (arg3); \
238 register long int _sc_0 = name; \
239 register long int _sc_16 __asm__("$16") = _tmp_16; \
240 register long int _sc_17 __asm__("$17") = _tmp_17; \
241 register long int _sc_18 __asm__("$18") = _tmp_18; \
242 register long int _sc_19 __asm__("$19"); \
243 __asm__ __volatile__ \
244 ("callsys # %0 %1 <= %2 %3 %4 %5" \
245 : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
246 "+r"(_sc_17), "+r"(_sc_18) \
247 : : internal_syscall_clobbers, "$20", "$21"); \
248 _sc_19 != 0 ? -_sc_0 : _sc_0; \
249})
250
251#define internal_syscall4(name,arg1,arg2,arg3,arg4) \
252({ \
253 register long int _tmp_16 = syscall_promote (arg1); \
254 register long int _tmp_17 = syscall_promote (arg2); \
255 register long int _tmp_18 = syscall_promote (arg3); \
256 register long int _tmp_19 = syscall_promote (arg4); \
257 register long int _sc_0 = name; \
258 register long int _sc_16 __asm__("$16") = _tmp_16; \
259 register long int _sc_17 __asm__("$17") = _tmp_17; \
260 register long int _sc_18 __asm__("$18") = _tmp_18; \
261 register long int _sc_19 __asm__("$19") = _tmp_19; \
262 __asm__ __volatile__ \
263 ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
264 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
265 "+r"(_sc_17), "+r"(_sc_18) \
266 : : internal_syscall_clobbers, "$20", "$21"); \
267 _sc_19 != 0 ? -_sc_0 : _sc_0; \
268})
269
270#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
271({ \
272 register long int _tmp_16 = syscall_promote (arg1); \
273 register long int _tmp_17 = syscall_promote (arg2); \
274 register long int _tmp_18 = syscall_promote (arg3); \
275 register long int _tmp_19 = syscall_promote (arg4); \
276 register long int _tmp_20 = syscall_promote (arg5); \
277 register long int _sc_0 = name; \
278 register long int _sc_16 __asm__("$16") = _tmp_16; \
279 register long int _sc_17 __asm__("$17") = _tmp_17; \
280 register long int _sc_18 __asm__("$18") = _tmp_18; \
281 register long int _sc_19 __asm__("$19") = _tmp_19; \
282 register long int _sc_20 __asm__("$20") = _tmp_20; \
283 __asm__ __volatile__ \
284 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
285 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
286 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
287 : : internal_syscall_clobbers, "$21"); \
288 _sc_19 != 0 ? -_sc_0 : _sc_0; \
289})
290
291#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
292({ \
293 register long int _tmp_16 = syscall_promote (arg1); \
294 register long int _tmp_17 = syscall_promote (arg2); \
295 register long int _tmp_18 = syscall_promote (arg3); \
296 register long int _tmp_19 = syscall_promote (arg4); \
297 register long int _tmp_20 = syscall_promote (arg5); \
298 register long int _tmp_21 = syscall_promote (arg6); \
299 register long int _sc_0 = name; \
300 register long int _sc_16 __asm__("$16") = _tmp_16; \
301 register long int _sc_17 __asm__("$17") = _tmp_17; \
302 register long int _sc_18 __asm__("$18") = _tmp_18; \
303 register long int _sc_19 __asm__("$19") = _tmp_19; \
304 register long int _sc_20 __asm__("$20") = _tmp_20; \
305 register long int _sc_21 __asm__("$21") = _tmp_21; \
306 __asm__ __volatile__ \
307 ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
308 : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
309 "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
310 "+r"(_sc_21) \
311 : : internal_syscall_clobbers); \
312 _sc_19 != 0 ? -_sc_0 : _sc_0; \
313})
314#endif /* ASSEMBLER */
315
316#endif /* _LINUX_ALPHA_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/xstatver.h deleted-14
......@@ -1,14 +0,0 @@
1/* Versions of the 'struct stat' data structure used in compatibility xstat
2 functions. */
3#define _STAT_VER_KERNEL 0
4#define _STAT_VER_GLIBC2 1
5#define _STAT_VER_GLIBC2_1 2
6#define _STAT_VER_KERNEL64 3
7#define _STAT_VER_GLIBC2_3_4 3
8#define _STAT_VER_LINUX 3
9#define _STAT_VER _STAT_VER_LINUX
10
11/* Versions of the 'xmknod' interface used in compatibility xmknod
12 functions. */
13#define _MKNOD_VER_LINUX 0
14#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h deleted-35
......@@ -1,35 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 2006-2024 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
19
20
21#include_next <kernel-features.h>
22
23#define __ASSUME_RECV_SYSCALL 1
24#define __ASSUME_SEND_SYSCALL 1
25
26/* Support for the execveat syscall was added in 4.0. */
27#if __LINUX_KERNEL_VERSION < 0x040000
28# undef __ASSUME_EXECVEAT
29#endif
30
31#undef __ASSUME_CLONE_DEFAULT
32#define __ASSUME_CLONE_BACKWARDS 1
33
34/* QEMU does not support set_robust_list. */
35#undef __ASSUME_SET_ROBUST_LIST
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h deleted-482
......@@ -1,482 +0,0 @@
1/* Assembler macros for PA-RISC.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LINUX_HPPA_SYSDEP_H
20#define _LINUX_HPPA_SYSDEP_H 1
21
22#include <sysdeps/unix/sysdep.h>
23#include <sysdeps/unix/sysv/linux/sysdep.h>
24#include <sysdeps/hppa/sysdep.h>
25
26/* Defines RTLD_PRIVATE_ERRNO. */
27#include <dl-sysdep.h>
28
29#include <tls.h>
30
31/* In order to get __set_errno() definition in INLINE_SYSCALL. */
32#ifndef __ASSEMBLER__
33#include <errno.h>
34#endif
35
36#undef ASM_LINE_SEP
37#define ASM_LINE_SEP !
38
39#undef SYS_ify
40#define SYS_ify(syscall_name) (__NR_##syscall_name)
41
42/* The vfork, fork, and clone syscalls clobber r19
43 * and r21. We list r21 as either clobbered or as an
44 * input to a 6-argument syscall. We must save and
45 * restore r19 in both PIC and non-PIC cases.
46 */
47/* WARNING: TREG must be a callee saves register so
48 that it doesn't have to be restored after a call
49 to another function */
50#define TREG 4
51#define SAVE_PIC(SREG) \
52 copy %r19, SREG
53#define LOAD_PIC(LREG) \
54 copy LREG , %r19
55/* Inline assembly defines */
56#define TREG_ASM "%r4" /* Can't clobber r3, it holds framemarker */
57#define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n"
58#define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n"
59#define CLOB_TREG TREG_ASM ,
60#define PIC_REG_DEF register unsigned long __r19 asm("r19");
61#define PIC_REG_USE , "r" (__r19)
62
63#ifdef __ASSEMBLER__
64
65/* Syntactic details of assembler. */
66
67#define ALIGNARG(log2) log2
68
69/* For Linux we can use the system call table in the header file
70 /usr/include/asm/unistd.h
71 of the kernel. But these symbols do not follow the SYS_* syntax
72 so we have to redefine the `SYS_ify' macro here. */
73#undef SYS_ify
74#define SYS_ify(syscall_name) __NR_##syscall_name
75
76/* ELF-like local names start with `.L'. */
77#undef L
78#define L(name) .L##name
79
80/* Linux uses a negative return value to indicate syscall errors,
81 unlike most Unices, which use the condition codes' carry flag.
82
83 Since version 2.1 the return value of a system call might be
84 negative even if the call succeeded. E.g., the `lseek' system call
85 might return a large offset. Therefore we must not anymore test
86 for < 0, but test for a real error by making sure the value in %eax
87 is a real error number. Linus said he will make sure the no syscall
88 returns a value in -1 .. -4095 as a valid result so we can safely
89 test with -4095. */
90
91/* We don't want the label for the error handle to be global when we define
92 it here. */
93/*#ifdef PIC
94# define SYSCALL_ERROR_LABEL 0f
95#else
96# define SYSCALL_ERROR_LABEL syscall_error
97#endif*/
98
99/* Argument manipulation from the stack for preparing to
100 make a syscall */
101
102#define DOARGS_0 /* nothing */
103#define DOARGS_1 /* nothing */
104#define DOARGS_2 /* nothing */
105#define DOARGS_3 /* nothing */
106#define DOARGS_4 /* nothing */
107#define DOARGS_5 ldw -52(%sp), %r22 ASM_LINE_SEP
108#define DOARGS_6 DOARGS_5 ldw -56(%sp), %r21 ASM_LINE_SEP
109
110#define UNDOARGS_0 /* nothing */
111#define UNDOARGS_1 /* nothing */
112#define UNDOARGS_2 /* nothing */
113#define UNDOARGS_3 /* nothing */
114#define UNDOARGS_4 /* nothing */
115#define UNDOARGS_5 /* nothing */
116#define UNDOARGS_6 /* nothing */
117
118/* Define an entry point visible from C.
119
120 There is currently a bug in gdb which prevents us from specifying
121 incomplete stabs information. Fake some entries here which specify
122 the current source file. */
123#undef ENTRY
124#define ENTRY(name) \
125 .text ASM_LINE_SEP \
126 .align ALIGNARG(4) ASM_LINE_SEP \
127 .export C_SYMBOL_NAME(name) ASM_LINE_SEP \
128 .type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
129 cfi_startproc ASM_LINE_SEP \
130 C_LABEL(name) ASM_LINE_SEP \
131 .PROC ASM_LINE_SEP \
132 .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
133 .ENTRY ASM_LINE_SEP \
134 /* SAVE_RP says we do */ ASM_LINE_SEP \
135 stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
136 .cfi_offset 2, -20 ASM_LINE_SEP \
137 /*FIXME: Call mcount? (careful with stack!) */
138
139/* Some syscall wrappers do not call other functions, and
140 hence are classified as leaf, so add NO_CALLS for gdb */
141#define ENTRY_LEAF(name) \
142 .text ASM_LINE_SEP \
143 .align ALIGNARG(4) ASM_LINE_SEP \
144 .export C_SYMBOL_NAME(name) ASM_LINE_SEP \
145 .type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
146 cfi_startproc ASM_LINE_SEP \
147 C_LABEL(name) ASM_LINE_SEP \
148 .PROC ASM_LINE_SEP \
149 .CALLINFO FRAME=64,NO_CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
150 .ENTRY ASM_LINE_SEP \
151 /* SAVE_RP says we do */ ASM_LINE_SEP \
152 stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
153 .cfi_offset 2, -20 ASM_LINE_SEP \
154 /*FIXME: Call mcount? (careful with stack!) */
155
156#undef END
157#define END(name) \
158 .EXIT ASM_LINE_SEP \
159 .PROCEND ASM_LINE_SEP \
160 cfi_endproc ASM_LINE_SEP \
161.size C_SYMBOL_NAME(name), .-C_SYMBOL_NAME(name) ASM_LINE_SEP
162
163/* If compiled for profiling, call `mcount' at the start
164 of each function. No, don't bother. gcc will put the
165 call in for us. */
166#define CALL_MCOUNT /* Do nothing. */
167
168/* syscall wrappers consist of
169 #include <sysdep.h>
170 PSEUDO(...)
171 ret
172 PSEUDO_END(...)
173
174 which means
175 ENTRY(name)
176 DO_CALL(...)
177 bv,n 0(2)
178*/
179
180#undef PSEUDO
181#define PSEUDO(name, syscall_name, args) \
182 ENTRY (name) ASM_LINE_SEP \
183 /* If necc. load args from stack */ ASM_LINE_SEP \
184 DOARGS_##args ASM_LINE_SEP \
185 DO_CALL (syscall_name, args) ASM_LINE_SEP \
186 UNDOARGS_##args ASM_LINE_SEP
187
188#define ret \
189 /* Return value set by ERRNO code */ ASM_LINE_SEP \
190 bv,n 0(2) ASM_LINE_SEP
191
192#undef PSEUDO_END
193#define PSEUDO_END(name) \
194 END (name)
195
196/* We don't set the errno on the return from the syscall */
197#define PSEUDO_NOERRNO(name, syscall_name, args) \
198 ENTRY_LEAF (name) ASM_LINE_SEP \
199 DOARGS_##args ASM_LINE_SEP \
200 DO_CALL_NOERRNO (syscall_name, args) ASM_LINE_SEP \
201 UNDOARGS_##args ASM_LINE_SEP
202
203#define ret_NOERRNO ret
204
205#undef PSEUDO_END_NOERRNO
206#define PSEUDO_END_NOERRNO(name) \
207 END (name)
208
209/* This has to return the error value */
210#undef PSEUDO_ERRVAL
211#define PSEUDO_ERRVAL(name, syscall_name, args) \
212 ENTRY_LEAF (name) ASM_LINE_SEP \
213 DOARGS_##args ASM_LINE_SEP \
214 DO_CALL_ERRVAL (syscall_name, args) ASM_LINE_SEP \
215 UNDOARGS_##args ASM_LINE_SEP
216
217#define ret_ERRVAL ret
218
219#undef PSEUDO_END_ERRVAL
220#define PSEUDO_END_ERRVAL(name) \
221 END(name)
222
223#undef JUMPTARGET
224#define JUMPTARGET(name) name
225#define SYSCALL_PIC_SETUP /* Nothing. */
226
227
228/* FIXME: This comment is not true.
229 * All the syscall assembly macros rely on finding the appropriate
230 SYSCALL_ERROR_LABEL or rather HANDLER. */
231
232/* int * __errno_location(void) so you have to store your value
233 into the return address! */
234#define DEFAULT_SYSCALL_ERROR_HANDLER \
235 .import __errno_location,code ASM_LINE_SEP \
236 /* branch to errno handler */ ASM_LINE_SEP \
237 bl __errno_location,%rp ASM_LINE_SEP
238
239/* Here are the myriad of configuration options that the above can
240 work for... what we've done is provide the framework for future
241 changes if required to each section */
242
243#ifdef PIC
244# if RTLD_PRIVATE_ERRNO
245# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
246# else /* !RTLD_PRIVATE_ERRNO */
247# if defined _LIBC_REENTRANT
248# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
249# else /* !_LIBC_REENTRANT */
250# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
251# endif /* _LIBC_REENTRANT */
252# endif /* RTLD_PRIVATE_ERRNO */
253#else
254# ifndef _LIBC_REENTRANT
255# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
256# else
257# define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
258# endif
259#endif
260
261
262/* Linux takes system call arguments in registers:
263 syscall number gr20
264 arg 1 gr26
265 arg 2 gr25
266 arg 3 gr24
267 arg 4 gr23
268 arg 5 gr22
269 arg 6 gr21
270
271 The compiler calls us by the C convention:
272 syscall number in the DO_CALL macro
273 arg 1 gr26
274 arg 2 gr25
275 arg 3 gr24
276 arg 4 gr23
277 arg 5 -52(sp)
278 arg 6 -56(sp)
279
280 gr22 and gr21 are caller-saves, so we can just load the arguments
281 there and generally be happy. */
282
283/* the cmpb...no_error code below inside DO_CALL
284 * is intended to mimic the if (__sys_res...)
285 * code inside INLINE_SYSCALL
286 */
287#define NO_ERROR -0x1000
288
289#undef DO_CALL
290#define DO_CALL(syscall_name, args) \
291 /* Create a frame */ ASM_LINE_SEP \
292 stwm TREG, 64(%sp) ASM_LINE_SEP \
293 .cfi_def_cfa_offset -64 ASM_LINE_SEP \
294 .cfi_offset TREG, 0 ASM_LINE_SEP \
295 stw %sp, -4(%sp) ASM_LINE_SEP \
296 stw %r19, -32(%sp) ASM_LINE_SEP \
297 .cfi_offset 19, 32 ASM_LINE_SEP \
298 /* Save r19 */ ASM_LINE_SEP \
299 SAVE_PIC(TREG) ASM_LINE_SEP \
300 /* Do syscall, delay loads # */ ASM_LINE_SEP \
301 ble 0x100(%sr2,%r0) ASM_LINE_SEP \
302 ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
303 ldi NO_ERROR,%r1 ASM_LINE_SEP \
304 cmpb,>>=,n %r1,%ret0,L(pre_end) ASM_LINE_SEP \
305 /* Restore r19 from TREG */ ASM_LINE_SEP \
306 LOAD_PIC(TREG) /* delay */ ASM_LINE_SEP \
307 SYSCALL_ERROR_HANDLER ASM_LINE_SEP \
308 /* Use TREG for temp storage */ ASM_LINE_SEP \
309 copy %ret0, TREG /* delay */ ASM_LINE_SEP \
310 /* OPTIMIZE: Don't reload r19 */ ASM_LINE_SEP \
311 /* do a -1*syscall_ret0 */ ASM_LINE_SEP \
312 sub %r0, TREG, TREG ASM_LINE_SEP \
313 /* Store into errno location */ ASM_LINE_SEP \
314 stw TREG, 0(%sr0,%ret0) ASM_LINE_SEP \
315 /* return -1 as error */ ASM_LINE_SEP \
316 ldo -1(%r0), %ret0 ASM_LINE_SEP \
317L(pre_end): ASM_LINE_SEP \
318 /* Restore our frame, restoring TREG */ ASM_LINE_SEP \
319 ldwm -64(%sp), TREG ASM_LINE_SEP \
320 /* Restore return pointer */ ASM_LINE_SEP \
321 ldw -20(%sp),%rp ASM_LINE_SEP
322
323/* We do nothing with the return, except hand it back to someone else */
324#undef DO_CALL_NOERRNO
325#define DO_CALL_NOERRNO(syscall_name, args) \
326 /* No need to store r19 */ ASM_LINE_SEP \
327 ble 0x100(%sr2,%r0) ASM_LINE_SEP \
328 ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
329 /* Caller will restore r19 */ ASM_LINE_SEP
330
331/* Here, we return the ERRVAL in assembly, note we don't call the
332 error handler function, but we do 'negate' the return _IF_
333 it's an error. Not sure if this is the right semantic. */
334
335#undef DO_CALL_ERRVAL
336#define DO_CALL_ERRVAL(syscall_name, args) \
337 /* No need to store r19 */ ASM_LINE_SEP \
338 ble 0x100(%sr2,%r0) ASM_LINE_SEP \
339 ldi SYS_ify (syscall_name), %r20 ASM_LINE_SEP \
340 /* Caller will restore r19 */ ASM_LINE_SEP \
341 ldi NO_ERROR,%r1 ASM_LINE_SEP \
342 cmpb,>>=,n %r1,%ret0,0f ASM_LINE_SEP \
343 sub %r0, %ret0, %ret0 ASM_LINE_SEP \
3440: ASM_LINE_SEP
345
346
347#else
348
349/* GCC has to be warned that a syscall may clobber all the ABI
350 registers listed as "caller-saves", see page 8, Table 2
351 in section 2.2.6 of the PA-RISC RUN-TIME architecture
352 document. However! r28 is the result and will conflict with
353 the clobber list so it is left out. Also the input arguments
354 registers r20 -> r26 will conflict with the list so they
355 are treated specially. Although r19 is clobbered by the syscall
356 we cannot say this because it would violate ABI, thus we say
357 TREG is clobbered and use that register to save/restore r19
358 across the syscall. */
359
360#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
361 "%r20", "%r29", "%r31"
362
363/* Similar to INLINE_SYSCALL but we don't set errno */
364#undef INTERNAL_SYSCALL
365#define INTERNAL_SYSCALL(name, nr, args...) \
366({ \
367 long __sys_res; \
368 { \
369 LOAD_ARGS_##nr(args) \
370 register unsigned long __res asm("r28"); \
371 PIC_REG_DEF \
372 LOAD_REGS_##nr \
373 /* FIXME: HACK save/load r19 around syscall */ \
374 asm volatile( \
375 SAVE_ASM_PIC \
376 " ble 0x100(%%sr2, %%r0)\n" \
377 " ldi %1, %%r20\n" \
378 LOAD_ASM_PIC \
379 : "=r" (__res) \
380 : "i" (SYS_ify(name)) PIC_REG_USE ASM_ARGS_##nr \
381 : "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \
382 ); \
383 __sys_res = (long)__res; \
384 } \
385 __sys_res; \
386 })
387
388
389/* The _NCS variant allows non-constant syscall numbers. */
390#undef INTERNAL_SYSCALL_NCS
391#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
392({ \
393 long __sys_res; \
394 { \
395 LOAD_ARGS_##nr(args) \
396 register unsigned long __res asm("r28"); \
397 PIC_REG_DEF \
398 LOAD_REGS_##nr \
399 /* FIXME: HACK save/load r19 around syscall */ \
400 asm volatile( \
401 SAVE_ASM_PIC \
402 " ble 0x100(%%sr2, %%r0)\n" \
403 " copy %1, %%r20\n" \
404 LOAD_ASM_PIC \
405 : "=r" (__res) \
406 : "r" (name) PIC_REG_USE ASM_ARGS_##nr \
407 : "memory", CALL_CLOB_REGS CLOB_ARGS_##nr \
408 ); \
409 __sys_res = (long)__res; \
410 } \
411 __sys_res; \
412 })
413
414#define LOAD_ARGS_0()
415#define LOAD_REGS_0
416#define LOAD_ARGS_1(a1) \
417 register unsigned long __x26 = (unsigned long)(a1); \
418 LOAD_ARGS_0()
419#define LOAD_REGS_1 \
420 register unsigned long __r26 __asm__("r26") = __x26; \
421 LOAD_REGS_0
422#define LOAD_ARGS_2(a1,a2) \
423 register unsigned long __x25 = (unsigned long)(a2); \
424 LOAD_ARGS_1(a1)
425#define LOAD_REGS_2 \
426 register unsigned long __r25 __asm__("r25") = __x25; \
427 LOAD_REGS_1
428#define LOAD_ARGS_3(a1,a2,a3) \
429 register unsigned long __x24 = (unsigned long)(a3); \
430 LOAD_ARGS_2(a1,a2)
431#define LOAD_REGS_3 \
432 register unsigned long __r24 __asm__("r24") = __x24; \
433 LOAD_REGS_2
434#define LOAD_ARGS_4(a1,a2,a3,a4) \
435 register unsigned long __x23 = (unsigned long)(a4); \
436 LOAD_ARGS_3(a1,a2,a3)
437#define LOAD_REGS_4 \
438 register unsigned long __r23 __asm__("r23") = __x23; \
439 LOAD_REGS_3
440#define LOAD_ARGS_5(a1,a2,a3,a4,a5) \
441 register unsigned long __x22 = (unsigned long)(a5); \
442 LOAD_ARGS_4(a1,a2,a3,a4)
443#define LOAD_REGS_5 \
444 register unsigned long __r22 __asm__("r22") = __x22; \
445 LOAD_REGS_4
446#define LOAD_ARGS_6(a1,a2,a3,a4,a5,a6) \
447 register unsigned long __x21 = (unsigned long)(a6); \
448 LOAD_ARGS_5(a1,a2,a3,a4,a5)
449#define LOAD_REGS_6 \
450 register unsigned long __r21 __asm__("r21") = __x21; \
451 LOAD_REGS_5
452
453/* Even with zero args we use r20 for the syscall number */
454#define ASM_ARGS_0
455#define ASM_ARGS_1 ASM_ARGS_0, "r" (__r26)
456#define ASM_ARGS_2 ASM_ARGS_1, "r" (__r25)
457#define ASM_ARGS_3 ASM_ARGS_2, "r" (__r24)
458#define ASM_ARGS_4 ASM_ARGS_3, "r" (__r23)
459#define ASM_ARGS_5 ASM_ARGS_4, "r" (__r22)
460#define ASM_ARGS_6 ASM_ARGS_5, "r" (__r21)
461
462/* The registers not listed as inputs but clobbered */
463#define CLOB_ARGS_6
464#define CLOB_ARGS_5 CLOB_ARGS_6, "%r21"
465#define CLOB_ARGS_4 CLOB_ARGS_5, "%r22"
466#define CLOB_ARGS_3 CLOB_ARGS_4, "%r23"
467#define CLOB_ARGS_2 CLOB_ARGS_3, "%r24"
468#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
469#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"
470
471#define VDSO_NAME "LINUX_6.11"
472#define VDSO_HASH 182951793
473
474#ifdef __LP64__
475# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
476#else
477# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
478#endif /* __LP64__ */
479
480#endif /* __ASSEMBLER__ */
481
482#endif /* _LINUX_HPPA_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/xstatver.h deleted-13
......@@ -1,13 +0,0 @@
1/* Versions of the 'struct stat' data structure used in compatibility xstat
2 functions. */
3#define _STAT_VER_LINUX_OLD 1
4#define _STAT_VER_KERNEL 1
5#define _STAT_VER_SVR4 2
6#define _STAT_VER_LINUX 3
7#define _STAT_VER _STAT_VER_LINUX
8
9/* Versions of the 'xmknod' interface used in compatibility xmknod
10 functions. */
11#define _MKNOD_VER_LINUX 1
12#define _MKNOD_VER_SVR4 2
13#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h deleted-66
......@@ -1,66 +0,0 @@
1/* Copyright (C) 2011-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <endian.h>
19
20/* All supported kernel versions for MicroBlaze have these syscalls. */
21#define __ASSUME_CONNECT_SYSCALL 1
22#define __ASSUME_SEND_SYSCALL 1
23#define __ASSUME_RECV_SYSCALL 1
24
25#include_next <kernel-features.h>
26
27/* Support for the pselect6, preadv and pwritev syscalls was added in
28 3.15. */
29#if __LINUX_KERNEL_VERSION < 0x030f00
30# undef __ASSUME_PSELECT
31# undef __ASSUME_PREADV
32# undef __ASSUME_PWRITEV
33#endif
34
35/* Support for the sendmmsg syscall was added in 3.3. */
36#if __LINUX_KERNEL_VERSION < 0x030300
37# undef __ASSUME_SENDMMSG_SYSCALL
38#endif
39
40/* Support for the renameat2 syscall was added in 3.17. */
41#if __LINUX_KERNEL_VERSION < 0x031100
42# undef __ASSUME_RENAMEAT2
43#endif
44
45/* Support for the execveat syscall was added in 4.0. */
46#if __LINUX_KERNEL_VERSION < 0x040000
47# undef __ASSUME_EXECVEAT
48#endif
49
50/* Support for the mlock2 syscall was added in 4.7. */
51#if __LINUX_KERNEL_VERSION < 0x040700
52# undef __ASSUME_MLOCK2
53#endif
54
55/* Support for statx was added in kernel 4.12. */
56#if __LINUX_KERNEL_VERSION < 0X040C00
57# undef __ASSUME_STATX
58#endif
59
60#undef __ASSUME_CLONE_DEFAULT
61#define __ASSUME_CLONE_BACKWARDS3
62
63#if __BYTE_ORDER == __BIG_ENDIAN
64# define __ASSUME_SYSVIPC_BROKEN_MODE_T
65#endif
66#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h deleted-54
......@@ -1,54 +0,0 @@
1/* Definition of `struct stat' used in the kernel
2 Copyright (C) 2013-2024 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20struct kernel_stat
21{
22 unsigned long st_dev; /* Device. */
23 unsigned long st_ino; /* File serial number. */
24 unsigned int st_mode; /* File mode. */
25 unsigned int st_nlink; /* Link count. */
26 unsigned int st_uid; /* User ID of the file's owner. */
27 unsigned int st_gid; /* Group ID of the file's group. */
28 unsigned long st_rdev; /* Device number, if device. */
29 unsigned long __pad2;
30#define _HAVE_STAT___PAD2
31#define _HAVE_STAT64___PAD2
32 long st_size; /* Size of file, in bytes. */
33 int st_blksize; /* Optimal block size for I/O. */
34 int __pad3;
35#define _HAVE_STAT___PAD3
36#define _HAVE_STAT64___PAD3
37 long st_blocks; /* Number 512-byte blocks allocated. */
38 struct timespec st_atim;
39 struct timespec st_mtim;
40 struct timespec st_ctim;
41#define _HAVE_STAT_NSEC
42#define _HAVE_STAT64_NSEC
43 unsigned int __glibc_reserved4;
44#define _HAVE_STAT___UNUSED4
45#define _HAVE_STAT64___UNUSED4
46 unsigned int __glibc_reserved5;
47#define _HAVE_STAT___UNUSED5
48#define _HAVE_STAT64___UNUSED5
49};
50
51#define STAT_IS_KERNEL_STAT 0
52#define STAT64_IS_KERNEL_STAT64 1
53#define XSTAT_IS_XSTAT64 0
54#define STATFS_IS_STATFS64 0
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h deleted-312
......@@ -1,312 +0,0 @@
1/* Copyright (C) 2000-2024 Free Software Foundation, Inc.
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LINUX_MICROBLAZE_SYSDEP_H
20#define _LINUX_MICROBLAZE_SYSDEP_H 1
21
22#include <sysdeps/unix/sysdep.h>
23#include <sysdeps/unix/sysv/linux/sysdep.h>
24#include <sysdeps/microblaze/sysdep.h>
25
26/* Defines RTLD_PRIVATE_ERRNO. */
27#include <dl-sysdep.h>
28
29#include <tls.h>
30
31/* In order to get __set_errno() definition in INLINE_SYSCALL. */
32#ifndef __ASSEMBLER__
33# include <errno.h>
34#endif
35
36/* For Linux we can use the system call table in the header file
37 /usr/include/asm/unistd.h
38 of the kernel. But these symbols do not follow the SYS_* syntax
39 so we have to redefine the `SYS_ify' macro here. */
40#undef SYS_ify
41#define SYS_ify(syscall_name) __NR_##syscall_name
42
43#ifdef __ASSEMBLER__
44
45/* In microblaze ABI function call arguments are passed in registers
46 r5...r10. The return value is stored in r3 (or r3:r4 register pair).
47 Linux syscall uses the same convention with the addition that the
48 syscall number is passed in r12. To enter the kernel "brki r14,8"
49 instruction is used.
50 None of the abovementioned registers are presumed across function call
51 or syscall.
52*/
53/* Linux uses a negative return value to indicate syscall errors, unlike
54 most Unices, which use the condition codes' carry flag.
55
56 Since version 2.1 the return value of a system call might be negative
57 even if the call succeeded. E.g., the `lseek' system call might return
58 a large offset. Therefore we must not anymore test for < 0, but test
59 for a real error by making sure the value in %d0 is a real error
60 number. Linus said he will make sure the no syscall returns a value
61 in -1 .. -4095 as a valid result so we can safely test with -4095. */
62
63/* We don't want the label for the error handler to be visible in the symbol
64 table when we define it here. */
65# undef SYSCALL_ERROR_LABEL
66# ifdef PIC
67# define SYSCALL_ERROR_LABEL 0f
68# else
69# define SYSCALL_ERROR_LABEL __syscall_error
70# endif
71
72# undef PSEUDO
73# define PSEUDO(name, syscall_name, args) \
74 .text; \
75 ENTRY (name) \
76 DO_CALL (syscall_name, args); \
77 addik r12,r0,-4095; \
78 cmpu r12,r12,r3; \
79 bgei r12,SYSCALL_ERROR_LABEL;
80
81# undef PSEUDO_END
82# define PSEUDO_END(name) \
83 SYSCALL_ERROR_HANDLER; \
84 END (name)
85
86# undef PSEUDO_NOERRNO
87# define PSEUDO_NOERRNO(name, syscall_name, args) \
88 .text; \
89 ENTRY (name) \
90 DO_CALL (syscall_name, args);
91
92# undef PSEUDO_END_NOERRNO
93# define PSEUDO_END_NOERRNO(name) \
94 END (name)
95
96/* The function has to return the error code. */
97# undef PSEUDO_ERRVAL
98# define PSEUDO_ERRVAL(name, syscall_name, args) \
99 .text; \
100 ENTRY (name) \
101 DO_CALL (syscall_name, args); \
102
103# undef PSEUDO_END_ERRVAL
104# define PSEUDO_END_ERRVAL(name) \
105 END (name)
106
107# define ret_NOERRNO \
108 rtsd r15,8; addk r0,r0,r0;
109
110# define ret_ERRVAL \
111 rtsd r15,8; rsubk r3,r3,r0;
112
113# ifdef PIC
114# define SYSCALL_ERROR_LABEL_DCL 0
115# if RTLD_PRIVATE_ERRNO
116# define SYSCALL_ERROR_HANDLER \
117SYSCALL_ERROR_LABEL_DCL: \
118 mfs r12,rpc; \
119 addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
120 lwi r12,r12,rtld_errno@GOT; \
121 rsubk r3,r3,r0; \
122 swi r3,r12,0; \
123 rtsd r15,8; \
124 addik r3,r0,-1;
125# else /* !RTLD_PRIVATE_ERRNO. */
126/* Store (-r3) into errno through the GOT. */
127# if defined _LIBC_REENTRANT
128# define SYSCALL_ERROR_HANDLER \
129SYSCALL_ERROR_LABEL_DCL: \
130 addik r1,r1,-16; \
131 swi r15,r1,0; \
132 swi r20,r1,8; \
133 rsubk r3,r3,r0; \
134 swi r3,r1,12; \
135 mfs r20,rpc; \
136 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8; \
137 brlid r15,__errno_location@PLT; \
138 nop; \
139 lwi r4,r1,12; \
140 swi r4,r3,0; \
141 lwi r20,r1,8; \
142 lwi r15,r1,0; \
143 addik r1,r1,16; \
144 rtsd r15,8; \
145 addik r3,r0,-1;
146# else /* !_LIBC_REENTRANT. */
147# define SYSCALL_ERROR_HANDLER \
148SYSCALL_ERROR_LABEL_DCL: \
149 mfs r12,rpc; \
150 addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
151 lwi r12,r12,errno@GOT; \
152 rsubk r3,r3,r0; \
153 swi r3,r12,0; \
154 rtsd r15,8; \
155 addik r3,r0,-1;
156# endif /* _LIBC_REENTRANT. */
157# endif /* RTLD_PRIVATE_ERRNO. */
158# else
159# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
160# endif /* PIC. */
161
162# define DO_CALL(syscall_name, args) \
163 addik r12,r0,SYS_ify (syscall_name); \
164 brki r14,8; \
165 addk r0,r0,r0;
166
167#else /* not __ASSEMBLER__ */
168
169/* Define a macro which expands inline into the wrapper code for a system
170 call. This use is for internal calls that do not need to handle errors
171 normally. It will never touch errno. This returns just what the kernel
172 gave back. */
173# undef INTERNAL_SYSCALL
174# define INTERNAL_SYSCALL(name, nr, args...) \
175 inline_syscall##nr(SYS_ify(name), args)
176
177# undef INTERNAL_SYSCALL_NCS
178# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
179 inline_syscall##nr(name, args)
180
181# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
182# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
183# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
184# define SYSCALL_CLOBBERS_3 "r8", SYSCALL_CLOBBERS_4
185# define SYSCALL_CLOBBERS_2 "r7", SYSCALL_CLOBBERS_3
186# define SYSCALL_CLOBBERS_1 "r6", SYSCALL_CLOBBERS_2
187# define SYSCALL_CLOBBERS_0 "r5", SYSCALL_CLOBBERS_1
188
189# define inline_syscall0(name,dummy) \
190 ({ \
191 register long int __ret __asm__("r3"); \
192 register long int __r12 __asm__("r12") = name; \
193 __asm__ __volatile__( "brki r14,8; nop;" \
194 : "=r"(__ret) \
195 : "r"(__r12) \
196 : SYSCALL_CLOBBERS_0 ); __ret; \
197 })
198
199# define inline_syscall1(name,arg1) \
200 ({ \
201 long int __arg1 = (long int) (arg1); \
202 register long int __ret __asm__("r3"); \
203 register long int __r12 __asm__("r12") = name; \
204 register long int __r5 __asm__("r5") = __arg1; \
205 __asm__ __volatile__( "brki r14,8; nop;" \
206 : "=r"(__ret) \
207 : "r"(__r5), "r"(__r12) \
208 : SYSCALL_CLOBBERS_1 ); __ret; \
209 })
210
211# define inline_syscall2(name,arg1,arg2) \
212 ({ \
213 long int __arg1 = (long int) (arg1); \
214 long int __arg2 = (long int) (arg2); \
215 register long int __ret __asm__("r3"); \
216 register long int __r12 __asm__("r12") = name; \
217 register long int __r5 __asm__("r5") = __arg1; \
218 register long int __r6 __asm__("r6") = __arg2; \
219 __asm__ __volatile__( "brki r14,8; nop;" \
220 : "=r"(__ret) \
221 : "r"(__r5), "r"(__r6), "r"(__r12) \
222 : SYSCALL_CLOBBERS_2 ); __ret; \
223 })
224
225
226# define inline_syscall3(name,arg1,arg2,arg3) \
227 ({ \
228 long int __arg1 = (long int) (arg1); \
229 long int __arg2 = (long int) (arg2); \
230 long int __arg3 = (long int) (arg3); \
231 register long int __ret __asm__("r3"); \
232 register long int __r12 __asm__("r12") = name; \
233 register long int __r5 __asm__("r5") = __arg1; \
234 register long int __r6 __asm__("r6") = __arg2; \
235 register long int __r7 __asm__("r7") = __arg3; \
236 __asm__ __volatile__( "brki r14,8; nop;" \
237 : "=r"(__ret) \
238 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \
239 : SYSCALL_CLOBBERS_3 ); __ret; \
240 })
241
242
243# define inline_syscall4(name,arg1,arg2,arg3,arg4) \
244 ({ \
245 long int __arg1 = (long int) (arg1); \
246 long int __arg2 = (long int) (arg2); \
247 long int __arg3 = (long int) (arg3); \
248 long int __arg4 = (long int) (arg4); \
249 register long int __ret __asm__("r3"); \
250 register long int __r12 __asm__("r12") = name; \
251 register long int __r5 __asm__("r5") = __arg1; \
252 register long int __r6 __asm__("r6") = __arg2; \
253 register long int __r7 __asm__("r7") = __arg3; \
254 register long int __r8 __asm__("r8") = __arg4; \
255 __asm__ __volatile__( "brki r14,8; nop;" \
256 : "=r"(__ret) \
257 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \
258 : SYSCALL_CLOBBERS_4 ); __ret; \
259 })
260
261
262# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
263 ({ \
264 long int __arg1 = (long int) (arg1); \
265 long int __arg2 = (long int) (arg2); \
266 long int __arg3 = (long int) (arg3); \
267 long int __arg4 = (long int) (arg4); \
268 long int __arg5 = (long int) (arg5); \
269 register long int __ret __asm__("r3"); \
270 register long int __r12 __asm__("r12") = name; \
271 register long int __r5 __asm__("r5") = __arg1; \
272 register long int __r6 __asm__("r6") = __arg2; \
273 register long int __r7 __asm__("r7") = __arg3; \
274 register long int __r8 __asm__("r8") = __arg4; \
275 register long int __r9 __asm__("r9") = __arg5; \
276 __asm__ __volatile__( "brki r14,8; nop;" \
277 : "=r"(__ret) \
278 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \
279 : SYSCALL_CLOBBERS_5 ); __ret; \
280 })
281
282
283# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
284 ({ \
285 long int __arg1 = (long int) (arg1); \
286 long int __arg2 = (long int) (arg2); \
287 long int __arg3 = (long int) (arg3); \
288 long int __arg4 = (long int) (arg4); \
289 long int __arg5 = (long int) (arg5); \
290 long int __arg6 = (long int) (arg6); \
291 register long int __ret __asm__("r3"); \
292 register long int __r12 __asm__("r12") = name; \
293 register long int __r5 __asm__("r5") = __arg1; \
294 register long int __r6 __asm__("r6") = __arg2; \
295 register long int __r7 __asm__("r7") = __arg3; \
296 register long int __r8 __asm__("r8") = __arg4; \
297 register long int __r9 __asm__("r9") = __arg5; \
298 register long int __r10 __asm__("r10") = __arg6; \
299 __asm__ __volatile__( "brki r14,8; nop;" \
300 : "=r"(__ret) \
301 : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \
302 "r"(__r12) \
303 : SYSCALL_CLOBBERS_6 ); __ret; \
304 })
305
306
307#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
308#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
309
310#endif /* not __ASSEMBLER__ */
311
312#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/xstatver.h deleted-13
......@@ -1,13 +0,0 @@
1/* Versions of the 'struct stat' data structure used in compatibility xstat
2 functions. */
3#define _STAT_VER_LINUX_OLD 1
4#define _STAT_VER_KERNEL 1
5#define _STAT_VER_SVR4 2
6#define _STAT_VER_LINUX 3
7#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
8
9/* Versions of the 'xmknod' interface used in compatibility xmknod
10 functions. */
11#define _MKNOD_VER_LINUX 1
12#define _MKNOD_VER_SVR4 2
13#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/kernel_stat.h deleted-21
......@@ -1,21 +0,0 @@
1/* Internal definitions for stat functions. Linux/nios2.
2 Copyright (C) 2021-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#define STAT_IS_KERNEL_STAT 1
20#define XSTAT_IS_XSTAT64 0
21#define STATFS_IS_STATFS64 0
lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/sysdep.h deleted-223
......@@ -1,223 +0,0 @@
1/* Assembler macros for Nios II.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LINUX_NIOS2_SYSDEP_H
20#define _LINUX_NIOS2_SYSDEP_H 1
21
22#include <sysdeps/unix/sysv/linux/sysdep.h>
23#include <sysdeps/unix/sysdep.h>
24#include <sysdeps/nios2/sysdep.h>
25
26/* For RTLD_PRIVATE_ERRNO. */
27#include <dl-sysdep.h>
28
29#include <tls.h>
30
31/* For Linux we can use the system call table in the header file
32 /usr/include/asm/unistd.h
33 of the kernel. But these symbols do not follow the SYS_* syntax
34 so we have to redefine the `SYS_ify' macro here. */
35#undef SYS_ify
36#define SYS_ify(syscall_name) __NR_##syscall_name
37
38#ifdef __ASSEMBLER__
39
40#undef SYSCALL_ERROR_LABEL
41#define SYSCALL_ERROR_LABEL __local_syscall_error
42
43#undef PSEUDO
44#define PSEUDO(name, syscall_name, args) \
45 ENTRY (name) \
46 DO_CALL (syscall_name, args) \
47 bne r7, zero, SYSCALL_ERROR_LABEL; \
48
49#undef PSEUDO_END
50#define PSEUDO_END(name) \
51 SYSCALL_ERROR_HANDLER \
52 END (name)
53
54#undef PSEUDO_NOERRNO
55#define PSEUDO_NOERRNO(name, syscall_name, args) \
56 ENTRY (name) \
57 DO_CALL (syscall_name, args)
58
59#undef PSEUDO_END_NOERRNO
60#define PSEUDO_END_NOERRNO(name) \
61 END (name)
62
63#undef ret_NOERRNO
64#define ret_NOERRNO ret
65
66#undef DO_CALL
67#define DO_CALL(syscall_name, args) \
68 DOARGS_##args \
69 movi r2, SYS_ify(syscall_name); \
70 trap;
71
72#if defined(__PIC__) || defined(PIC)
73
74# if RTLD_PRIVATE_ERRNO
75
76# define SYSCALL_ERROR_HANDLER \
77 SYSCALL_ERROR_LABEL: \
78 nextpc r3; \
791: \
80 movhi r8, %hiadj(rtld_errno - 1b); \
81 addi r8, r8, %lo(rtld_errno - 1b); \
82 add r3, r3, r8; \
83 stw r2, 0(r3); \
84 movi r2, -1; \
85 ret;
86
87# else
88
89# if IS_IN (libc)
90# define SYSCALL_ERROR_ERRNO __libc_errno
91# else
92# define SYSCALL_ERROR_ERRNO errno
93# endif
94# define SYSCALL_ERROR_HANDLER \
95 SYSCALL_ERROR_LABEL: \
96 nextpc r3; \
971: \
98 movhi r8, %hiadj(_gp_got - 1b); \
99 addi r8, r8, %lo(_gp_got - 1b); \
100 add r3, r3, r8; \
101 ldw r3, %tls_ie(SYSCALL_ERROR_ERRNO)(r3); \
102 add r3, r23, r3; \
103 stw r2, 0(r3); \
104 movi r2, -1; \
105 ret;
106
107# endif
108
109#else
110
111/* We can use a single error handler in the static library. */
112#define SYSCALL_ERROR_HANDLER \
113 SYSCALL_ERROR_LABEL: \
114 jmpi __syscall_error;
115
116#endif
117
118#define DOARGS_0 /* nothing */
119#define DOARGS_1 /* nothing */
120#define DOARGS_2 /* nothing */
121#define DOARGS_3 /* nothing */
122#define DOARGS_4 /* nothing */
123#define DOARGS_5 ldw r8, 0(sp);
124#define DOARGS_6 ldw r9, 4(sp); ldw r8, 0(sp);
125
126/* The function has to return the error code. */
127#undef PSEUDO_ERRVAL
128#define PSEUDO_ERRVAL(name, syscall_name, args) \
129 ENTRY (name) \
130 DO_CALL (syscall_name, args)
131
132#undef PSEUDO_END_ERRVAL
133#define PSEUDO_END_ERRVAL(name) \
134 END (name)
135
136#define ret_ERRVAL ret
137
138#else /* __ASSEMBLER__ */
139
140/* In order to get __set_errno() definition in INLINE_SYSCALL. */
141#include <errno.h>
142
143#undef INTERNAL_SYSCALL_RAW
144#define INTERNAL_SYSCALL_RAW(name, nr, args...) \
145 ({ unsigned int _sys_result; \
146 { \
147 /* Load argument values in temporary variables
148 to perform side effects like function calls
149 before the call-used registers are set. */ \
150 LOAD_ARGS_##nr (args) \
151 LOAD_REGS_##nr \
152 register int _r2 asm ("r2") = (int)(name); \
153 register int _err asm ("r7"); \
154 asm volatile ("trap" \
155 : "+r" (_r2), "=r" (_err) \
156 : ASM_ARGS_##nr \
157 : __SYSCALL_CLOBBERS); \
158 _sys_result = _err != 0 ? -_r2 : _r2; \
159 } \
160 (int) _sys_result; })
161
162#undef INTERNAL_SYSCALL
163#define INTERNAL_SYSCALL(name, nr, args...) \
164 INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
165
166#undef INTERNAL_SYSCALL_NCS
167#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
168 INTERNAL_SYSCALL_RAW(number, nr, args)
169
170#define LOAD_ARGS_0()
171#define LOAD_REGS_0
172#define ASM_ARGS_0
173#define LOAD_ARGS_1(a1) \
174 LOAD_ARGS_0 () \
175 int __arg1 = (int) (a1);
176#define LOAD_REGS_1 \
177 register int _r4 asm ("r4") = __arg1; \
178 LOAD_REGS_0
179#define ASM_ARGS_1 "r" (_r4)
180#define LOAD_ARGS_2(a1, a2) \
181 LOAD_ARGS_1 (a1) \
182 int __arg2 = (int) (a2);
183#define LOAD_REGS_2 \
184 register int _r5 asm ("r5") = __arg2; \
185 LOAD_REGS_1
186#define ASM_ARGS_2 ASM_ARGS_1, "r" (_r5)
187#define LOAD_ARGS_3(a1, a2, a3) \
188 LOAD_ARGS_2 (a1, a2) \
189 int __arg3 = (int) (a3);
190#define LOAD_REGS_3 \
191 register int _r6 asm ("r6") = __arg3; \
192 LOAD_REGS_2
193#define ASM_ARGS_3 ASM_ARGS_2, "r" (_r6)
194#define LOAD_ARGS_4(a1, a2, a3, a4) \
195 LOAD_ARGS_3 (a1, a2, a3) \
196 int __arg4 = (int) (a4);
197#define LOAD_REGS_4 \
198 register int _r7 asm ("r7") = __arg4; \
199 LOAD_REGS_3
200#define ASM_ARGS_4 ASM_ARGS_3, "r" (_r7)
201#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
202 LOAD_ARGS_4 (a1, a2, a3, a4) \
203 int __arg5 = (int) (a5);
204#define LOAD_REGS_5 \
205 register int _r8 asm ("r8") = __arg5; \
206 LOAD_REGS_4
207#define ASM_ARGS_5 ASM_ARGS_4, "r" (_r8)
208#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
209 LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
210 int __arg6 = (int) (a6);
211#define LOAD_REGS_6 \
212 register int _r9 asm ("r9") = __arg6; \
213 LOAD_REGS_5
214#define ASM_ARGS_6 ASM_ARGS_5, "r" (_r9)
215
216#define __SYSCALL_CLOBBERS "memory"
217
218#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
219#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
220
221#endif /* __ASSEMBLER__ */
222
223#endif /* linux/nios2/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h deleted-180
......@@ -1,180 +0,0 @@
1/* Copyright (C) 2000-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_S390_SYSDEP_H
19#define _LINUX_S390_SYSDEP_H
20
21#include <sysdeps/s390/s390-32/sysdep.h>
22#include <sysdeps/unix/sysdep.h>
23#include <sysdeps/unix/sysv/linux/s390/sysdep.h>
24#include <sysdeps/unix/sysv/linux/sysdep.h>
25#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
26#include <tls.h>
27
28/* For Linux we can use the system call table in the header file
29 /usr/include/asm/unistd.h
30 of the kernel. But these symbols do not follow the SYS_* syntax
31 so we have to redefine the `SYS_ify' macro here. */
32/* in newer 2.1 kernels __NR_syscall is missing so we define it here */
33#define __NR_syscall 0
34
35#ifdef __ASSEMBLER__
36
37/* Linux uses a negative return value to indicate syscall errors, unlike
38 most Unices, which use the condition codes' carry flag.
39
40 Since version 2.1 the return value of a system call might be negative
41 even if the call succeeded. E.g., the `lseek' system call might return
42 a large offset. Therefore we must not anymore test for < 0, but test
43 for a real error by making sure the value in gpr2 is a real error
44 number. Linus said he will make sure that no syscall returns a value
45 in -1 .. -4095 as a valid result so we can safely test with -4095. */
46
47#undef PSEUDO
48#define PSEUDO(name, syscall_name, args) \
49 .text; \
50 ENTRY (name) \
51 DO_CALL (syscall_name, args); \
52 lhi %r4,-4095 ; \
53 clr %r2,%r4 ; \
54 jnl SYSCALL_ERROR_LABEL
55
56#undef PSEUDO_END
57#define PSEUDO_END(name) \
58 SYSCALL_ERROR_HANDLER; \
59 END (name)
60
61#undef PSEUDO_NOERRNO
62#define PSEUDO_NOERRNO(name, syscall_name, args) \
63 .text; \
64 ENTRY (name) \
65 DO_CALL (syscall_name, args)
66
67#undef PSEUDO_END_NOERRNO
68#define PSEUDO_END_NOERRNO(name) \
69 END (name)
70
71#undef PSEUDO_ERRVAL
72#define PSEUDO_ERRVAL(name, syscall_name, args) \
73 .text; \
74 ENTRY (name) \
75 DO_CALL (syscall_name, args); \
76 lcr %r2,%r2
77
78#undef PSEUDO_END_ERRVAL
79#define PSEUDO_END_ERRVAL(name) \
80 END (name)
81
82#undef SYSCALL_ERROR_LABEL
83#ifndef PIC
84# undef SYSCALL_ERROR_LABEL
85# define SYSCALL_ERROR_LABEL 0f
86# define SYSCALL_ERROR_HANDLER \
870: basr %r1,0; \
881: l %r1,2f-1b(%r1); \
89 br %r1; \
902: .long syscall_error
91#else
92# if RTLD_PRIVATE_ERRNO
93# undef SYSCALL_ERROR_LABEL
94# define SYSCALL_ERROR_LABEL 0f
95# define SYSCALL_ERROR_HANDLER \
960: basr %r1,0; \
971: al %r1,2f-1b(%r1); \
98 lcr %r2,%r2; \
99 st %r2,0(%r1); \
100 lhi %r2,-1; \
101 br %r14; \
1022: .long rtld_errno-1b
103# elif defined _LIBC_REENTRANT
104# if IS_IN (libc)
105# define SYSCALL_ERROR_ERRNO __libc_errno
106# else
107# define SYSCALL_ERROR_ERRNO errno
108# endif
109# undef SYSCALL_ERROR_LABEL
110# define SYSCALL_ERROR_LABEL 0f
111# define SYSCALL_ERROR_HANDLER \
1120: lcr %r0,%r2; \
113 basr %r1,0; \
1141: al %r1,2f-1b(%r1); \
115 l %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1); \
116 ear %r2,%a0; \
117 st %r0,0(%r1,%r2); \
118 lhi %r2,-1; \
119 br %r14; \
1202: .long _GLOBAL_OFFSET_TABLE_-1b
121# else
122# undef SYSCALL_ERROR_LABEL
123# define SYSCALL_ERROR_LABEL 0f
124# define SYSCALL_ERROR_HANDLER \
1250: basr %r1,0; \
1261: al %r1,2f-1b(%r1); \
127 l %r1,errno@GOT(%r1); \
128 lcr %r2,%r2; \
129 st %r2,0(%r1); \
130 lhi %r2,-1; \
131 br %r14; \
1322: .long _GLOBAL_OFFSET_TABLE_-1b
133# endif /* _LIBC_REENTRANT */
134#endif /* PIC */
135
136/* Linux takes system call arguments in registers:
137
138 syscall number 1 call-clobbered
139 arg 1 2 call-clobbered
140 arg 2 3 call-clobbered
141 arg 3 4 call-clobbered
142 arg 4 5 call-clobbered
143 arg 5 6 call-saved
144 arg 6 7 call-saved
145
146 (Of course a function with say 3 arguments does not have entries for
147 arguments 4 and 5.)
148 For system calls with 6 parameters a stack operation is required
149 to load the 6th parameter to register 7. Call saved register 7 is
150 moved to register 0 and back to avoid an additional stack frame.
151 */
152
153#define DO_CALL(syscall, args) \
154 .if args > 5; \
155 lr %r0,%r7; \
156 l %r7,96(%r15); \
157 .endif; \
158 lhi %r1,SYS_ify (syscall); \
159 svc 0; \
160 .if args > 5; \
161 lr %r7,%r0; \
162 .endif
163
164#define ret \
165 br 14
166
167#define ret_NOERRNO \
168 br 14
169
170#define ret_ERRVAL \
171 br 14
172
173#else
174
175# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
176# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
177
178#endif /* __ASSEMBLER__ */
179
180#endif /* _LINUX_S390_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h deleted-62
......@@ -1,62 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number. SH version.
3 Copyright (C) 1999-2024 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef __KERNEL_FEATURES_SH__
21# define __KERNEL_FEATURES_SH__
22
23#include <endian.h>
24
25/* These syscalls were added for SH in 2.6.37. */
26#define __ASSUME_CONNECT_SYSCALL 1
27#define __ASSUME_SEND_SYSCALL 1
28#define __ASSUME_RECV_SYSCALL 1
29
30#include_next <kernel-features.h>
31
32/* SH4 ABI does not really require argument alignment for 64-bits, but
33 the kernel interface for p{read,write}64 adds a dummy long argument
34 before the offset. */
35#define __ASSUME_PRW_DUMMY_ARG 1
36
37/* sh only supports ipc syscall before 5.1. */
38#if __LINUX_KERNEL_VERSION < 0x050100
39# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
40# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
41#endif
42#if __BYTE_ORDER == __BIG_ENDIAN
43# define __ASSUME_SYSVIPC_BROKEN_MODE_T
44#endif
45
46/* Support for several syscalls was added in 4.8. */
47#if __LINUX_KERNEL_VERSION < 0x040800
48# undef __ASSUME_RENAMEAT2
49# undef __ASSUME_EXECVEAT
50# undef __ASSUME_MLOCK2
51#endif
52
53/* sh does not support the statx system call before 5.1. */
54#if __LINUX_KERNEL_VERSION < 0x050100
55# undef __ASSUME_STATX
56#endif
57
58/* sh does not provide clone3. */
59#undef __ASSUME_CLONE3
60#define __ASSUME_CLONE3 0
61
62#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h deleted-4
......@@ -1,4 +0,0 @@
1/* 4 instruction cycles not accessing cache and TLB are needed after
2 trapa instruction to avoid an SH-4 silicon bug. */
3#define NEED_SYSCALL_INST_PAD
4#include <sysdeps/unix/sysv/linux/sh/sysdep.h>
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h deleted-318
......@@ -1,318 +0,0 @@
1/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_SH_SYSDEP_H
19#define _LINUX_SH_SYSDEP_H 1
20
21/* There is some commonality. */
22#include <sysdeps/unix/sysv/linux/sysdep.h>
23#include <sysdeps/unix/sh/sysdep.h>
24#include <tls.h>
25
26/* For Linux we can use the system call table in the header file
27 /usr/include/asm/unistd.h
28 of the kernel. But these symbols do not follow the SYS_* syntax
29 so we have to redefine the `SYS_ify' macro here. */
30#undef SYS_ify
31#define SYS_ify(syscall_name) (__NR_##syscall_name)
32
33
34#ifdef __ASSEMBLER__
35
36/* Linux uses a negative return value to indicate syscall errors,
37 unlike most Unices, which use the condition codes' carry flag.
38
39 Since version 2.1 the return value of a system call might be
40 negative even if the call succeeded. E.g., the `lseek' system call
41 might return a large offset. Therefore we must not anymore test
42 for < 0, but test for a real error by making sure the value in R0
43 is a real error number. Linus said he will make sure the no syscall
44 returns a value in -1 .. -4095 as a valid result so we can safely
45 test with -4095. */
46
47#define _IMM1 #-1
48#define _IMM12 #-12
49#undef PSEUDO
50#define PSEUDO(name, syscall_name, args) \
51 .text; \
52 ENTRY (name); \
53 DO_CALL (syscall_name, args); \
54 mov r0,r1; \
55 mov _IMM12,r2; \
56 shad r2,r1; \
57 not r1,r1; \
58 tst r1,r1; \
59 bf .Lpseudo_end; \
60 SYSCALL_ERROR_HANDLER; \
61 .Lpseudo_end:
62
63#undef PSEUDO_END
64#define PSEUDO_END(name) \
65 END (name)
66
67#undef PSEUDO_NOERRNO
68#define PSEUDO_NOERRNO(name, syscall_name, args) \
69 .text; \
70 ENTRY (name); \
71 DO_CALL (syscall_name, args)
72
73#undef PSEUDO_END_NOERRNO
74#define PSEUDO_END_NOERRNO(name) \
75 END (name)
76
77#define ret_NOERRNO ret
78
79#define PSEUDO_ERRVAL(name, syscall_name, args) \
80 .text; \
81 ENTRY (name); \
82 DO_CALL (syscall_name, args);
83
84#undef PSEUDO_END_ERRVAL
85#define PSEUDO_END_ERRVAL(name) \
86 END (name)
87
88#define ret_ERRVAL ret
89
90#ifndef PIC
91# define SYSCALL_ERROR_HANDLER \
92 mov.l 0f,r1; \
93 jmp @r1; \
94 mov r0,r4; \
95 .align 2; \
96 0: .long __syscall_error
97#else
98# if RTLD_PRIVATE_ERRNO
99# define SYSCALL_ERROR_HANDLER \
100 neg r0,r1; \
101 mov r12,r2; \
102 cfi_register (r12, r2); \
103 mov.l 0f,r12; \
104 mova 0f,r0; \
105 add r0,r12; \
106 mov.l 1f,r0; \
107 mov.l r1,@(r0,r12); \
108 mov r2,r12; \
109 cfi_restore (r12); \
110 bra .Lpseudo_end; \
111 mov _IMM1,r0; \
112 .align 2; \
113 0: .long _GLOBAL_OFFSET_TABLE_; \
114 1: .long rtld_errno@GOTOFF
115
116# elif defined _LIBC_REENTRANT
117
118# if IS_IN (libc)
119# define SYSCALL_ERROR_ERRNO __libc_errno
120# else
121# define SYSCALL_ERROR_ERRNO errno
122# endif
123# define SYSCALL_ERROR_HANDLER \
124 neg r0,r1; \
125 mov r12,r2; \
126 cfi_register (r12, r2); \
127 mov.l 0f,r12; \
128 mova 0f,r0; \
129 add r0,r12; \
130 mov.l 1f,r0; \
131 stc gbr, r4; \
132 mov.l @(r0,r12),r0; \
133 mov r2,r12; \
134 cfi_restore (r12); \
135 add r4,r0; \
136 mov.l r1,@r0; \
137 bra .Lpseudo_end; \
138 mov _IMM1,r0; \
139 .align 2; \
140 0: .long _GLOBAL_OFFSET_TABLE_; \
141 1: .long SYSCALL_ERROR_ERRNO@GOTTPOFF
142# else
143/* Store (-r0) into errno through the GOT. */
144# define SYSCALL_ERROR_HANDLER \
145 neg r0,r1; \
146 mov r12,r2; \
147 cfi_register (r12, r2); \
148 mov.l 0f,r12; \
149 mova 0f,r0; \
150 add r0,r12; \
151 mov.l 1f,r0; \
152 mov.l @(r0,r12),r0; \
153 mov r2,r12; \
154 cfi_restore (r12); \
155 mov.l r1,@r0; \
156 bra .Lpseudo_end; \
157 mov _IMM1,r0; \
158 .align 2; \
159 0: .long _GLOBAL_OFFSET_TABLE_; \
160 1: .long errno@GOT
161# endif /* _LIBC_REENTRANT */
162#endif /* PIC */
163
164# ifdef NEED_SYSCALL_INST_PAD
165# define SYSCALL_INST_PAD \
166 or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0
167# else
168# define SYSCALL_INST_PAD
169# endif
170
171#define SYSCALL_INST0 trapa #0x10
172#define SYSCALL_INST1 trapa #0x11
173#define SYSCALL_INST2 trapa #0x12
174#define SYSCALL_INST3 trapa #0x13
175#define SYSCALL_INST4 trapa #0x14
176#define SYSCALL_INST5 mov.l @(0,r15),r0; trapa #0x15
177#define SYSCALL_INST6 mov.l @(0,r15),r0; mov.l @(4,r15),r1; trapa #0x16
178
179#undef DO_CALL
180#define DO_CALL(syscall_name, args) \
181 mov.l 1f,r3; \
182 SYSCALL_INST##args; \
183 SYSCALL_INST_PAD; \
184 bra 2f; \
185 nop; \
186 .align 2; \
187 1: .long SYS_ify (syscall_name); \
188 2:
189
190#else /* not __ASSEMBLER__ */
191
192#define SYSCALL_INST_STR0 "trapa #0x10\n\t"
193#define SYSCALL_INST_STR1 "trapa #0x11\n\t"
194#define SYSCALL_INST_STR2 "trapa #0x12\n\t"
195#define SYSCALL_INST_STR3 "trapa #0x13\n\t"
196#define SYSCALL_INST_STR4 "trapa #0x14\n\t"
197#define SYSCALL_INST_STR5 "trapa #0x15\n\t"
198#define SYSCALL_INST_STR6 "trapa #0x16\n\t"
199
200# ifdef NEED_SYSCALL_INST_PAD
201# define SYSCALL_INST_PAD "\
202 or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0"
203# else
204# define SYSCALL_INST_PAD
205# endif
206
207#define ASMFMT_0
208#define ASMFMT_1 \
209 , "r" (r4)
210#define ASMFMT_2 \
211 , "r" (r4), "r" (r5)
212#define ASMFMT_3 \
213 , "r" (r4), "r" (r5), "r" (r6)
214#define ASMFMT_4 \
215 , "r" (r4), "r" (r5), "r" (r6), "r" (r7)
216#define ASMFMT_5 \
217 , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0)
218#define ASMFMT_6 \
219 , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1)
220#define ASMFMT_7 \
221 , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1), "r" (r2)
222
223#define SUBSTITUTE_ARGS_0()
224#define SUBSTITUTE_ARGS_1(arg1) \
225 long int _arg1 = (long int) (arg1); \
226 register long int r4 asm ("%r4") = (long int) (_arg1)
227#define SUBSTITUTE_ARGS_2(arg1, arg2) \
228 long int _arg1 = (long int) (arg1); \
229 long int _arg2 = (long int) (arg2); \
230 register long int r4 asm ("%r4") = (long int) (_arg1); \
231 register long int r5 asm ("%r5") = (long int) (_arg2)
232#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3) \
233 long int _arg1 = (long int) (arg1); \
234 long int _arg2 = (long int) (arg2); \
235 long int _arg3 = (long int) (arg3); \
236 register long int r4 asm ("%r4") = (long int) (_arg1); \
237 register long int r5 asm ("%r5") = (long int) (_arg2); \
238 register long int r6 asm ("%r6") = (long int) (_arg3)
239#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4) \
240 long int _arg1 = (long int) (arg1); \
241 long int _arg2 = (long int) (arg2); \
242 long int _arg3 = (long int) (arg3); \
243 long int _arg4 = (long int) (arg4); \
244 register long int r4 asm ("%r4") = (long int) (_arg1); \
245 register long int r5 asm ("%r5") = (long int) (_arg2); \
246 register long int r6 asm ("%r6") = (long int) (_arg3); \
247 register long int r7 asm ("%r7") = (long int) (_arg4)
248#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) \
249 long int _arg1 = (long int) (arg1); \
250 long int _arg2 = (long int) (arg2); \
251 long int _arg3 = (long int) (arg3); \
252 long int _arg4 = (long int) (arg4); \
253 long int _arg5 = (long int) (arg5); \
254 register long int r4 asm ("%r4") = (long int) (_arg1); \
255 register long int r5 asm ("%r5") = (long int) (_arg2); \
256 register long int r6 asm ("%r6") = (long int) (_arg3); \
257 register long int r7 asm ("%r7") = (long int) (_arg4); \
258 register long int r0 asm ("%r0") = (long int) (_arg5)
259#define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
260 long int _arg1 = (long int) (arg1); \
261 long int _arg2 = (long int) (arg2); \
262 long int _arg3 = (long int) (arg3); \
263 long int _arg4 = (long int) (arg4); \
264 long int _arg5 = (long int) (arg5); \
265 long int _arg6 = (long int) (arg6); \
266 register long int r4 asm ("%r4") = (long int)(_arg1); \
267 register long int r5 asm ("%r5") = (long int) (_arg2); \
268 register long int r6 asm ("%r6") = (long int) (_arg3); \
269 register long int r7 asm ("%r7") = (long int) (_arg4); \
270 register long int r0 asm ("%r0") = (long int) (_arg5); \
271 register long int r1 asm ("%r1") = (long int) (_arg6)
272#define SUBSTITUTE_ARGS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
273 long int _arg1 = (long int) (arg1); \
274 long int _arg2 = (long int) (arg2); \
275 long int _arg3 = (long int) (arg3); \
276 long int _arg4 = (long int) (arg4); \
277 long int _arg5 = (long int) (arg5); \
278 long int _arg6 = (long int) (arg6); \
279 long int _arg7 = (long int) (arg7); \
280 register long int r4 asm ("%r4") = (long int) (_arg1); \
281 register long int r5 asm ("%r5") = (long int) (_arg2); \
282 register long int r6 asm ("%r6") = (long int) (_arg3); \
283 register long int r7 asm ("%r7") = (long int) (_arg4); \
284 register long int r0 asm ("%r0") = (long int) (_arg5); \
285 register long int r1 asm ("%r1") = (long int) (_arg6); \
286 register long int r2 asm ("%r2") = (long int) (_arg7)
287
288#undef INTERNAL_SYSCALL
289#define INTERNAL_SYSCALL(name, nr, args...) \
290 ({ \
291 unsigned long int resultvar; \
292 register long int r3 asm ("%r3") = SYS_ify (name); \
293 SUBSTITUTE_ARGS_##nr(args); \
294 \
295 asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
296 : "=z" (resultvar) \
297 : "r" (r3) ASMFMT_##nr \
298 : "memory", "t"); \
299 \
300 (int) resultvar; })
301
302/* The _NCS variant allows non-constant syscall numbers. */
303#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
304 ({ \
305 unsigned long int resultvar; \
306 register long int r3 asm ("%r3") = (name); \
307 SUBSTITUTE_ARGS_##nr(args); \
308 \
309 asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
310 : "=z" (resultvar) \
311 : "r" (r3) ASMFMT_##nr \
312 : "memory", "t"); \
313 \
314 (int) resultvar; })
315
316#endif /* __ASSEMBLER__ */
317
318#endif /* linux/sh/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/xstatver.h deleted-13
......@@ -1,13 +0,0 @@
1/* Versions of the 'struct stat' data structure used in compatibility xstat
2 functions. */
3#define _STAT_VER_LINUX_OLD 1
4#define _STAT_VER_KERNEL 1
5#define _STAT_VER_SVR4 2
6#define _STAT_VER_LINUX 3
7#define _STAT_VER _STAT_VER_LINUX
8
9/* Versions of the 'xmknod' interface used in compatibility xmknod
10 functions. */
11#define _MKNOD_VER_LINUX 1
12#define _MKNOD_VER_SVR4 2
13#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/musl/src/fenv/sh/fenv-nofpu.c deleted-3
......@@ -1,3 +0,0 @@
1#if !__SH_FPU_ANY__ && !__SH4__
2#include "../fenv.c"
3#endif
lib/libc/musl/src/fenv/sh/fenv.S deleted-81
......@@ -1,81 +0,0 @@
1#if __SH_FPU_ANY__ || __SH4__
2
3.global fegetround
4.type fegetround, @function
5fegetround:
6 sts fpscr, r0
7 rts
8 and #3, r0
9
10.global __fesetround
11.hidden __fesetround
12.type __fesetround, @function
13__fesetround:
14 sts fpscr, r0
15 mov #-4, r1
16 and r1, r0
17 or r4, r0
18 lds r0, fpscr
19 rts
20 mov #0, r0
21
22.global fetestexcept
23.type fetestexcept, @function
24fetestexcept:
25 sts fpscr, r0
26 and r4, r0
27 rts
28 and #0x7c, r0
29
30.global feclearexcept
31.type feclearexcept, @function
32feclearexcept:
33 mov r4, r0
34 and #0x7c, r0
35 not r0, r4
36 sts fpscr, r0
37 and r4, r0
38 lds r0, fpscr
39 rts
40 mov #0, r0
41
42.global feraiseexcept
43.type feraiseexcept, @function
44feraiseexcept:
45 mov r4, r0
46 and #0x7c, r0
47 sts fpscr, r4
48 or r4, r0
49 lds r0, fpscr
50 rts
51 mov #0, r0
52
53.global fegetenv
54.type fegetenv, @function
55fegetenv:
56 sts fpscr, r0
57 mov.l r0, @r4
58 rts
59 mov #0, r0
60
61.global fesetenv
62.type fesetenv, @function
63fesetenv:
64 mov r4, r0
65 cmp/eq #-1, r0
66 bf 1f
67
68 ! the default environment is complicated by the fact that we need to
69 ! preserve the current precision bit, which we do not know a priori
70 sts fpscr, r0
71 mov #8, r1
72 swap.w r1, r1
73 bra 2f
74 and r1, r0
75
761: mov.l @r4, r0 ! non-default environment
772: lds r0, fpscr
78 rts
79 mov #0, r0
80
81#endif
lib/libc/musl/src/internal/sh/__shcall.c deleted-6
......@@ -1,6 +0,0 @@
1#include <features.h>
2
3hidden int __shcall(void *arg, int (*func)(void *))
4{
5 return func(arg);
6}
lib/libc/musl/src/ldso/microblaze/dlsym.s deleted-6
......@@ -1,6 +0,0 @@
1.global dlsym
2.hidden __dlsym
3.type dlsym,@function
4dlsym:
5 brid __dlsym
6 add r7, r15, r0
lib/libc/musl/src/ldso/microblaze/dlsym_time64.S deleted-3
......@@ -1,3 +0,0 @@
1#define __dlsym __dlsym_redir_time64
2#define dlsym __dlsym_time64
3#include "dlsym.s"
lib/libc/musl/src/ldso/or1k/dlsym.s deleted-6
......@@ -1,6 +0,0 @@
1.global dlsym
2.hidden __dlsym
3.type dlsym,@function
4dlsym:
5 l.j __dlsym
6 l.ori r5, r9, 0
lib/libc/musl/src/ldso/or1k/dlsym_time64.S deleted-3
......@@ -1,3 +0,0 @@
1#define __dlsym __dlsym_redir_time64
2#define dlsym __dlsym_time64
3#include "dlsym.s"
lib/libc/musl/src/ldso/sh/dlsym.s deleted-11
......@@ -1,11 +0,0 @@
1.text
2.global dlsym
3.hidden __dlsym
4.type dlsym, @function
5dlsym:
6 mov.l L1, r0
71: braf r0
8 sts pr, r6
9
10.align 2
11L1: .long __dlsym@PLT-(1b+4-.)
lib/libc/musl/src/ldso/sh/dlsym_time64.S deleted-3
......@@ -1,3 +0,0 @@
1#define __dlsym __dlsym_redir_time64
2#define dlsym __dlsym_time64
3#include "dlsym.s"
lib/libc/musl/src/process/sh/vfork.s deleted-20
......@@ -1,20 +0,0 @@
1.global vfork
2.type vfork,@function
3vfork:
4 mov #95, r3
5 add r3, r3
6
7 trapa #31
8 or r0, r0
9 or r0, r0
10 or r0, r0
11 or r0, r0
12 or r0, r0
13
14 mov r0, r4
15 mov.l 1f, r0
162: braf r0
17 nop
18 .align 2
19 .hidden __syscall_ret
201: .long __syscall_ret@PLT-(2b+4-.)
lib/libc/musl/src/setjmp/microblaze/longjmp.s deleted-29
......@@ -1,29 +0,0 @@
1.global _longjmp
2.global longjmp
3.type _longjmp,@function
4.type longjmp,@function
5_longjmp:
6longjmp:
7 addi r3, r6, 0
8 bnei r3, 1f
9 addi r3, r3, 1
101: lwi r1, r5, 0
11 lwi r15, r5, 4
12 lwi r2, r5, 8
13 lwi r13, r5, 12
14 lwi r18, r5, 16
15 lwi r19, r5, 20
16 lwi r20, r5, 24
17 lwi r21, r5, 28
18 lwi r22, r5, 32
19 lwi r23, r5, 36
20 lwi r24, r5, 40
21 lwi r25, r5, 44
22 lwi r26, r5, 48
23 lwi r27, r5, 52
24 lwi r28, r5, 56
25 lwi r29, r5, 60
26 lwi r30, r5, 64
27 lwi r31, r5, 68
28 rtsd r15, 8
29 nop
lib/libc/musl/src/setjmp/microblaze/setjmp.s deleted-32
......@@ -1,32 +0,0 @@
1.global ___setjmp
2.hidden ___setjmp
3.global __setjmp
4.global _setjmp
5.global setjmp
6.type __setjmp,@function
7.type _setjmp,@function
8.type setjmp,@function
9___setjmp:
10__setjmp:
11_setjmp:
12setjmp:
13 swi r1, r5, 0
14 swi r15, r5, 4
15 swi r2, r5, 8
16 swi r13, r5, 12
17 swi r18, r5, 16
18 swi r19, r5, 20
19 swi r20, r5, 24
20 swi r21, r5, 28
21 swi r22, r5, 32
22 swi r23, r5, 36
23 swi r24, r5, 40
24 swi r25, r5, 44
25 swi r26, r5, 48
26 swi r27, r5, 52
27 swi r28, r5, 56
28 swi r29, r5, 60
29 swi r30, r5, 64
30 swi r31, r5, 68
31 rtsd r15, 8
32 ori r3, r0, 0
lib/libc/musl/src/setjmp/or1k/longjmp.s deleted-25
......@@ -1,25 +0,0 @@
1.global _longjmp
2.global longjmp
3.type _longjmp,@function
4.type longjmp,@function
5_longjmp:
6longjmp:
7 l.sfeqi r4, 0
8 l.bnf 1f
9 l.addi r11, r4,0
10 l.ori r11, r0, 1
111: l.lwz r1, 0(r3)
12 l.lwz r2, 4(r3)
13 l.lwz r9, 8(r3)
14 l.lwz r10, 12(r3)
15 l.lwz r14, 16(r3)
16 l.lwz r16, 20(r3)
17 l.lwz r18, 24(r3)
18 l.lwz r20, 28(r3)
19 l.lwz r22, 32(r3)
20 l.lwz r24, 36(r3)
21 l.lwz r26, 40(r3)
22 l.lwz r28, 44(r3)
23 l.lwz r30, 48(r3)
24 l.jr r9
25 l.nop
lib/libc/musl/src/setjmp/or1k/setjmp.s deleted-27
......@@ -1,27 +0,0 @@
1.global ___setjmp
2.hidden ___setjmp
3.global __setjmp
4.global _setjmp
5.global setjmp
6.type __setjmp,@function
7.type _setjmp,@function
8.type setjmp,@function
9___setjmp:
10__setjmp:
11_setjmp:
12setjmp:
13 l.sw 0(r3), r1
14 l.sw 4(r3), r2
15 l.sw 8(r3), r9
16 l.sw 12(r3), r10
17 l.sw 16(r3), r14
18 l.sw 20(r3), r16
19 l.sw 24(r3), r18
20 l.sw 28(r3), r20
21 l.sw 32(r3), r22
22 l.sw 36(r3), r24
23 l.sw 40(r3), r26
24 l.sw 44(r3), r28
25 l.sw 48(r3), r30
26 l.jr r9
27 l.ori r11,r0,0
lib/libc/musl/src/setjmp/sh/longjmp.S deleted-28
......@@ -1,28 +0,0 @@
1.global _longjmp
2.global longjmp
3.type _longjmp, @function
4.type longjmp, @function
5_longjmp:
6longjmp:
7 mov.l @r4+, r8
8 mov.l @r4+, r9
9 mov.l @r4+, r10
10 mov.l @r4+, r11
11 mov.l @r4+, r12
12 mov.l @r4+, r13
13 mov.l @r4+, r14
14 mov.l @r4+, r15
15 lds.l @r4+, pr
16#if __SH_FPU_ANY__ || __SH4__
17 fmov.s @r4+, fr12
18 fmov.s @r4+, fr13
19 fmov.s @r4+, fr14
20 fmov.s @r4+, fr15
21#endif
22
23 tst r5, r5
24 movt r0
25 add r5, r0
26
27 rts
28 nop
lib/libc/musl/src/setjmp/sh/setjmp.S deleted-32
......@@ -1,32 +0,0 @@
1.global ___setjmp
2.hidden ___setjmp
3.global __setjmp
4.global _setjmp
5.global setjmp
6.type __setjmp, @function
7.type _setjmp, @function
8.type setjmp, @function
9___setjmp:
10__setjmp:
11_setjmp:
12setjmp:
13#if __SH_FPU_ANY__ || __SH4__
14 add #52, r4
15 fmov.s fr15, @-r4
16 fmov.s fr14, @-r4
17 fmov.s fr13, @-r4
18 fmov.s fr12, @-r4
19#else
20 add #36, r4
21#endif
22 sts.l pr, @-r4
23 mov.l r15, @-r4
24 mov.l r14, @-r4
25 mov.l r13, @-r4
26 mov.l r12, @-r4
27 mov.l r11, @-r4
28 mov.l r10, @-r4
29 mov.l r9, @-r4
30 mov.l r8, @-r4
31 rts
32 mov #0, r0
lib/libc/musl/src/signal/microblaze/restore.s deleted-13
......@@ -1,13 +0,0 @@
1.global __restore
2.hidden __restore
3.type __restore,@function
4__restore:
5 ori r12, r0, 119
6 brki r14, 0x8
7
8.global __restore_rt
9.hidden __restore_rt
10.type __restore_rt,@function
11__restore_rt:
12 ori r12, r0, 173
13 brki r14, 0x8
lib/libc/musl/src/signal/microblaze/sigsetjmp.s deleted-22
......@@ -1,22 +0,0 @@
1.global sigsetjmp
2.global __sigsetjmp
3.type sigsetjmp,@function
4.type __sigsetjmp,@function
5sigsetjmp:
6__sigsetjmp:
7.hidden ___setjmp
8 beqi r6, ___setjmp
9
10 swi r15,r5,72
11 swi r19,r5,72+4+8
12
13 brlid r15,___setjmp
14 ori r19,r5,0
15
16 ori r6,r3,0
17 ori r5,r19,0
18 lwi r15,r5,72
19 lwi r19,r5,72+4+8
20
21.hidden __sigsetjmp_tail
22 bri __sigsetjmp_tail
lib/libc/musl/src/signal/or1k/sigsetjmp.s deleted-24
......@@ -1,24 +0,0 @@
1.global sigsetjmp
2.global __sigsetjmp
3.type sigsetjmp,@function
4.type __sigsetjmp,@function
5sigsetjmp:
6__sigsetjmp:
7 l.sfeq r4, r0
8.hidden ___setjmp
9 l.bf ___setjmp
10
11 l.sw 52(r3), r9
12 l.sw 52+4+8(r3), r20
13
14 l.jal ___setjmp
15 l.ori r20, r3, 0
16
17 l.ori r4, r11, 0
18 l.ori r3, r20, 0
19
20 l.lwz r9, 52(r3)
21
22.hidden __sigsetjmp_tail
23 l.j __sigsetjmp_tail
24 l.lwz r20, 52+4+8(r3)
lib/libc/musl/src/signal/sh/restore.s deleted-24
......@@ -1,24 +0,0 @@
1.global __restore
2.hidden __restore
3__restore:
4 mov #119, r3 !__NR_sigreturn
5 trapa #31
6
7 or r0, r0
8 or r0, r0
9 or r0, r0
10 or r0, r0
11 or r0, r0
12
13.global __restore_rt
14.hidden __restore_rt
15__restore_rt:
16 mov #100, r3 !__NR_rt_sigreturn
17 add #73, r3
18 trapa #31
19
20 or r0, r0
21 or r0, r0
22 or r0, r0
23 or r0, r0
24 or r0, r0
lib/libc/musl/src/signal/sh/sigsetjmp.s deleted-41
......@@ -1,41 +0,0 @@
1.global sigsetjmp
2.global __sigsetjmp
3.type sigsetjmp,@function
4.type __sigsetjmp,@function
5sigsetjmp:
6__sigsetjmp:
7 tst r5, r5
8 bt 9f
9
10 mov r4, r6
11 add #60, r6
12 sts pr, r0
13 mov.l r0, @r6
14 mov.l r8, @(4+8,r6)
15
16 mov.l 1f, r0
172: bsrf r0
18 mov r4, r8
19
20 mov r0, r5
21 mov r8, r4
22 mov r4, r6
23 add #60, r6
24
25 mov.l @r6, r0
26 lds r0, pr
27
28 mov.l 3f, r0
294: braf r0
30 mov.l @(4+8,r6), r8
31
329: mov.l 5f, r0
336: braf r0
34 nop
35
36.align 2
37.hidden ___setjmp
381: .long ___setjmp@PLT-(2b+4-.)
39.hidden __sigsetjmp_tail
403: .long __sigsetjmp_tail@PLT-(4b+4-.)
415: .long ___setjmp@PLT-(6b+4-.)
lib/libc/musl/src/thread/microblaze/__set_thread_area.s deleted-7
......@@ -1,7 +0,0 @@
1.global __set_thread_area
2.hidden __set_thread_area
3.type __set_thread_area,@function
4__set_thread_area:
5 ori r21, r5, 0
6 rtsd r15, 8
7 ori r3, r0, 0
lib/libc/musl/src/thread/microblaze/__unmapself.s deleted-8
......@@ -1,8 +0,0 @@
1.global __unmapself
2.type __unmapself,@function
3__unmapself:
4 ori r12, r0, 91
5 brki r14, 0x8
6 ori r12, r0, 1
7 brki r14, 0x8
8 nop
lib/libc/musl/src/thread/microblaze/clone.s deleted-31
......@@ -1,31 +0,0 @@
1.global __clone
2.hidden __clone
3.type __clone,@function
4
5# r5, r6, r7, r8, r9, r10, stack
6# fn, st, fl, ar, pt, tl, ct
7# fl, st, __, pt, ct, tl
8
9__clone:
10 andi r6, r6, -16
11 addi r6, r6, -16
12 swi r5, r6, 0
13 swi r8, r6, 4
14
15 ori r5, r7, 0
16 ori r8, r9, 0
17 lwi r9, r1, 28
18 ori r12, r0, 120
19
20 brki r14, 8
21 beqi r3, 1f
22 rtsd r15, 8
23 nop
24
251: add r19, r0, r0
26 lwi r3, r1, 0
27 lwi r5, r1, 4
28 brald r15, r3
29 nop
30 ori r12, r0, 1
31 brki r14, 8
lib/libc/musl/src/thread/microblaze/syscall_cp.s deleted-27
......@@ -1,27 +0,0 @@
1.global __cp_begin
2.hidden __cp_begin
3.global __cp_end
4.hidden __cp_end
5.global __cp_cancel
6.hidden __cp_cancel
7.hidden __cancel
8.global __syscall_cp_asm
9.hidden __syscall_cp_asm
10.type __syscall_cp_asm,@function
11__syscall_cp_asm:
12__cp_begin:
13 lwi r5, r5, 0
14 bnei r5, __cp_cancel
15 addi r12, r6, 0
16 add r5, r7, r0
17 add r6, r8, r0
18 add r7, r9, r0
19 add r8, r10, r0
20 lwi r9, r1, 28
21 lwi r10, r1, 32
22 brki r14, 0x8
23__cp_end:
24 rtsd r15, 8
25 nop
26__cp_cancel:
27 bri __cancel
lib/libc/musl/src/thread/or1k/__set_thread_area.s deleted-7
......@@ -1,7 +0,0 @@
1.global __set_thread_area
2.hidden __set_thread_area
3.type __set_thread_area,@function
4__set_thread_area:
5 l.ori r10, r3, 0
6 l.jr r9
7 l.ori r11, r0, 0
lib/libc/musl/src/thread/or1k/__unmapself.s deleted-8
......@@ -1,8 +0,0 @@
1.global __unmapself
2.type __unmapself,@function
3__unmapself:
4 l.ori r11, r0, 215 /* __NR_munmap */
5 l.sys 1
6 l.ori r3, r0, 0
7 l.ori r11, r0, 93 /* __NR_exit */
8 l.sys 1
lib/libc/musl/src/thread/or1k/clone.s deleted-32
......@@ -1,32 +0,0 @@
1/* int clone(fn, stack, flags, arg, ptid, tls, ctid)
2 * r3 r4 r5 r6 sp+0 sp+4 sp+8
3 * sys_clone(flags, stack, ptid, ctid, tls)
4 */
5.global __clone
6.hidden __clone
7.type __clone,@function
8__clone:
9 l.addi r4, r4, -8
10 l.sw 0(r4), r3
11 l.sw 4(r4), r6
12 /* (fn, st, fl, ar, pt, tl, ct) => (fl, st, pt, ct, tl) */
13 l.ori r3, r5, 0
14 l.lwz r5, 0(r1)
15 l.lwz r6, 8(r1)
16 l.lwz r7, 4(r1)
17 l.ori r11, r0, 220 /* __NR_clone */
18 l.sys 1
19
20 l.sfeqi r11, 0
21 l.bf 1f
22 l.nop
23 l.jr r9
24 l.nop
25
261: l.ori r2, r0, 0
27 l.lwz r11, 0(r1)
28 l.jalr r11
29 l.lwz r3, 4(r1)
30
31 l.ori r11, r0, 93 /* __NR_exit */
32 l.sys 1
lib/libc/musl/src/thread/or1k/syscall_cp.s deleted-29
......@@ -1,29 +0,0 @@
1.global __cp_begin
2.hidden __cp_begin
3.global __cp_end
4.hidden __cp_end
5.global __cp_cancel
6.hidden __cp_cancel
7.hidden __cancel
8.global __syscall_cp_asm
9.hidden __syscall_cp_asm
10.type __syscall_cp_asm,@function
11__syscall_cp_asm:
12__cp_begin:
13 l.lwz r3, 0(r3)
14 l.sfeqi r3, 0
15 l.bnf __cp_cancel
16 l.ori r11, r4, 0
17 l.ori r3, r5, 0
18 l.ori r4, r6, 0
19 l.ori r5, r7, 0
20 l.ori r6, r8, 0
21 l.lwz r7, 0(r1)
22 l.lwz r8, 4(r1)
23 l.sys 1
24__cp_end:
25 l.jr r9
26 l.nop
27__cp_cancel:
28 l.j __cancel
29 l.nop
lib/libc/musl/src/thread/sh/__set_thread_area.c deleted-37
......@@ -1,37 +0,0 @@
1#include "pthread_impl.h"
2#include "libc.h"
3#include <elf.h>
4
5/* Also perform sh-specific init */
6
7#define CPU_HAS_LLSC 0x0040
8#define CPU_HAS_CAS_L 0x0400
9
10extern hidden const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[];
11
12hidden const void *__sh_cas_ptr;
13
14hidden unsigned __sh_nommu;
15
16int __set_thread_area(void *p)
17{
18 size_t *aux;
19 __asm__ __volatile__ ( "ldc %0, gbr" : : "r"(p) : "memory" );
20#ifndef __SH4A__
21 __sh_cas_ptr = __sh_cas_gusa;
22#if !defined(__SH3__) && !defined(__SH4__)
23 for (aux=libc.auxv; *aux; aux+=2) {
24 if (*aux != AT_PLATFORM) continue;
25 const char *s = (void *)aux[1];
26 if (s[0]!='s' || s[1]!='h' || s[2]!='2' || s[3]-'0'<10u) break;
27 __sh_cas_ptr = __sh_cas_imask;
28 __sh_nommu = 1;
29 }
30#endif
31 if (__hwcap & CPU_HAS_CAS_L)
32 __sh_cas_ptr = __sh_cas_cas_l;
33 else if (__hwcap & CPU_HAS_LLSC)
34 __sh_cas_ptr = __sh_cas_llsc;
35#endif
36 return 0;
37}
lib/libc/musl/src/thread/sh/__unmapself.c deleted-24
......@@ -1,24 +0,0 @@
1#include "pthread_impl.h"
2
3hidden void __unmapself_sh_mmu(void *, size_t);
4hidden void __unmapself_sh_nommu(void *, size_t);
5
6#if !defined(__SH3__) && !defined(__SH4__)
7#define __unmapself __unmapself_sh_nommu
8#include "dynlink.h"
9#undef CRTJMP
10#define CRTJMP(pc,sp) __asm__ __volatile__( \
11 "mov.l @%0+,r0 ; mov.l @%0,r12 ; jmp @r0 ; mov %1,r15" \
12 : : "r"(pc), "r"(sp) : "r0", "memory" )
13#include "../__unmapself.c"
14#undef __unmapself
15extern hidden unsigned __sh_nommu;
16#else
17#define __sh_nommu 0
18#endif
19
20void __unmapself(void *base, size_t size)
21{
22 if (__sh_nommu) __unmapself_sh_nommu(base, size);
23 else __unmapself_sh_mmu(base, size);
24}
lib/libc/musl/src/thread/sh/__unmapself_mmu.s deleted-23
......@@ -1,23 +0,0 @@
1.text
2.global __unmapself_sh_mmu
3.hidden __unmapself_sh_mmu
4.type __unmapself_sh_mmu, @function
5__unmapself_sh_mmu:
6 mov #91, r3 ! SYS_munmap
7 trapa #31
8
9 or r0, r0
10 or r0, r0
11 or r0, r0
12 or r0, r0
13 or r0, r0
14
15 mov #1, r3 ! SYS_exit
16 mov #0, r4
17 trapa #31
18
19 or r0, r0
20 or r0, r0
21 or r0, r0
22 or r0, r0
23 or r0, r0
lib/libc/musl/src/thread/sh/atomics.s deleted-65
......@@ -1,65 +0,0 @@
1/* Contract for all versions is same as cas.l r2,r3,@r0
2 * pr and r1 are also clobbered (by jsr & r1 as temp).
3 * r0,r2,r4-r15 must be preserved.
4 * r3 contains result (==r2 iff cas succeeded). */
5
6 .align 2
7.global __sh_cas_gusa
8.hidden __sh_cas_gusa
9__sh_cas_gusa:
10 mov.l r5,@-r15
11 mov.l r4,@-r15
12 mov r0,r4
13 mova 1f,r0
14 mov r15,r1
15 mov #(0f-1f),r15
160: mov.l @r4,r5
17 cmp/eq r5,r2
18 bf 1f
19 mov.l r3,@r4
201: mov r1,r15
21 mov r5,r3
22 mov r4,r0
23 mov.l @r15+,r4
24 rts
25 mov.l @r15+,r5
26
27.global __sh_cas_llsc
28.hidden __sh_cas_llsc
29__sh_cas_llsc:
30 mov r0,r1
31 .word 0x00ab /* synco */
320: .word 0x0163 /* movli.l @r1,r0 */
33 cmp/eq r0,r2
34 bf 1f
35 mov r3,r0
36 .word 0x0173 /* movco.l r0,@r1 */
37 bf 0b
38 mov r2,r0
391: .word 0x00ab /* synco */
40 mov r0,r3
41 rts
42 mov r1,r0
43
44.global __sh_cas_imask
45.hidden __sh_cas_imask
46__sh_cas_imask:
47 mov r0,r1
48 stc sr,r0
49 mov.l r0,@-r15
50 or #0xf0,r0
51 ldc r0,sr
52 mov.l @r1,r0
53 cmp/eq r0,r2
54 bf 1f
55 mov.l r3,@r1
561: ldc.l @r15+,sr
57 mov r0,r3
58 rts
59 mov r1,r0
60
61.global __sh_cas_cas_l
62.hidden __sh_cas_cas_l
63__sh_cas_cas_l:
64 rts
65 .word 0x2323 /* cas.l r2,r3,@r0 */
lib/libc/musl/src/thread/sh/clone.s deleted-54
......@@ -1,54 +0,0 @@
1.text
2.global __clone
3.hidden __clone
4.type __clone, @function
5__clone:
6! incoming: fn stack flags arg ptid tls ctid
7! r4 r5 r6 r7 @r15 @(4,r15) @(8,r15)
8
9 mov #-16, r0
10 and r0, r5
11
12 mov r4, r1 ! r1 = fn
13 mov r7, r2 ! r2 = arg
14
15 mov #120, r3 ! r3 = __NR_clone
16 mov r6, r4 ! r4 = flags
17 !mov r5, r5 ! r5 = stack
18 mov.l @r15, r6 ! r6 = ptid
19 mov.l @(8,r15), r7 ! r7 = ctid
20 mov.l @(4,r15), r0 ! r0 = tls
21 trapa #31
22
23 or r0, r0
24 or r0, r0
25 or r0, r0
26 or r0, r0
27 or r0, r0
28
29 cmp/eq #0, r0
30 bt 1f
31
32 ! we are the parent, return
33 rts
34 nop
35
361: ! we are the child, call fn(arg)
37 mov.l 1f, r0
38 mov r1, r5
39 bsrf r0
40 mov r2, r4
41
422: mov #1, r3 ! __NR_exit
43 mov r0, r4
44 trapa #31
45
46 or r0, r0
47 or r0, r0
48 or r0, r0
49 or r0, r0
50 or r0, r0
51
52.align 2
53.hidden __shcall
541: .long __shcall@PCREL+(.-2b)
lib/libc/musl/src/thread/sh/syscall_cp.s deleted-45
......@@ -1,45 +0,0 @@
1.text
2.global __cp_begin
3.hidden __cp_begin
4.global __cp_end
5.hidden __cp_end
6.global __cp_cancel
7.hidden __cp_cancel
8.hidden __cancel
9.global __syscall_cp_asm
10.hidden __syscall_cp_asm
11.type __syscall_cp_asm, @function
12__syscall_cp_asm:
13
14__cp_begin:
15 mov.l @r4, r4
16 tst r4, r4
17 bf __cp_cancel
18 mov r5, r3
19 mov r6, r4
20 mov r7, r5
21 mov.l @r15, r6
22 mov.l @(4,r15), r7
23 mov.l @(8,r15), r0
24 mov.l @(12,r15), r1
25 trapa #31
26
27__cp_end:
28 ! work around hardware bug
29 or r0, r0
30 or r0, r0
31 or r0, r0
32 or r0, r0
33 or r0, r0
34
35 rts
36 nop
37
38__cp_cancel:
39 mov.l 2f, r0
40 braf r0
41 nop
421:
43
44.align 2
452: .long __cancel@PCREL-(1b-.)
lib/libc/musl/src/unistd/sh/pipe.s deleted-27
......@@ -1,27 +0,0 @@
1.global pipe
2.type pipe, @function
3pipe:
4 mov #42, r3
5 trapa #31
6
7 ! work around hardware bug
8 or r0, r0
9 or r0, r0
10 or r0, r0
11 or r0, r0
12 or r0, r0
13
14 cmp/pz r0
15 bt 1f
16
17 mov.l L1, r1
18 braf r1
19 mov r0, r4
20
211: mov.l r0, @(0,r4)
22 mov.l r1, @(4,r4)
23 rts
24 mov #0, r0
25
26.align 2
27L1: .long __syscall_ret@PLT-(1b-.)
src/musl.zig-36
......@@ -685,8 +685,6 @@ const src_files = [_][]const u8{
685685 "musl/src/fenv/riscv64/fenv.S",
686686 "musl/src/fenv/riscv64/fenv-sf.c",
687687 "musl/src/fenv/s390x/fenv.c",
688 "musl/src/fenv/sh/fenv-nofpu.c",
689 "musl/src/fenv/sh/fenv.S",
690688 "musl/src/fenv/x32/fenv.s",
691689 "musl/src/fenv/x86_64/fenv.s",
692690 "musl/src/internal/defsysinfo.c",
......@@ -697,7 +695,6 @@ const src_files = [_][]const u8{
697695 "musl/src/internal/libc.c",
698696 "musl/src/internal/procfdname.c",
699697 "musl/src/internal/shgetc.c",
700 "musl/src/internal/sh/__shcall.c",
701698 "musl/src/internal/syscall_ret.c",
702699 "musl/src/internal/vdso.c",
703700 "musl/src/internal/version.c",
......@@ -734,15 +731,11 @@ const src_files = [_][]const u8{
734731 "musl/src/ldso/loongarch64/dlsym.s",
735732 "musl/src/ldso/m68k/dlsym.s",
736733 "musl/src/ldso/m68k/dlsym_time64.S",
737 "musl/src/ldso/microblaze/dlsym.s",
738 "musl/src/ldso/microblaze/dlsym_time64.S",
739734 "musl/src/ldso/mips64/dlsym.s",
740735 "musl/src/ldso/mips/dlsym.s",
741736 "musl/src/ldso/mips/dlsym_time64.S",
742737 "musl/src/ldso/mipsn32/dlsym.s",
743738 "musl/src/ldso/mipsn32/dlsym_time64.S",
744 "musl/src/ldso/or1k/dlsym.s",
745 "musl/src/ldso/or1k/dlsym_time64.S",
746739 "musl/src/ldso/powerpc64/dlsym.s",
747740 "musl/src/ldso/powerpc/dlsym.s",
748741 "musl/src/ldso/powerpc/dlsym_time64.S",
......@@ -750,8 +743,6 @@ const src_files = [_][]const u8{
750743 "musl/src/ldso/riscv64/dlsym.s",
751744 "musl/src/ldso/riscv64/tlsdesc.s",
752745 "musl/src/ldso/s390x/dlsym.s",
753 "musl/src/ldso/sh/dlsym.s",
754 "musl/src/ldso/sh/dlsym_time64.S",
755746 "musl/src/ldso/tlsdesc.c",
756747 "musl/src/ldso/x32/dlsym.s",
757748 "musl/src/ldso/x86_64/dlsym.s",
......@@ -1596,7 +1587,6 @@ const src_files = [_][]const u8{
15961587 "musl/src/process/posix_spawnp.c",
15971588 "musl/src/process/riscv64/vfork.s",
15981589 "musl/src/process/s390x/vfork.s",
1599 "musl/src/process/sh/vfork.s",
16001590 "musl/src/process/system.c",
16011591 "musl/src/process/vfork.c",
16021592 "musl/src/process/wait.c",
......@@ -1643,16 +1633,12 @@ const src_files = [_][]const u8{
16431633 "musl/src/setjmp/loongarch64/setjmp.S",
16441634 "musl/src/setjmp/m68k/longjmp.s",
16451635 "musl/src/setjmp/m68k/setjmp.s",
1646 "musl/src/setjmp/microblaze/longjmp.s",
1647 "musl/src/setjmp/microblaze/setjmp.s",
16481636 "musl/src/setjmp/mips64/longjmp.S",
16491637 "musl/src/setjmp/mips64/setjmp.S",
16501638 "musl/src/setjmp/mips/longjmp.S",
16511639 "musl/src/setjmp/mipsn32/longjmp.S",
16521640 "musl/src/setjmp/mipsn32/setjmp.S",
16531641 "musl/src/setjmp/mips/setjmp.S",
1654 "musl/src/setjmp/or1k/longjmp.s",
1655 "musl/src/setjmp/or1k/setjmp.s",
16561642 "musl/src/setjmp/powerpc64/longjmp.s",
16571643 "musl/src/setjmp/powerpc64/setjmp.s",
16581644 "musl/src/setjmp/powerpc/longjmp.S",
......@@ -1664,8 +1650,6 @@ const src_files = [_][]const u8{
16641650 "musl/src/setjmp/s390x/longjmp.s",
16651651 "musl/src/setjmp/s390x/setjmp.s",
16661652 "musl/src/setjmp/setjmp.c",
1667 "musl/src/setjmp/sh/longjmp.S",
1668 "musl/src/setjmp/sh/setjmp.S",
16691653 "musl/src/setjmp/x32/longjmp.s",
16701654 "musl/src/setjmp/x32/setjmp.s",
16711655 "musl/src/setjmp/x86_64/longjmp.s",
......@@ -1683,12 +1667,9 @@ const src_files = [_][]const u8{
16831667 "musl/src/signal/loongarch64/restore.s",
16841668 "musl/src/signal/loongarch64/sigsetjmp.s",
16851669 "musl/src/signal/m68k/sigsetjmp.s",
1686 "musl/src/signal/microblaze/restore.s",
1687 "musl/src/signal/microblaze/sigsetjmp.s",
16881670 "musl/src/signal/mips64/sigsetjmp.s",
16891671 "musl/src/signal/mipsn32/sigsetjmp.s",
16901672 "musl/src/signal/mips/sigsetjmp.s",
1691 "musl/src/signal/or1k/sigsetjmp.s",
16921673 "musl/src/signal/powerpc64/restore.s",
16931674 "musl/src/signal/powerpc64/sigsetjmp.s",
16941675 "musl/src/signal/powerpc/restore.s",
......@@ -1704,8 +1685,6 @@ const src_files = [_][]const u8{
17041685 "musl/src/signal/s390x/restore.s",
17051686 "musl/src/signal/s390x/sigsetjmp.s",
17061687 "musl/src/signal/setitimer.c",
1707 "musl/src/signal/sh/restore.s",
1708 "musl/src/signal/sh/sigsetjmp.s",
17091688 "musl/src/signal/sigaction.c",
17101689 "musl/src/signal/sigaddset.c",
17111690 "musl/src/signal/sigaltstack.c",
......@@ -2027,10 +2006,6 @@ const src_files = [_][]const u8{
20272006 "musl/src/thread/m68k/clone.s",
20282007 "musl/src/thread/m68k/__m68k_read_tp.s",
20292008 "musl/src/thread/m68k/syscall_cp.s",
2030 "musl/src/thread/microblaze/clone.s",
2031 "musl/src/thread/microblaze/__set_thread_area.s",
2032 "musl/src/thread/microblaze/syscall_cp.s",
2033 "musl/src/thread/microblaze/__unmapself.s",
20342009 "musl/src/thread/mips64/clone.s",
20352010 "musl/src/thread/mips64/syscall_cp.s",
20362011 "musl/src/thread/mips64/__unmapself.s",
......@@ -2046,10 +2021,6 @@ const src_files = [_][]const u8{
20462021 "musl/src/thread/mtx_timedlock.c",
20472022 "musl/src/thread/mtx_trylock.c",
20482023 "musl/src/thread/mtx_unlock.c",
2049 "musl/src/thread/or1k/clone.s",
2050 "musl/src/thread/or1k/__set_thread_area.s",
2051 "musl/src/thread/or1k/syscall_cp.s",
2052 "musl/src/thread/or1k/__unmapself.s",
20532024 "musl/src/thread/powerpc64/clone.s",
20542025 "musl/src/thread/powerpc64/__set_thread_area.s",
20552026 "musl/src/thread/powerpc64/syscall_cp.s",
......@@ -2167,12 +2138,6 @@ const src_files = [_][]const u8{
21672138 "musl/src/thread/sem_unlink.c",
21682139 "musl/src/thread/sem_wait.c",
21692140 "musl/src/thread/__set_thread_area.c",
2170 "musl/src/thread/sh/atomics.s",
2171 "musl/src/thread/sh/clone.s",
2172 "musl/src/thread/sh/__set_thread_area.c",
2173 "musl/src/thread/sh/syscall_cp.s",
2174 "musl/src/thread/sh/__unmapself.c",
2175 "musl/src/thread/sh/__unmapself_mmu.s",
21762141 "musl/src/thread/synccall.c",
21772142 "musl/src/thread/__syscall_cp.c",
21782143 "musl/src/thread/syscall_cp.c",
......@@ -2305,7 +2270,6 @@ const src_files = [_][]const u8{
23052270 "musl/src/unistd/setsid.c",
23062271 "musl/src/unistd/setuid.c",
23072272 "musl/src/unistd/setxid.c",
2308 "musl/src/unistd/sh/pipe.s",
23092273 "musl/src/unistd/sleep.c",
23102274 "musl/src/unistd/symlinkat.c",
23112275 "musl/src/unistd/symlink.c",