| author | |
| committer | |
| log | 06945d5eb7db3cb95adbf2abb5e5ae39f47e5c8f |
| tree | 70c308a40354106defd333bb2f4e7cfa452ede97 |
| parent | 9eb66ab3fb796daf92bd38d548aadf44cceaa592 |
| signature |
4 files changed, 184 insertions(+), 0 deletions(-)
lib/libc/glibc/sysdeps/arc/bits/endianness.h created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | #ifndef _BITS_ENDIANNESS_H | ||
| 2 | #define _BITS_ENDIANNESS_H 1 | ||
| 3 | |||
| 4 | #ifndef _BITS_ENDIAN_H | ||
| 5 | # error "Never use <bits/endian.h> directly; include <endian.h> instead." | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* ARC 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/arc/entry.h created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | #ifndef __ASSEMBLY__ | ||
| 2 | extern void __start (void) attribute_hidden; | ||
| 3 | #endif | ||
| 4 | |||
| 5 | #define ENTRY_POINT __start | ||
lib/libc/glibc/sysdeps/arc/start-2.33.S created+74| ... | @@ -0,0 +1,74 @@ | ||
| 1 | /* Startup code for ARC. | ||
| 2 | Copyright (C) 2020-2021 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 __ASSEMBLY__ 1 | ||
| 20 | #include <entry.h> | ||
| 21 | #include <sysdep.h> | ||
| 22 | |||
| 23 | #ifndef ENTRY_POINT | ||
| 24 | # error ENTRY_POINT needs to be defined for ARC | ||
| 25 | #endif | ||
| 26 | |||
| 27 | /* When we enter this piece of code, the program stack looks like this: | ||
| 28 | argc argument counter (integer) | ||
| 29 | argv[0] program name (pointer) | ||
| 30 | argv[1...N] program args (pointers) | ||
| 31 | argv[argc-1] end of args (integer) | ||
| 32 | NULL | ||
| 33 | env[0...N] environment variables (pointers) | ||
| 34 | NULL. */ | ||
| 35 | |||
| 36 | ENTRY (ENTRY_POINT) | ||
| 37 | |||
| 38 | 	/* Needed to make gdb backtraces stop here. */ | ||
| 39 | 	.cfi_label .Ldummy | ||
| 40 | 	cfi_undefined (blink) | ||
| 41 | |||
| 42 | 	mov	fp, 0 | ||
| 43 | 	ld_s	r1, [sp]	/* argc. */ | ||
| 44 | |||
| 45 | 	mov_s	r5, r0		/* rltd_fini. */ | ||
| 46 | 	add_s	r2, sp, 4	/* argv. */ | ||
| 47 | 	and	sp, sp, -8 | ||
| 48 | 	mov	r6, sp | ||
| 49 | |||
| 50 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end). */ | ||
| 51 | |||
| 52 | #ifdef SHARED | ||
| 53 | 	ld	r0, [pcl, @main@gotpc] | ||
| 54 | 	ld	r3, [pcl, @__libc_csu_init@gotpc] | ||
| 55 | 	ld	r4, [pcl, @__libc_csu_fini@gotpc] | ||
| 56 | 	bl	__libc_start_main@plt | ||
| 57 | #else | ||
| 58 | 	mov_s	r0, main | ||
| 59 | 	mov_s	r3, __libc_csu_init | ||
| 60 | 	mov	r4, __libc_csu_fini | ||
| 61 | 	bl	__libc_start_main | ||
| 62 | #endif | ||
| 63 | |||
| 64 | 	/* Should never get here. */ | ||
| 65 | 	flag 1 | ||
| 66 | END (ENTRY_POINT) | ||
| 67 | |||
| 68 | /* Define a symbol for the first piece of initialized data. */ | ||
| 69 | 	.data | ||
| 70 | 	.globl __data_start | ||
| 71 | __data_start: | ||
| 72 | 	.long 0 | ||
| 73 | 	.weak data_start | ||
| 74 | 	data_start = __data_start | ||
lib/libc/glibc/sysdeps/arc/start.S created+90| ... | @@ -0,0 +1,90 @@ | ||
| 1 | /* Startup code for ARC. | ||
| 2 | Copyright (C) 2020-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 | #define __ASSEMBLY__ 1 | ||
| 37 | #include <entry.h> | ||
| 38 | #include <sysdep.h> | ||
| 39 | |||
| 40 | #ifndef ENTRY_POINT | ||
| 41 | # error ENTRY_POINT needs to be defined for ARC | ||
| 42 | #endif | ||
| 43 | |||
| 44 | /* When we enter this piece of code, the program stack looks like this: | ||
| 45 | argc argument counter (integer) | ||
| 46 | argv[0] program name (pointer) | ||
| 47 | argv[1...N] program args (pointers) | ||
| 48 | argv[argc-1] end of args (integer) | ||
| 49 | NULL | ||
| 50 | env[0...N] environment variables (pointers) | ||
| 51 | NULL. */ | ||
| 52 | |||
| 53 | ENTRY (ENTRY_POINT) | ||
| 54 | |||
| 55 | 	/* Needed to make gdb backtraces stop here. */ | ||
| 56 | 	.cfi_label .Ldummy | ||
| 57 | 	cfi_undefined (blink) | ||
| 58 | |||
| 59 | 	mov	fp, 0 | ||
| 60 | 	ld_s	r1, [sp]	/* argc. */ | ||
| 61 | |||
| 62 | 	mov_s	r5, r0		/* rltd_fini. */ | ||
| 63 | 	add_s	r2, sp, 4	/* argv. */ | ||
| 64 | 	and	sp, sp, -8 | ||
| 65 | 	mov	r6, sp | ||
| 66 | |||
| 67 | 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end). */ | ||
| 68 | |||
| 69 | 	mov_s	r3, 0 		/* Used to be init. */ | ||
| 70 | 	mov	r4, 0		/* Used to be fini. */ | ||
| 71 | |||
| 72 | #ifdef SHARED | ||
| 73 | 	ld	r0, [pcl, @main@gotpc] | ||
| 74 | 	bl	__libc_start_main@plt | ||
| 75 | #else | ||
| 76 | 	mov_s	r0, main | ||
| 77 | 	bl	__libc_start_main | ||
| 78 | #endif | ||
| 79 | |||
| 80 | 	/* Should never get here. */ | ||
| 81 | 	flag 1 | ||
| 82 | END (ENTRY_POINT) | ||
| 83 | |||
| 84 | /* Define a symbol for the first piece of initialized data. */ | ||
| 85 | 	.data | ||
| 86 | 	.globl __data_start | ||
| 87 | __data_start: | ||
| 88 | 	.long 0 | ||
| 89 | 	.weak data_start | ||
| 90 | 	data_start = __data_start | ||