| author | |
| committer | |
| log | 96fcc8d63bf8391e5cf2246e9427e9ab56399d86 |
| tree | 0b5f706fde982c5acc4502f8e4df02a46922ef5e |
| parent | 1511a4171f1717ef9d5eeef2b69e6636bd487e0a |
| parent | 27c72c555a3e5cb170703e3820a1f0ce25fc3e2d |
| signature |
`glibc`: Some bug fixes, plus arc and csky start files8 files changed, 484 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 |
lib/libc/glibc/sysdeps/csky/abiv2/start-2.33.S created+112| ... | ... | @@ -0,0 +1,112 @@ |
| 1 | /* Startup code compliant to the ELF C-SKY ABIV2. | |
| 2 | Copyright (C) 2018-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 | 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 | /* We need to call: | |
| 37 | __libc_start_main (int (*main) (int, char **, char **), int argc, | |
| 38 | 		 char **argv, void (*init) (void), void (*fini) (void), | |
| 39 | 		 void (*rtld_fini) (void), void *stack_end) | |
| 40 | */ | |
| 41 | ||
| 42 | #include <sysdep.h> | |
| 43 | ||
| 44 | 	.text | |
| 45 | 	.globl _start; | |
| 46 | 	.type _start,@function; | |
| 47 | 	.align 4; | |
| 48 | _start: | |
| 49 | 	cfi_startproc | |
| 50 | 	.cfi_label .Ldummy | |
| 51 | 	cfi_undefined (lr) | |
| 52 | 	subi	sp, 8 | |
| 53 | 	/* Clear the link register since this is the outermost frame. */ | |
| 54 | 	movi	lr, 0 | |
| 55 | 	/* Pop argc off the stack and save a pointer to argv. */ | |
| 56 | 	ldw	a1, (sp, 8)	/* Init argc for __libc_start_main. */ | |
| 57 | 	addi	a2, sp, 12	/* Init argv for __libc_start_main. */ | |
| 58 | ||
| 59 | 	/* Push stack limit. */ | |
| 60 | 	stw	a2, (sp, 8) | |
| 61 | 	/* Push rtld_fini. */ | |
| 62 | 	stw	a0, (sp, 4) | |
| 63 | ||
| 64 | #ifdef SHARED | |
| 65 | 	grs	t0, .Lgetpc | |
| 66 | .Lgetpc: | |
| 67 | 	lrw	gb, .Lgetpc@GOTPC | |
| 68 | 	addu	gb, t0 | |
| 69 | 	lrw	a3, __libc_csu_fini@GOT | |
| 70 | 	ldr.w	a3, (gb, a3 << 0) | |
| 71 | 	stw	a3, (sp, 0) | |
| 72 | ||
| 73 | 	lrw	a3, __libc_csu_init@GOT | |
| 74 | 	addu	a3, gb | |
| 75 | 	ldw	a3, (a3, 0) | |
| 76 | ||
| 77 | 	lrw	t0, main@GOT | |
| 78 | 	addu	t0, gb | |
| 79 | 	ldw	a0, (t0, 0) | |
| 80 | 	lrw	t1, __libc_start_main@PLT | |
| 81 | 	ldr.w	t1, (gb, t1 << 0) | |
| 82 | 	jsr	t1 | |
| 83 | ||
| 84 | 	lrw	t1, abort@PLT | |
| 85 | 	ldr.w	t1, (gb, t1 << 0) | |
| 86 | 	jsr	t1 | |
| 87 | #else | |
| 88 | 	/* Fetch address of __libc_csu_fini. */ | |
| 89 | 	lrw	a0, __libc_csu_fini | |
| 90 | 	/* Push __libc_csu_fini */ | |
| 91 | 	stw	a0, (sp, 0) | |
| 92 | ||
| 93 | 	/* Set up the other arguments in registers. */ | |
| 94 | 	lrw	a0, main | |
| 95 | 	lrw	a3, __libc_csu_init | |
| 96 | 	/* Let the libc call main and exit with its return code. */ | |
| 97 | 	jsri	__libc_start_main | |
| 98 | ||
| 99 | 	/* Should never get here. */ | |
| 100 | 	jsri	abort | |
| 101 | #endif	/* !SHARED */ | |
| 102 | 	cfi_endproc | |
| 103 | 	.size _start,.-_start | |
| 104 | ||
| 105 | ||
| 106 | 	/* Define a symbol for the first piece of initialized data. */ | |
| 107 | 	.data | |
| 108 | 	.globl __data_start | |
| 109 | __data_start: | |
| 110 | 	.long 0 | |
| 111 | 	.weak data_start | |
| 112 | 	data_start = __data_start |
lib/libc/glibc/sysdeps/csky/abiv2/start.S created+103| ... | ... | @@ -0,0 +1,103 @@ |
| 1 | /* Startup code compliant to the ELF C-SKY ABIV2. | |
| 2 | Copyright (C) 2018-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 | /* We need to call: | |
| 37 | __libc_start_main (int (*main) (int, char **, char **), int argc, | |
| 38 | 		 char **argv, void (*init) (void), void (*fini) (void), | |
| 39 | 		 void (*rtld_fini) (void), void *stack_end) | |
| 40 | */ | |
| 41 | ||
| 42 | #include <sysdep.h> | |
| 43 | ||
| 44 | 	.text | |
| 45 | 	.globl _start; | |
| 46 | 	.type _start,@function; | |
| 47 | 	.align 4; | |
| 48 | _start: | |
| 49 | 	cfi_startproc | |
| 50 | 	.cfi_label .Ldummy | |
| 51 | 	cfi_undefined (lr) | |
| 52 | 	subi	sp, 8 | |
| 53 | 	/* Clear the link register since this is the outermost frame. */ | |
| 54 | 	movi	lr, 0 | |
| 55 | 	/* Pop argc off the stack and save a pointer to argv. */ | |
| 56 | 	ldw	a1, (sp, 8)	/* Init argc for __libc_start_main. */ | |
| 57 | 	addi	a2, sp, 12	/* Init argv for __libc_start_main. */ | |
| 58 | ||
| 59 | 	/* Push stack limit. */ | |
| 60 | 	stw	a2, (sp, 8) | |
| 61 | 	/* Push rtld_fini. */ | |
| 62 | 	stw	a0, (sp, 4) | |
| 63 | ||
| 64 | #ifdef SHARED | |
| 65 | 	grs	t0, .Lgetpc | |
| 66 | .Lgetpc: | |
| 67 | 	lrw	gb, .Lgetpc@GOTPC | |
| 68 | 	addu	gb, t0 | |
| 69 | ||
| 70 | 	movi	a3, 0		/* Used to be init. */ | |
| 71 | 	stw 	a3, (sp, 0) 	/* Used to be fini. */ | |
| 72 | ||
| 73 | 	lrw	t0, main@GOT | |
| 74 | 	addu	t0, gb | |
| 75 | 	ldw	a0, (t0, 0) | |
| 76 | 	lrw	t1, __libc_start_main@PLT | |
| 77 | 	ldr.w	t1, (gb, t1 << 0) | |
| 78 | 	jsr	t1 | |
| 79 | ||
| 80 | 	lrw	t1, abort@PLT | |
| 81 | 	ldr.w	t1, (gb, t1 << 0) | |
| 82 | 	jsr	t1 | |
| 83 | #else | |
| 84 | 	movi	a3, 0		/* Used to be init. */ | |
| 85 | 	stw 	a3, (sp, 0) 	/* Used to be fini. */ | |
| 86 | 	lrw	a0, main | |
| 87 | 	/* Let the libc call main and exit with its return code. */ | |
| 88 | 	jsri	__libc_start_main | |
| 89 | ||
| 90 | 	/* Should never get here. */ | |
| 91 | 	jsri	abort | |
| 92 | #endif	/* !SHARED */ | |
| 93 | 	cfi_endproc | |
| 94 | 	.size _start,.-_start | |
| 95 | ||
| 96 | ||
| 97 | 	/* Define a symbol for the first piece of initialized data. */ | |
| 98 | 	.data | |
| 99 | 	.globl __data_start | |
| 100 | __data_start: | |
| 101 | 	.long 0 | |
| 102 | 	.weak data_start | |
| 103 | 	data_start = __data_start |
lib/libc/glibc/sysdeps/csky/bits/endianness.h created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 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 | #ifdef __CSKYBE__ | |
| 9 | # error "Big endian not supported for C-SKY." | |
| 10 | #else | |
| 11 | # define __BYTE_ORDER __LITTLE_ENDIAN | |
| 12 | #endif | |
| 13 | ||
| 14 | #endif /* bits/endianness.h */ |
src/glibc.zig+71| ... | ... | @@ -369,6 +369,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progre |
| 369 | 369 | "-fgnu89-inline", |
| 370 | 370 | "-fmerge-all-constants", |
| 371 | 371 | "-frounding-math", |
| 372 | "-Wno-unsupported-floating-point-opt", // For targets that don't support -frounding-math. | |
| 372 | 373 | "-fno-stack-protector", |
| 373 | 374 | "-fno-common", |
| 374 | 375 | "-fmath-errno", |
| ... | ... | @@ -467,8 +468,16 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ |
| 467 | 468 | } else { |
| 468 | 469 | try result.appendSlice("powerpc" ++ s ++ "powerpc32"); |
| 469 | 470 | } |
| 471 | } else if (arch == .s390x) { | |
| 472 | try result.appendSlice("s390" ++ s ++ "s390-64"); | |
| 470 | 473 | } else if (arch.isLoongArch()) { |
| 471 | 474 | try result.appendSlice("loongarch"); |
| 475 | } else if (arch == .m68k) { | |
| 476 | try result.appendSlice("m68k"); | |
| 477 | } else if (arch == .arc) { | |
| 478 | try result.appendSlice("arc"); | |
| 479 | } else if (arch == .csky) { | |
| 480 | try result.appendSlice("csky" ++ s ++ "abiv2"); | |
| 472 | 481 | } |
| 473 | 482 | |
| 474 | 483 | try result.appendSlice(s); |
| ... | ... | @@ -569,6 +578,10 @@ fn add_include_dirs_arch( |
| 569 | 578 | try args.append("-I"); |
| 570 | 579 | try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64", nptl })); |
| 571 | 580 | } else { |
| 581 | if (target.abi == .gnux32) { | |
| 582 | try args.append("-I"); | |
| 583 | try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64", "x32" })); | |
| 584 | } | |
| 572 | 585 | try args.append("-I"); |
| 573 | 586 | try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" })); |
| 574 | 587 | } |
| ... | ... | @@ -657,9 +670,36 @@ fn add_include_dirs_arch( |
| 657 | 670 | try args.append("-I"); |
| 658 | 671 | try args.append(try path.join(arena, &[_][]const u8{ dir, "riscv" })); |
| 659 | 672 | } |
| 673 | } else if (arch == .s390x) { | |
| 674 | if (opt_nptl) |nptl| { | |
| 675 | try args.append("-I"); | |
| 676 | try args.append(try path.join(arena, &[_][]const u8{ dir, "s390", nptl })); | |
| 677 | } else { | |
| 678 | try args.append("-I"); | |
| 679 | try args.append(try path.join(arena, &[_][]const u8{ dir, "s390" ++ s ++ "s390-64" })); | |
| 680 | try args.append("-I"); | |
| 681 | try args.append(try path.join(arena, &[_][]const u8{ dir, "s390" })); | |
| 682 | } | |
| 660 | 683 | } else if (arch.isLoongArch()) { |
| 661 | 684 | try args.append("-I"); |
| 662 | 685 | try args.append(try path.join(arena, &[_][]const u8{ dir, "loongarch" })); |
| 686 | } else if (arch == .m68k) { | |
| 687 | if (opt_nptl) |nptl| { | |
| 688 | try args.append("-I"); | |
| 689 | try args.append(try path.join(arena, &[_][]const u8{ dir, "m68k", nptl })); | |
| 690 | } else { | |
| 691 | // coldfire ABI support requires: https://github.com/ziglang/zig/issues/20690 | |
| 692 | try args.append("-I"); | |
| 693 | try args.append(try path.join(arena, &[_][]const u8{ dir, "m68k" ++ s ++ "m680x0" })); | |
| 694 | try args.append("-I"); | |
| 695 | try args.append(try path.join(arena, &[_][]const u8{ dir, "m68k" })); | |
| 696 | } | |
| 697 | } else if (arch == .arc) { | |
| 698 | try args.append("-I"); | |
| 699 | try args.append(try path.join(arena, &[_][]const u8{ dir, "arc" })); | |
| 700 | } else if (arch == .csky) { | |
| 701 | try args.append("-I"); | |
| 702 | try args.append(try path.join(arena, &[_][]const u8{ dir, "csky" })); | |
| 663 | 703 | } |
| 664 | 704 | } |
| 665 | 705 | |
| ... | ... | @@ -814,6 +854,23 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 814 | 854 | var opt_symbol_name: ?[]const u8 = null; |
| 815 | 855 | var versions_buffer: [32]u8 = undefined; |
| 816 | 856 | var versions_len: usize = undefined; |
| 857 | ||
| 858 | // There can be situations where there are multiple inclusions for the same symbol with | |
| 859 | // partially overlapping versions, due to different target lists. For example: | |
| 860 | // | |
| 861 | // lgammal: | |
| 862 | // library: libm.so | |
| 863 | // versions: 2.4 2.23 | |
| 864 | // targets: ... powerpc64-linux-gnu s390x-linux-gnu | |
| 865 | // lgammal: | |
| 866 | // library: libm.so | |
| 867 | // versions: 2.2 2.23 | |
| 868 | // targets: sparc64-linux-gnu s390x-linux-gnu | |
| 869 | // | |
| 870 | // If we don't handle this, we end up writing the default `lgammal` symbol for version 2.33 | |
| 871 | // twice, which causes a "duplicate symbol" assembler error. | |
| 872 | var versions_written = std.AutoArrayHashMap(Version, void).init(arena); | |
| 873 | ||
| 817 | 874 | while (sym_i < fn_inclusions_len) : (sym_i += 1) { |
| 818 | 875 | const sym_name = opt_symbol_name orelse n: { |
| 819 | 876 | const name = mem.sliceTo(metadata.inclusions[inc_i..], 0); |
| ... | ... | @@ -867,6 +924,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 867 | 924 | } |
| 868 | 925 | } |
| 869 | 926 | } |
| 927 | ||
| 928 | versions_written.clearRetainingCapacity(); | |
| 929 | try versions_written.ensureTotalCapacity(versions_len); | |
| 930 | ||
| 870 | 931 | { |
| 871 | 932 | var ver_buf_i: u8 = 0; |
| 872 | 933 | while (ver_buf_i < versions_len) : (ver_buf_i += 1) { |
| ... | ... | @@ -877,6 +938,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 877 | 938 | // _Exit_2_2_5: |
| 878 | 939 | const ver_index = versions_buffer[ver_buf_i]; |
| 879 | 940 | const ver = metadata.all_versions[ver_index]; |
| 941 | ||
| 942 | if (versions_written.getOrPutAssumeCapacity(ver).found_existing) continue; | |
| 943 | ||
| 880 | 944 | // Default symbol version definition vs normal symbol version definition |
| 881 | 945 | const want_default = chosen_def_ver_index != 255 and ver_index == chosen_def_ver_index; |
| 882 | 946 | const at_sign_str: []const u8 = if (want_default) "@@" else "@"; |
| ... | ... | @@ -1026,6 +1090,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 1026 | 1090 | } |
| 1027 | 1091 | } |
| 1028 | 1092 | } |
| 1093 | ||
| 1094 | versions_written.clearRetainingCapacity(); | |
| 1095 | try versions_written.ensureTotalCapacity(versions_len); | |
| 1096 | ||
| 1029 | 1097 | { |
| 1030 | 1098 | var ver_buf_i: u8 = 0; |
| 1031 | 1099 | while (ver_buf_i < versions_len) : (ver_buf_i += 1) { |
| ... | ... | @@ -1037,6 +1105,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 1037 | 1105 | // environ_2_2_5: |
| 1038 | 1106 | const ver_index = versions_buffer[ver_buf_i]; |
| 1039 | 1107 | const ver = metadata.all_versions[ver_index]; |
| 1108 | ||
| 1109 | if (versions_written.getOrPutAssumeCapacity(ver).found_existing) continue; | |
| 1110 | ||
| 1040 | 1111 | // Default symbol version definition vs normal symbol version definition |
| 1041 | 1112 | const want_default = chosen_def_ver_index != 255 and ver_index == chosen_def_ver_index; |
| 1042 | 1113 | const at_sign_str: []const u8 = if (want_default) "@@" else "@"; |