mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 07:03:11 +00:00
Merge pull request #22541 from ziglang/pipeline
Compilation pipeline: spawn Jobs earlier that produce linker inputs
This commit is contained in:
commit
b31a2c9555
103
lib/libc/glibc/sysdeps/aarch64/crti.S
vendored
103
lib/libc/glibc/sysdeps/aarch64/crti.S
vendored
@ -1,103 +0,0 @@
|
|||||||
/* Special .init and .fini section support for AArch64.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
.align 2
|
|
||||||
.type call_weak_fn, %function
|
|
||||||
call_weak_fn:
|
|
||||||
adrp x0, :got:PREINIT_FUNCTION
|
|
||||||
ldr PTR_REG (0), [x0, #:got_lo12:PREINIT_FUNCTION]
|
|
||||||
cbz x0, 1f
|
|
||||||
b PREINIT_FUNCTION
|
|
||||||
1:
|
|
||||||
RET
|
|
||||||
.size call_weak_fn, .-call_weak_fn
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",%progbits
|
|
||||||
.align 2
|
|
||||||
.global _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, %function
|
|
||||||
_init:
|
|
||||||
#if HAVE_AARCH64_PAC_RET
|
|
||||||
PACIASP
|
|
||||||
#else
|
|
||||||
BTI_C
|
|
||||||
#endif
|
|
||||||
stp x29, x30, [sp, -16]!
|
|
||||||
mov x29, sp
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
bl call_weak_fn
|
|
||||||
#else
|
|
||||||
bl PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",%progbits
|
|
||||||
.align 2
|
|
||||||
.global _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, %function
|
|
||||||
_fini:
|
|
||||||
#if HAVE_AARCH64_PAC_RET
|
|
||||||
PACIASP
|
|
||||||
#else
|
|
||||||
BTI_C
|
|
||||||
#endif
|
|
||||||
stp x29, x30, [sp, -16]!
|
|
||||||
mov x29, sp
|
|
||||||
54
lib/libc/glibc/sysdeps/aarch64/crtn.S
vendored
54
lib/libc/glibc/sysdeps/aarch64/crtn.S
vendored
@ -1,54 +0,0 @@
|
|||||||
/* Special .init and .fini section support for AArch64.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
.section .init,"ax",%progbits
|
|
||||||
ldp x29, x30, [sp], 16
|
|
||||||
#if HAVE_AARCH64_PAC_RET
|
|
||||||
AUTIASP
|
|
||||||
#endif
|
|
||||||
RET
|
|
||||||
|
|
||||||
.section .fini,"ax",%progbits
|
|
||||||
ldp x29, x30, [sp], 16
|
|
||||||
#if HAVE_AARCH64_PAC_RET
|
|
||||||
AUTIASP
|
|
||||||
#endif
|
|
||||||
RET
|
|
||||||
97
lib/libc/glibc/sysdeps/arm/crti.S
vendored
97
lib/libc/glibc/sysdeps/arm/crti.S
vendored
@ -1,97 +0,0 @@
|
|||||||
/* Special .init and .fini section support for ARM.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
/* Always build .init and .fini sections in ARM mode. */
|
|
||||||
#define NO_THUMB
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
.p2align 2
|
|
||||||
.type call_weak_fn, %function
|
|
||||||
call_weak_fn:
|
|
||||||
ldr r3, .LGOT
|
|
||||||
ldr r2, .LGOT+4
|
|
||||||
.LPIC:
|
|
||||||
add r3, pc, r3
|
|
||||||
ldr r2, [r3, r2]
|
|
||||||
cmp r2, #0
|
|
||||||
bxeq lr
|
|
||||||
b PREINIT_FUNCTION
|
|
||||||
.p2align 2
|
|
||||||
.LGOT:
|
|
||||||
.word _GLOBAL_OFFSET_TABLE_-(.LPIC+8)
|
|
||||||
.word PREINIT_FUNCTION(GOT)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",%progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, %function
|
|
||||||
_init:
|
|
||||||
push {r3, lr}
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
bl call_weak_fn
|
|
||||||
#else
|
|
||||||
bl PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",%progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, %function
|
|
||||||
_fini:
|
|
||||||
push {r3, lr}
|
|
||||||
57
lib/libc/glibc/sysdeps/arm/crtn.S
vendored
57
lib/libc/glibc/sysdeps/arm/crtn.S
vendored
@ -1,57 +0,0 @@
|
|||||||
/* Special .init and .fini section support for ARM.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* Always build .init and .fini sections in ARM mode. */
|
|
||||||
#define NO_THUMB
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init,"ax",%progbits
|
|
||||||
#ifdef __ARM_ARCH_4T__
|
|
||||||
pop {r3, lr}
|
|
||||||
bx lr
|
|
||||||
#else
|
|
||||||
pop {r3, pc}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",%progbits
|
|
||||||
#ifdef __ARM_ARCH_4T__
|
|
||||||
pop {r3, lr}
|
|
||||||
bx lr
|
|
||||||
#else
|
|
||||||
pop {r3, pc}
|
|
||||||
#endif
|
|
||||||
86
lib/libc/glibc/sysdeps/i386/crti.S
vendored
86
lib/libc/glibc/sysdeps/i386/crti.S
vendored
@ -1,86 +0,0 @@
|
|||||||
/* Special .init and .fini section support for x86.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
pushl %ebx
|
|
||||||
/* Maintain 16-byte stack alignment for called functions. */
|
|
||||||
subl $8, %esp
|
|
||||||
LOAD_PIC_REG (bx)
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
movl PREINIT_FUNCTION@GOT(%ebx), %eax
|
|
||||||
testl %eax, %eax
|
|
||||||
je .Lno_weak_fn
|
|
||||||
call *%eax
|
|
||||||
.Lno_weak_fn:
|
|
||||||
#else
|
|
||||||
call PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
pushl %ebx
|
|
||||||
subl $8, %esp
|
|
||||||
LOAD_PIC_REG (bx)
|
|
||||||
47
lib/libc/glibc/sysdeps/i386/crtn.S
vendored
47
lib/libc/glibc/sysdeps/i386/crtn.S
vendored
@ -1,47 +0,0 @@
|
|||||||
/* Special .init and .fini section support for x86.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
addl $8, %esp
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
addl $8, %esp
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
84
lib/libc/glibc/sysdeps/m68k/crti.S
vendored
84
lib/libc/glibc/sysdeps/m68k/crti.S
vendored
@ -1,84 +0,0 @@
|
|||||||
/* Special .init and .fini section support for m68k.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
link.w %fp, #0
|
|
||||||
move.l %a5, -(%sp)
|
|
||||||
LOAD_GOT (%a5)
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
tst.l PREINIT_FUNCTION@GOT(%a5)
|
|
||||||
jeq 1f
|
|
||||||
jbsr PREINIT_FUNCTION@PLTPC
|
|
||||||
1:
|
|
||||||
#else
|
|
||||||
jbsr PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
link.w %fp, #0
|
|
||||||
move.l %a5, -(%sp)
|
|
||||||
LOAD_GOT (%a5)
|
|
||||||
47
lib/libc/glibc/sysdeps/m68k/crtn.S
vendored
47
lib/libc/glibc/sysdeps/m68k/crtn.S
vendored
@ -1,47 +0,0 @@
|
|||||||
/* Special .init and .fini section support for m68k.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
move.l -4(%fp), %a5
|
|
||||||
unlk %fp
|
|
||||||
rts
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
move.l -4(%fp), %a5
|
|
||||||
unlk %fp
|
|
||||||
rts
|
|
||||||
102
lib/libc/glibc/sysdeps/mips/mips32/crti.S
vendored
102
lib/libc/glibc/sysdeps/mips/mips32/crti.S
vendored
@ -1,102 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (o32).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
|
|
||||||
#ifdef __mips_micromips
|
|
||||||
# define JALR_RELOC R_MICROMIPS_JALR
|
|
||||||
#else
|
|
||||||
# define JALR_RELOC R_MIPS_JALR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
.set noreorder
|
|
||||||
.cpload $25
|
|
||||||
.set reorder
|
|
||||||
addiu $sp,$sp,-32
|
|
||||||
.cprestore 16
|
|
||||||
sw $31,28($sp)
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
lw $2,%got(PREINIT_FUNCTION)($28)
|
|
||||||
beq $2,$0,.Lno_weak_fn
|
|
||||||
lw $25,%call16(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
.Lno_weak_fn:
|
|
||||||
.insn
|
|
||||||
#else
|
|
||||||
lw $25,%got(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
.set noreorder
|
|
||||||
.cpload $25
|
|
||||||
.set reorder
|
|
||||||
addiu $sp,$sp,-32
|
|
||||||
.cprestore 16
|
|
||||||
sw $31,28($sp)
|
|
||||||
59
lib/libc/glibc/sysdeps/mips/mips32/crtn.S
vendored
59
lib/libc/glibc/sysdeps/mips/mips32/crtn.S
vendored
@ -1,59 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (o32).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
lw $31,28($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
addiu $sp,$sp,32
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
lw $31,28($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
addiu $sp,$sp,32
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
102
lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S
vendored
102
lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S
vendored
@ -1,102 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (n32).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
|
|
||||||
#ifdef __mips_micromips
|
|
||||||
# define JALR_RELOC R_MICROMIPS_JALR
|
|
||||||
#else
|
|
||||||
# define JALR_RELOC R_MIPS_JALR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
addiu $sp,$sp,-16
|
|
||||||
sd $28,0($sp)
|
|
||||||
lui $28,%hi(%neg(%gp_rel(_init)))
|
|
||||||
addu $28,$28,$25
|
|
||||||
sd $31,8($sp)
|
|
||||||
addiu $28,$28,%lo(%neg(%gp_rel(_init)))
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
lw $2,%got_disp(PREINIT_FUNCTION)($28)
|
|
||||||
beq $2,$0,.Lno_weak_fn
|
|
||||||
lw $25,%call16(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
.Lno_weak_fn:
|
|
||||||
.insn
|
|
||||||
#else
|
|
||||||
lw $25,%got_disp(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
addiu $sp,$sp,-16
|
|
||||||
sd $28,0($sp)
|
|
||||||
lui $28,%hi(%neg(%gp_rel(_fini)))
|
|
||||||
addu $28,$28,$25
|
|
||||||
sd $31,8($sp)
|
|
||||||
addiu $28,$28,%lo(%neg(%gp_rel(_fini)))
|
|
||||||
61
lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S
vendored
61
lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S
vendored
@ -1,61 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (n32).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
ld $31,8($sp)
|
|
||||||
ld $28,0($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
addiu $sp,$sp,16
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
ld $31,8($sp)
|
|
||||||
ld $28,0($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
addiu $sp,$sp,16
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
102
lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S
vendored
102
lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S
vendored
@ -1,102 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (n64).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
|
|
||||||
#ifdef __mips_micromips
|
|
||||||
# define JALR_RELOC R_MICROMIPS_JALR
|
|
||||||
#else
|
|
||||||
# define JALR_RELOC R_MIPS_JALR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
daddiu $sp,$sp,-16
|
|
||||||
sd $28,0($sp)
|
|
||||||
lui $28,%hi(%neg(%gp_rel(_init)))
|
|
||||||
daddu $28,$28,$25
|
|
||||||
sd $31,8($sp)
|
|
||||||
daddiu $28,$28,%lo(%neg(%gp_rel(_init)))
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
ld $2,%got_disp(PREINIT_FUNCTION)($28)
|
|
||||||
beq $2,$0,.Lno_weak_fn
|
|
||||||
ld $25,%call16(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
.Lno_weak_fn:
|
|
||||||
.insn
|
|
||||||
#else
|
|
||||||
ld $25,%got_disp(PREINIT_FUNCTION)($28)
|
|
||||||
.reloc 1f,JALR_RELOC,PREINIT_FUNCTION
|
|
||||||
1: jalr $25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
daddiu $sp,$sp,-16
|
|
||||||
sd $28,0($sp)
|
|
||||||
lui $28,%hi(%neg(%gp_rel(_fini)))
|
|
||||||
daddu $28,$28,$25
|
|
||||||
sd $31,8($sp)
|
|
||||||
daddiu $28,$28,%lo(%neg(%gp_rel(_fini)))
|
|
||||||
61
lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S
vendored
61
lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S
vendored
@ -1,61 +0,0 @@
|
|||||||
/* Special .init and .fini section support for MIPS (n64).
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library. If not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.set nomips16
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
ld $31,8($sp)
|
|
||||||
ld $28,0($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
daddiu $sp,$sp,16
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
ld $31,8($sp)
|
|
||||||
ld $28,0($sp)
|
|
||||||
.set noreorder
|
|
||||||
.set nomacro
|
|
||||||
/* zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315 */
|
|
||||||
jr $31
|
|
||||||
daddiu $sp,$sp,16
|
|
||||||
.set macro
|
|
||||||
.set reorder
|
|
||||||
91
lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S
vendored
91
lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S
vendored
@ -1,91 +0,0 @@
|
|||||||
/* Special .init and .fini section support for PowerPC.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
stwu r1, -16(r1)
|
|
||||||
mflr r0
|
|
||||||
stw r0, 20(r1)
|
|
||||||
stw r30, 8(r1)
|
|
||||||
SETUP_GOT_ACCESS (r30, .Lgot_label_i)
|
|
||||||
addis r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@ha
|
|
||||||
addi r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@l
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
lwz r0, PREINIT_FUNCTION@got(r30)
|
|
||||||
cmpwi cr7, r0, 0
|
|
||||||
beq+ cr7, 1f
|
|
||||||
bl PREINIT_FUNCTION@plt
|
|
||||||
1:
|
|
||||||
#else
|
|
||||||
bl PREINIT_FUNCTION@local
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
stwu r1, -16(r1)
|
|
||||||
mflr r0
|
|
||||||
stw r0, 20(r1)
|
|
||||||
stw r30, 8(r1)
|
|
||||||
SETUP_GOT_ACCESS (r30, .Lgot_label_f)
|
|
||||||
53
lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S
vendored
53
lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S
vendored
@ -1,53 +0,0 @@
|
|||||||
/* Special .init and .fini section support for PowerPC.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
lwz r0, 20(r1)
|
|
||||||
mtlr r0
|
|
||||||
lwz r30, 8(r1)
|
|
||||||
addi r1, r1, 16
|
|
||||||
blr
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
lwz r0, 20(r1)
|
|
||||||
mtlr r0
|
|
||||||
lwz r30, 8(r1)
|
|
||||||
addi r1, r1, 16
|
|
||||||
blr
|
|
||||||
90
lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S
vendored
90
lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S
vendored
@ -1,90 +0,0 @@
|
|||||||
/* Special .init and .fini section support for PowerPC64.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
.section ".toc", "aw"
|
|
||||||
.LC0:
|
|
||||||
.tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
.section ".init", "ax", @progbits
|
|
||||||
ENTRY_2(_init)
|
|
||||||
.hidden _init
|
|
||||||
.align ALIGNARG (2)
|
|
||||||
BODY_LABEL (_init):
|
|
||||||
LOCALENTRY(_init)
|
|
||||||
mflr 0
|
|
||||||
std 0, FRAME_LR_SAVE(r1)
|
|
||||||
stdu r1, -FRAME_MIN_SIZE_PARM(r1)
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
addis r9, r2, .LC0@toc@ha
|
|
||||||
ld r0, .LC0@toc@l(r9)
|
|
||||||
cmpdi cr7, r0, 0
|
|
||||||
beq+ cr7, 1f
|
|
||||||
#endif
|
|
||||||
bl JUMPTARGET (PREINIT_FUNCTION)
|
|
||||||
nop
|
|
||||||
1:
|
|
||||||
|
|
||||||
.section ".fini", "ax", @progbits
|
|
||||||
ENTRY_2(_fini)
|
|
||||||
.hidden _fini
|
|
||||||
.align ALIGNARG (2)
|
|
||||||
BODY_LABEL (_fini):
|
|
||||||
LOCALENTRY(_fini)
|
|
||||||
mflr 0
|
|
||||||
std 0, FRAME_LR_SAVE(r1)
|
|
||||||
stdu r1, -FRAME_MIN_SIZE_PARM(r1)
|
|
||||||
51
lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S
vendored
51
lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S
vendored
@ -1,51 +0,0 @@
|
|||||||
/* Special .init and .fini section support for PowerPC64.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
addi r1, r1, FRAME_MIN_SIZE_PARM
|
|
||||||
ld r0, FRAME_LR_SAVE(r1)
|
|
||||||
mtlr r0
|
|
||||||
blr
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
addi r1, r1, FRAME_MIN_SIZE_PARM
|
|
||||||
ld r0, FRAME_LR_SAVE(r1)
|
|
||||||
mtlr r0
|
|
||||||
blr
|
|
||||||
93
lib/libc/glibc/sysdeps/s390/s390-64/crti.S
vendored
93
lib/libc/glibc/sysdeps/s390/s390-64/crti.S
vendored
@ -1,93 +0,0 @@
|
|||||||
/* Special .init and .fini section support for 64 bit S/390.
|
|
||||||
Copyright (C) 2001-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.align 4
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init,@function
|
|
||||||
_init:
|
|
||||||
stmg %r6,%r15,48(%r15)
|
|
||||||
lgr %r1,%r15
|
|
||||||
aghi %r15,-160
|
|
||||||
stg %r1,0(%r15)
|
|
||||||
larl %r12,_GLOBAL_OFFSET_TABLE_
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
/* zig patch: GOTENT -> GOT. revert with llvm 20. */
|
|
||||||
larl %r1,PREINIT_FUNCTION@GOT
|
|
||||||
lg %r1,0(%r1)
|
|
||||||
ltgr %r1,%r1
|
|
||||||
je 1f
|
|
||||||
basr %r14,%r1
|
|
||||||
#else
|
|
||||||
brasl %r14,PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
.align 4,0x07
|
|
||||||
1:
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.align 4
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini,@function
|
|
||||||
_fini:
|
|
||||||
stmg %r6,%r15,48(%r15)
|
|
||||||
lg %r1,120(%r15)
|
|
||||||
aghi %r15,-160
|
|
||||||
stg %r1,0(%r15)
|
|
||||||
larl %r12,_GLOBAL_OFFSET_TABLE_
|
|
||||||
.align 4,0x07
|
|
||||||
47
lib/libc/glibc/sysdeps/s390/s390-64/crtn.S
vendored
47
lib/libc/glibc/sysdeps/s390/s390-64/crtn.S
vendored
@ -1,47 +0,0 @@
|
|||||||
/* Special .init and .fini section support for 64 bit S/390.
|
|
||||||
Copyright (C) 2001-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
lg %r4,272(%r15)
|
|
||||||
lmg %r6,%r15,208(%r15)
|
|
||||||
br %r4
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
lg %r4,272(%r15)
|
|
||||||
lmg %r6,%r15,208(%r15)
|
|
||||||
br %r4
|
|
||||||
95
lib/libc/glibc/sysdeps/sparc/crti.S
vendored
95
lib/libc/glibc/sysdeps/sparc/crti.S
vendored
@ -1,95 +0,0 @@
|
|||||||
/* Special .init and .fini section support for sparc.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __arch64__
|
|
||||||
#define STACKFRAME_SIZE 176
|
|
||||||
#define GOT_LOAD ldx
|
|
||||||
#else
|
|
||||||
#define STACKFRAME_SIZE 96
|
|
||||||
#define GOT_LOAD ld
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
save %sp, -STACKFRAME_SIZE, %sp
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
SETUP_PIC_REG(l7)
|
|
||||||
sethi %gdop_hix22(PREINIT_FUNCTION), %g1
|
|
||||||
xor %g1, %gdop_lox10(PREINIT_FUNCTION), %g1
|
|
||||||
GOT_LOAD [%l7 + %g1], %g1, %gdop(PREINIT_FUNCTION)
|
|
||||||
cmp %g1, 0
|
|
||||||
be 1f
|
|
||||||
nop
|
|
||||||
call PREINIT_FUNCTION
|
|
||||||
nop
|
|
||||||
1:
|
|
||||||
#else
|
|
||||||
call PREINIT_FUNCTION
|
|
||||||
nop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
save %sp, -STACKFRAME_SIZE, %sp
|
|
||||||
45
lib/libc/glibc/sysdeps/sparc/crtn.S
vendored
45
lib/libc/glibc/sysdeps/sparc/crtn.S
vendored
@ -1,45 +0,0 @@
|
|||||||
/* Special .init and .fini section support for sparc.
|
|
||||||
Copyright (C) 1995-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
jmp %i7 + 8
|
|
||||||
restore
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
jmp %i7 + 8
|
|
||||||
restore
|
|
||||||
84
lib/libc/glibc/sysdeps/x86_64/crti.S
vendored
84
lib/libc/glibc/sysdeps/x86_64/crti.S
vendored
@ -1,84 +0,0 @@
|
|||||||
/* Special .init and .fini section support for x86-64.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crti.S puts a function prologue at the beginning of the .init and
|
|
||||||
.fini sections and defines global symbols for those addresses, so
|
|
||||||
they can be called as functions. The symbols _init and _fini are
|
|
||||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
|
||||||
|
|
||||||
#include <libc-symbols.h>
|
|
||||||
#include <sysdep.h>
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION
|
|
||||||
# define PREINIT_FUNCTION __gmon_start__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PREINIT_FUNCTION_WEAK
|
|
||||||
# define PREINIT_FUNCTION_WEAK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
weak_extern (PREINIT_FUNCTION)
|
|
||||||
#else
|
|
||||||
.hidden PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _init
|
|
||||||
.hidden _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
_CET_ENDBR
|
|
||||||
/* Maintain 16-byte stack alignment for called functions. */
|
|
||||||
subq $8, %rsp
|
|
||||||
#if PREINIT_FUNCTION_WEAK
|
|
||||||
movq PREINIT_FUNCTION@GOTPCREL(%rip), %rax
|
|
||||||
testq %rax, %rax
|
|
||||||
je .Lno_weak_fn
|
|
||||||
call *%rax
|
|
||||||
.Lno_weak_fn:
|
|
||||||
#else
|
|
||||||
call PREINIT_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
.p2align 2
|
|
||||||
.globl _fini
|
|
||||||
.hidden _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
_CET_ENDBR
|
|
||||||
subq $8, %rsp
|
|
||||||
45
lib/libc/glibc/sysdeps/x86_64/crtn.S
vendored
45
lib/libc/glibc/sysdeps/x86_64/crtn.S
vendored
@ -1,45 +0,0 @@
|
|||||||
/* Special .init and .fini section support for x86-64.
|
|
||||||
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
|
||||||
corresponding to the prologues in crti.S. */
|
|
||||||
|
|
||||||
.section .init,"ax",@progbits
|
|
||||||
addq $8, %rsp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini,"ax",@progbits
|
|
||||||
addq $8, %rsp
|
|
||||||
ret
|
|
||||||
13
lib/libc/musl/crt/aarch64/crti.s
vendored
13
lib/libc/musl/crt/aarch64/crti.s
vendored
@ -1,13 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.type _init,%function
|
|
||||||
_init:
|
|
||||||
stp x29,x30,[sp,-16]!
|
|
||||||
mov x29,sp
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.type _fini,%function
|
|
||||||
_fini:
|
|
||||||
stp x29,x30,[sp,-16]!
|
|
||||||
mov x29,sp
|
|
||||||
7
lib/libc/musl/crt/aarch64/crtn.s
vendored
7
lib/libc/musl/crt/aarch64/crtn.s
vendored
@ -1,7 +0,0 @@
|
|||||||
.section .init
|
|
||||||
ldp x29,x30,[sp],#16
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
ldp x29,x30,[sp],#16
|
|
||||||
ret
|
|
||||||
15
lib/libc/musl/crt/arm/crti.s
vendored
15
lib/libc/musl/crt/arm/crti.s
vendored
@ -1,15 +0,0 @@
|
|||||||
.syntax unified
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.type _init,%function
|
|
||||||
.align 2
|
|
||||||
_init:
|
|
||||||
push {r0,lr}
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.type _fini,%function
|
|
||||||
.align 2
|
|
||||||
_fini:
|
|
||||||
push {r0,lr}
|
|
||||||
9
lib/libc/musl/crt/arm/crtn.s
vendored
9
lib/libc/musl/crt/arm/crtn.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.syntax unified
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
pop {r0,lr}
|
|
||||||
bx lr
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
pop {r0,lr}
|
|
||||||
bx lr
|
|
||||||
0
lib/libc/musl/crt/crti.c
vendored
0
lib/libc/musl/crt/crti.c
vendored
0
lib/libc/musl/crt/crtn.c
vendored
0
lib/libc/musl/crt/crtn.c
vendored
9
lib/libc/musl/crt/i386/crti.s
vendored
9
lib/libc/musl/crt/i386/crti.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
sub $12,%esp
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
sub $12,%esp
|
|
||||||
7
lib/libc/musl/crt/i386/crtn.s
vendored
7
lib/libc/musl/crt/i386/crtn.s
vendored
@ -1,7 +0,0 @@
|
|||||||
.section .init
|
|
||||||
add $12,%esp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
add $12,%esp
|
|
||||||
ret
|
|
||||||
13
lib/libc/musl/crt/microblaze/crti.s
vendored
13
lib/libc/musl/crt/microblaze/crti.s
vendored
@ -1,13 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.align 2
|
|
||||||
_init:
|
|
||||||
addi r1, r1, -32
|
|
||||||
swi r15, r1, 0
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.align 2
|
|
||||||
_fini:
|
|
||||||
addi r1, r1, -32
|
|
||||||
swi r15, r1, 0
|
|
||||||
9
lib/libc/musl/crt/microblaze/crtn.s
vendored
9
lib/libc/musl/crt/microblaze/crtn.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
lwi r15, r1, 0
|
|
||||||
rtsd r15, 8
|
|
||||||
addi r1, r1, 32
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
lwi r15, r1, 0
|
|
||||||
rtsd r15, 8
|
|
||||||
addi r1, r1, 32
|
|
||||||
19
lib/libc/musl/crt/mips/crti.s
vendored
19
lib/libc/musl/crt/mips/crti.s
vendored
@ -1,19 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.type _init,@function
|
|
||||||
.align 2
|
|
||||||
_init:
|
|
||||||
subu $sp,$sp,32
|
|
||||||
sw $gp,24($sp)
|
|
||||||
sw $ra,28($sp)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.type _fini,@function
|
|
||||||
.align 2
|
|
||||||
_fini:
|
|
||||||
subu $sp,$sp,32
|
|
||||||
sw $gp,24($sp)
|
|
||||||
sw $ra,28($sp)
|
|
||||||
15
lib/libc/musl/crt/mips/crtn.s
vendored
15
lib/libc/musl/crt/mips/crtn.s
vendored
@ -1,15 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
lw $gp,24($sp)
|
|
||||||
lw $ra,28($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
addu $sp,$sp,32
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
lw $gp,24($sp)
|
|
||||||
lw $ra,28($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
addu $sp,$sp,32
|
|
||||||
17
lib/libc/musl/crt/mips64/crti.s
vendored
17
lib/libc/musl/crt/mips64/crti.s
vendored
@ -1,17 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.align 3
|
|
||||||
_init:
|
|
||||||
dsubu $sp, $sp, 32
|
|
||||||
sd $gp, 16($sp)
|
|
||||||
sd $ra, 24($sp)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.align 3
|
|
||||||
_fini:
|
|
||||||
dsubu $sp, $sp, 32
|
|
||||||
sd $gp, 16($sp)
|
|
||||||
sd $ra, 24($sp)
|
|
||||||
15
lib/libc/musl/crt/mips64/crtn.s
vendored
15
lib/libc/musl/crt/mips64/crtn.s
vendored
@ -1,15 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
ld $gp,16($sp)
|
|
||||||
ld $ra,24($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
daddu $sp,$sp,32
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
ld $gp,16($sp)
|
|
||||||
ld $ra,24($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
daddu $sp,$sp,32
|
|
||||||
18
lib/libc/musl/crt/mipsn32/crti.s
vendored
18
lib/libc/musl/crt/mipsn32/crti.s
vendored
@ -1,18 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.type _init,@function
|
|
||||||
.align 2
|
|
||||||
_init:
|
|
||||||
subu $sp, $sp, 32
|
|
||||||
sd $gp, 16($sp)
|
|
||||||
sd $ra, 24($sp)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.type _fini,@function
|
|
||||||
.align 2
|
|
||||||
_fini:
|
|
||||||
subu $sp, $sp, 32
|
|
||||||
sd $gp, 16($sp)
|
|
||||||
sd $ra, 24($sp)
|
|
||||||
14
lib/libc/musl/crt/mipsn32/crtn.s
vendored
14
lib/libc/musl/crt/mipsn32/crtn.s
vendored
@ -1,14 +0,0 @@
|
|||||||
.set noreorder
|
|
||||||
.section .init
|
|
||||||
ld $gp, 16($sp)
|
|
||||||
ld $ra, 24($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
addu $sp, $sp, 32
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
ld $gp, 16($sp)
|
|
||||||
ld $ra, 24($sp)
|
|
||||||
# zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
|
|
||||||
jr $ra
|
|
||||||
addu $sp, $sp, 32
|
|
||||||
11
lib/libc/musl/crt/or1k/crti.s
vendored
11
lib/libc/musl/crt/or1k/crti.s
vendored
@ -1,11 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
l.addi r1,r1,-4
|
|
||||||
l.sw 0(r1),r9
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
l.addi r1,r1,-4
|
|
||||||
l.sw 0(r1),r9
|
|
||||||
9
lib/libc/musl/crt/or1k/crtn.s
vendored
9
lib/libc/musl/crt/or1k/crtn.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
l.lwz r9,0(r1)
|
|
||||||
l.jr r9
|
|
||||||
l.addi r1,r1,4
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
l.lwz r9,0(r1)
|
|
||||||
l.jr r9
|
|
||||||
l.addi r1,r1,4
|
|
||||||
15
lib/libc/musl/crt/powerpc/crti.s
vendored
15
lib/libc/musl/crt/powerpc/crti.s
vendored
@ -1,15 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
stwu 1,-32(1)
|
|
||||||
mflr 0
|
|
||||||
stw 0,36(1)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
stwu 1,-32(1)
|
|
||||||
mflr 0
|
|
||||||
stw 0,36(1)
|
|
||||||
13
lib/libc/musl/crt/powerpc/crtn.s
vendored
13
lib/libc/musl/crt/powerpc/crtn.s
vendored
@ -1,13 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
lwz 0,36(1)
|
|
||||||
addi 1,1,32
|
|
||||||
mtlr 0
|
|
||||||
blr
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
lwz 0,36(1)
|
|
||||||
addi 1,1,32
|
|
||||||
mtlr 0
|
|
||||||
blr
|
|
||||||
21
lib/libc/musl/crt/powerpc64/crti.s
vendored
21
lib/libc/musl/crt/powerpc64/crti.s
vendored
@ -1,21 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
addis 2, 12, .TOC.-_init@ha
|
|
||||||
addi 2, 2, .TOC.-_init@l
|
|
||||||
.localentry _init,.-_init
|
|
||||||
mflr 0
|
|
||||||
std 0, 16(1)
|
|
||||||
stdu 1,-32(1)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
addis 2, 12, .TOC.-_fini@ha
|
|
||||||
addi 2, 2, .TOC.-_fini@l
|
|
||||||
.localentry _fini,.-_fini
|
|
||||||
mflr 0
|
|
||||||
std 0, 16(1)
|
|
||||||
stdu 1,-32(1)
|
|
||||||
13
lib/libc/musl/crt/powerpc64/crtn.s
vendored
13
lib/libc/musl/crt/powerpc64/crtn.s
vendored
@ -1,13 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
addi 1, 1, 32
|
|
||||||
ld 0, 16(1)
|
|
||||||
mtlr 0
|
|
||||||
blr
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
addi 1, 1, 32
|
|
||||||
ld 0, 16(1)
|
|
||||||
mtlr 0
|
|
||||||
blr
|
|
||||||
17
lib/libc/musl/crt/s390x/crti.s
vendored
17
lib/libc/musl/crt/s390x/crti.s
vendored
@ -1,17 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
stmg %r14, %r15, 112(%r15)
|
|
||||||
lgr %r0, %r15
|
|
||||||
aghi %r15, -160
|
|
||||||
stg %r0, 0(%r15)
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
stmg %r14, %r15, 112(%r15)
|
|
||||||
lgr %r0, %r15
|
|
||||||
aghi %r15, -160
|
|
||||||
stg %r0, 0(%r15)
|
|
||||||
9
lib/libc/musl/crt/s390x/crtn.s
vendored
9
lib/libc/musl/crt/s390x/crtn.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.align 2
|
|
||||||
lmg %r14, %r15, 272(%r15)
|
|
||||||
br %r14
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.align 2
|
|
||||||
lmg %r14, %r15, 272(%r15)
|
|
||||||
br %r14
|
|
||||||
21
lib/libc/musl/crt/sh/crti.s
vendored
21
lib/libc/musl/crt/sh/crti.s
vendored
@ -1,21 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
.type _init, @function
|
|
||||||
_init:
|
|
||||||
add #-4, r15
|
|
||||||
mov.l r12, @-r15
|
|
||||||
mov.l r14, @-r15
|
|
||||||
sts.l pr, @-r15
|
|
||||||
mov r15, r14
|
|
||||||
nop
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
.type _fini, @function
|
|
||||||
_fini:
|
|
||||||
add #-4, r15
|
|
||||||
mov.l r12, @-r15
|
|
||||||
mov.l r14, @-r15
|
|
||||||
sts.l pr, @-r15
|
|
||||||
mov r15, r14
|
|
||||||
nop
|
|
||||||
13
lib/libc/musl/crt/sh/crtn.s
vendored
13
lib/libc/musl/crt/sh/crtn.s
vendored
@ -1,13 +0,0 @@
|
|||||||
.section .init
|
|
||||||
lds.l @r15+, pr
|
|
||||||
mov.l @r15+, r14
|
|
||||||
mov.l @r15+, r12
|
|
||||||
rts
|
|
||||||
add #4, r15
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
lds.l @r15+, pr
|
|
||||||
mov.l @r15+, r14
|
|
||||||
mov.l @r15+, r12
|
|
||||||
rts
|
|
||||||
add #4, r15
|
|
||||||
9
lib/libc/musl/crt/x32/crti.s
vendored
9
lib/libc/musl/crt/x32/crti.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
push %rax
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
push %rax
|
|
||||||
7
lib/libc/musl/crt/x32/crtn.s
vendored
7
lib/libc/musl/crt/x32/crtn.s
vendored
@ -1,7 +0,0 @@
|
|||||||
.section .init
|
|
||||||
pop %rax
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
pop %rax
|
|
||||||
ret
|
|
||||||
9
lib/libc/musl/crt/x86_64/crti.s
vendored
9
lib/libc/musl/crt/x86_64/crti.s
vendored
@ -1,9 +0,0 @@
|
|||||||
.section .init
|
|
||||||
.global _init
|
|
||||||
_init:
|
|
||||||
push %rax
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
.global _fini
|
|
||||||
_fini:
|
|
||||||
push %rax
|
|
||||||
7
lib/libc/musl/crt/x86_64/crtn.s
vendored
7
lib/libc/musl/crt/x86_64/crtn.s
vendored
@ -1,7 +0,0 @@
|
|||||||
.section .init
|
|
||||||
pop %rax
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .fini
|
|
||||||
pop %rax
|
|
||||||
ret
|
|
||||||
@ -122,6 +122,10 @@ link_task_queue_postponed: std.ArrayListUnmanaged(link.Task) = .empty,
|
|||||||
/// the linker task thread.
|
/// the linker task thread.
|
||||||
remaining_prelink_tasks: u32,
|
remaining_prelink_tasks: u32,
|
||||||
|
|
||||||
|
/// Set of work that can be represented by only flags to determine whether the
|
||||||
|
/// work is queued or not.
|
||||||
|
queued_jobs: QueuedJobs,
|
||||||
|
|
||||||
work_queues: [
|
work_queues: [
|
||||||
len: {
|
len: {
|
||||||
var len: usize = 0;
|
var len: usize = 0;
|
||||||
@ -193,10 +197,6 @@ stack_report: bool,
|
|||||||
debug_compiler_runtime_libs: bool,
|
debug_compiler_runtime_libs: bool,
|
||||||
debug_compile_errors: bool,
|
debug_compile_errors: bool,
|
||||||
incremental: bool,
|
incremental: bool,
|
||||||
job_queued_compiler_rt_lib: bool = false,
|
|
||||||
job_queued_compiler_rt_obj: bool = false,
|
|
||||||
job_queued_fuzzer_lib: bool = false,
|
|
||||||
job_queued_update_builtin_zig: bool,
|
|
||||||
alloc_failure_occurred: bool = false,
|
alloc_failure_occurred: bool = false,
|
||||||
last_update_was_cache_hit: bool = false,
|
last_update_was_cache_hit: bool = false,
|
||||||
|
|
||||||
@ -234,13 +234,13 @@ tsan_lib: ?CrtFile = null,
|
|||||||
/// and resolved before calling linker.flush().
|
/// and resolved before calling linker.flush().
|
||||||
libc_static_lib: ?CrtFile = null,
|
libc_static_lib: ?CrtFile = null,
|
||||||
/// Populated when we build the libcompiler_rt static library. A Job to build this is indicated
|
/// Populated when we build the libcompiler_rt static library. A Job to build this is indicated
|
||||||
/// by setting `job_queued_compiler_rt_lib` and resolved before calling linker.flush().
|
/// by setting `queued_jobs.compiler_rt_lib` and resolved before calling linker.flush().
|
||||||
compiler_rt_lib: ?CrtFile = null,
|
compiler_rt_lib: ?CrtFile = null,
|
||||||
/// Populated when we build the compiler_rt_obj object. A Job to build this is indicated
|
/// Populated when we build the compiler_rt_obj object. A Job to build this is indicated
|
||||||
/// by setting `job_queued_compiler_rt_obj` and resolved before calling linker.flush().
|
/// by setting `queued_jobs.compiler_rt_obj` and resolved before calling linker.flush().
|
||||||
compiler_rt_obj: ?CrtFile = null,
|
compiler_rt_obj: ?CrtFile = null,
|
||||||
/// Populated when we build the libfuzzer static library. A Job to build this
|
/// Populated when we build the libfuzzer static library. A Job to build this
|
||||||
/// is indicated by setting `job_queued_fuzzer_lib` and resolved before
|
/// is indicated by setting `queued_jobs.fuzzer_lib` and resolved before
|
||||||
/// calling linker.flush().
|
/// calling linker.flush().
|
||||||
fuzzer_lib: ?CrtFile = null,
|
fuzzer_lib: ?CrtFile = null,
|
||||||
|
|
||||||
@ -284,6 +284,27 @@ file_system_inputs: ?*std.ArrayListUnmanaged(u8),
|
|||||||
/// This digest will be known after update() is called.
|
/// This digest will be known after update() is called.
|
||||||
digest: ?[Cache.bin_digest_len]u8 = null,
|
digest: ?[Cache.bin_digest_len]u8 = null,
|
||||||
|
|
||||||
|
const QueuedJobs = struct {
|
||||||
|
compiler_rt_lib: bool = false,
|
||||||
|
compiler_rt_obj: bool = false,
|
||||||
|
fuzzer_lib: bool = false,
|
||||||
|
update_builtin_zig: bool,
|
||||||
|
musl_crt_file: [@typeInfo(musl.CrtFile).@"enum".fields.len]bool = @splat(false),
|
||||||
|
glibc_crt_file: [@typeInfo(glibc.CrtFile).@"enum".fields.len]bool = @splat(false),
|
||||||
|
/// one of WASI libc static objects
|
||||||
|
wasi_libc_crt_file: [@typeInfo(wasi_libc.CrtFile).@"enum".fields.len]bool = @splat(false),
|
||||||
|
/// one of the mingw-w64 static objects
|
||||||
|
mingw_crt_file: [@typeInfo(mingw.CrtFile).@"enum".fields.len]bool = @splat(false),
|
||||||
|
/// all of the glibc shared objects
|
||||||
|
glibc_shared_objects: bool = false,
|
||||||
|
/// libunwind.a, usually needed when linking libc
|
||||||
|
libunwind: bool = false,
|
||||||
|
libcxx: bool = false,
|
||||||
|
libcxxabi: bool = false,
|
||||||
|
libtsan: bool = false,
|
||||||
|
zig_libc: bool = false,
|
||||||
|
};
|
||||||
|
|
||||||
pub const default_stack_protector_buffer_size = target_util.default_stack_protector_buffer_size;
|
pub const default_stack_protector_buffer_size = target_util.default_stack_protector_buffer_size;
|
||||||
pub const SemaError = Zcu.SemaError;
|
pub const SemaError = Zcu.SemaError;
|
||||||
|
|
||||||
@ -377,26 +398,6 @@ const Job = union(enum) {
|
|||||||
/// Fully resolve the given `struct` or `union` type.
|
/// Fully resolve the given `struct` or `union` type.
|
||||||
resolve_type_fully: InternPool.Index,
|
resolve_type_fully: InternPool.Index,
|
||||||
|
|
||||||
/// one of the glibc static objects
|
|
||||||
glibc_crt_file: glibc.CrtFile,
|
|
||||||
/// all of the glibc shared objects
|
|
||||||
glibc_shared_objects,
|
|
||||||
/// one of the musl static objects
|
|
||||||
musl_crt_file: musl.CrtFile,
|
|
||||||
/// one of the mingw-w64 static objects
|
|
||||||
mingw_crt_file: mingw.CrtFile,
|
|
||||||
|
|
||||||
/// libunwind.a, usually needed when linking libc
|
|
||||||
libunwind: void,
|
|
||||||
libcxx: void,
|
|
||||||
libcxxabi: void,
|
|
||||||
libtsan: void,
|
|
||||||
/// needed when not linking libc and using LLVM for code generation because it generates
|
|
||||||
/// calls to, for example, memcpy and memset.
|
|
||||||
zig_libc: void,
|
|
||||||
/// one of WASI libc static objects
|
|
||||||
wasi_libc_crt_file: wasi_libc.CrtFile,
|
|
||||||
|
|
||||||
/// The value is the index into `windows_libs`.
|
/// The value is the index into `windows_libs`.
|
||||||
windows_import_lib: usize,
|
windows_import_lib: usize,
|
||||||
|
|
||||||
@ -800,8 +801,6 @@ pub const MiscTask = enum {
|
|||||||
docs_copy,
|
docs_copy,
|
||||||
docs_wasm,
|
docs_wasm,
|
||||||
|
|
||||||
@"musl crti.o",
|
|
||||||
@"musl crtn.o",
|
|
||||||
@"musl crt1.o",
|
@"musl crt1.o",
|
||||||
@"musl rcrt1.o",
|
@"musl rcrt1.o",
|
||||||
@"musl Scrt1.o",
|
@"musl Scrt1.o",
|
||||||
@ -816,8 +815,6 @@ pub const MiscTask = enum {
|
|||||||
@"libwasi-emulated-mman.a",
|
@"libwasi-emulated-mman.a",
|
||||||
@"libwasi-emulated-signal.a",
|
@"libwasi-emulated-signal.a",
|
||||||
|
|
||||||
@"glibc crti.o",
|
|
||||||
@"glibc crtn.o",
|
|
||||||
@"glibc Scrt1.o",
|
@"glibc Scrt1.o",
|
||||||
@"glibc libc_nonshared.a",
|
@"glibc libc_nonshared.a",
|
||||||
@"glibc shared object",
|
@"glibc shared object",
|
||||||
@ -1512,7 +1509,9 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
|||||||
.framework_dirs = options.framework_dirs,
|
.framework_dirs = options.framework_dirs,
|
||||||
.llvm_opt_bisect_limit = options.llvm_opt_bisect_limit,
|
.llvm_opt_bisect_limit = options.llvm_opt_bisect_limit,
|
||||||
.skip_linker_dependencies = options.skip_linker_dependencies,
|
.skip_linker_dependencies = options.skip_linker_dependencies,
|
||||||
.job_queued_update_builtin_zig = have_zcu,
|
.queued_jobs = .{
|
||||||
|
.update_builtin_zig = have_zcu,
|
||||||
|
},
|
||||||
.function_sections = options.function_sections,
|
.function_sections = options.function_sections,
|
||||||
.data_sections = options.data_sections,
|
.data_sections = options.data_sections,
|
||||||
.native_system_include_paths = options.native_system_include_paths,
|
.native_system_include_paths = options.native_system_include_paths,
|
||||||
@ -1804,64 +1803,44 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
|||||||
} else if (target.isMusl() and !target.isWasm()) {
|
} else if (target.isMusl() and !target.isWasm()) {
|
||||||
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
||||||
|
|
||||||
if (musl.needsCrtiCrtn(target)) {
|
|
||||||
try comp.queueJobs(&[_]Job{
|
|
||||||
.{ .musl_crt_file = .crti_o },
|
|
||||||
.{ .musl_crt_file = .crtn_o },
|
|
||||||
});
|
|
||||||
comp.remaining_prelink_tasks += 2;
|
|
||||||
}
|
|
||||||
if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| {
|
if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| {
|
||||||
try comp.queueJobs(&.{.{ .musl_crt_file = f }});
|
comp.queued_jobs.musl_crt_file[@intFromEnum(f)] = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
try comp.queueJobs(&.{.{ .musl_crt_file = switch (comp.config.link_mode) {
|
switch (comp.config.link_mode) {
|
||||||
.static => .libc_a,
|
.static => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_a)] = true,
|
||||||
.dynamic => .libc_so,
|
.dynamic => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_so)] = true,
|
||||||
} }});
|
}
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
} else if (target.isGnuLibC()) {
|
} else if (target.isGnuLibC()) {
|
||||||
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
||||||
|
|
||||||
if (glibc.needsCrtiCrtn(target)) {
|
|
||||||
try comp.queueJobs(&[_]Job{
|
|
||||||
.{ .glibc_crt_file = .crti_o },
|
|
||||||
.{ .glibc_crt_file = .crtn_o },
|
|
||||||
});
|
|
||||||
comp.remaining_prelink_tasks += 2;
|
|
||||||
}
|
|
||||||
if (glibc.needsCrt0(comp.config.output_mode)) |f| {
|
if (glibc.needsCrt0(comp.config.output_mode)) |f| {
|
||||||
try comp.queueJobs(&.{.{ .glibc_crt_file = f }});
|
comp.queued_jobs.glibc_crt_file[@intFromEnum(f)] = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
try comp.queueJobs(&[_]Job{
|
comp.queued_jobs.glibc_shared_objects = true;
|
||||||
.{ .glibc_shared_objects = {} },
|
|
||||||
.{ .glibc_crt_file = .libc_nonshared_a },
|
|
||||||
});
|
|
||||||
comp.remaining_prelink_tasks += 1;
|
|
||||||
comp.remaining_prelink_tasks += glibc.sharedObjectsCount(&target);
|
comp.remaining_prelink_tasks += glibc.sharedObjectsCount(&target);
|
||||||
|
|
||||||
|
comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true;
|
||||||
|
comp.remaining_prelink_tasks += 1;
|
||||||
} else if (target.isWasm() and target.os.tag == .wasi) {
|
} else if (target.isWasm() and target.os.tag == .wasi) {
|
||||||
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
||||||
|
|
||||||
for (comp.wasi_emulated_libs) |crt_file| {
|
for (comp.wasi_emulated_libs) |crt_file| {
|
||||||
try comp.queueJob(.{
|
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(crt_file)] = true;
|
||||||
.wasi_libc_crt_file = crt_file,
|
|
||||||
});
|
|
||||||
comp.remaining_prelink_tasks += 1;
|
|
||||||
}
|
}
|
||||||
try comp.queueJobs(&[_]Job{
|
comp.remaining_prelink_tasks += @intCast(comp.wasi_emulated_libs.len);
|
||||||
.{ .wasi_libc_crt_file = wasi_libc.execModelCrtFile(comp.config.wasi_exec_model) },
|
|
||||||
.{ .wasi_libc_crt_file = .libc_a },
|
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true;
|
||||||
});
|
comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true;
|
||||||
comp.remaining_prelink_tasks += 2;
|
comp.remaining_prelink_tasks += 2;
|
||||||
} else if (target.isMinGW()) {
|
} else if (target.isMinGW()) {
|
||||||
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
|
||||||
|
|
||||||
const crt_job: Job = .{ .mingw_crt_file = if (is_dyn_lib) .dllcrt2_o else .crt2_o };
|
const main_crt_file: mingw.CrtFile = if (is_dyn_lib) .dllcrt2_o else .crt2_o;
|
||||||
try comp.queueJobs(&.{
|
comp.queued_jobs.mingw_crt_file[@intFromEnum(main_crt_file)] = true;
|
||||||
.{ .mingw_crt_file = .mingw32_lib },
|
comp.queued_jobs.mingw_crt_file[@intFromEnum(mingw.CrtFile.mingw32_lib)] = true;
|
||||||
crt_job,
|
|
||||||
});
|
|
||||||
comp.remaining_prelink_tasks += 2;
|
comp.remaining_prelink_tasks += 2;
|
||||||
|
|
||||||
// When linking mingw-w64 there are some import libs we always need.
|
// When linking mingw-w64 there are some import libs we always need.
|
||||||
@ -1873,7 +1852,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
|||||||
else => return error.LibCUnavailable,
|
else => return error.LibCUnavailable,
|
||||||
}
|
}
|
||||||
} else if (target.os.tag == .freestanding and capable_of_building_zig_libc) {
|
} else if (target.os.tag == .freestanding and capable_of_building_zig_libc) {
|
||||||
try comp.queueJob(.{ .zig_libc = {} });
|
comp.queued_jobs.zig_libc = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
} else {
|
} else {
|
||||||
return error.LibCUnavailable;
|
return error.LibCUnavailable;
|
||||||
@ -1886,18 +1865,22 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
|||||||
for (0..count) |i| {
|
for (0..count) |i| {
|
||||||
try comp.queueJob(.{ .windows_import_lib = i });
|
try comp.queueJob(.{ .windows_import_lib = i });
|
||||||
}
|
}
|
||||||
|
// when integrating coff linker with prelink, the above
|
||||||
|
// queueJob will need to change into something else since those
|
||||||
|
// jobs are dispatched *after* the link_task_wait_group.wait()
|
||||||
|
// that happens when separateCodegenThreadOk() is false.
|
||||||
}
|
}
|
||||||
if (comp.wantBuildLibUnwindFromSource()) {
|
if (comp.wantBuildLibUnwindFromSource()) {
|
||||||
try comp.queueJob(.{ .libunwind = {} });
|
comp.queued_jobs.libunwind = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.link_libcpp) {
|
if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.link_libcpp) {
|
||||||
try comp.queueJob(.libcxx);
|
comp.queued_jobs.libcxx = true;
|
||||||
try comp.queueJob(.libcxxabi);
|
comp.queued_jobs.libcxxabi = true;
|
||||||
comp.remaining_prelink_tasks += 2;
|
comp.remaining_prelink_tasks += 2;
|
||||||
}
|
}
|
||||||
if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.any_sanitize_thread) {
|
if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.any_sanitize_thread) {
|
||||||
try comp.queueJob(.libtsan);
|
comp.queued_jobs.libtsan = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1916,20 +1899,20 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
|||||||
if (comp.include_compiler_rt and capable_of_building_compiler_rt) {
|
if (comp.include_compiler_rt and capable_of_building_compiler_rt) {
|
||||||
if (is_exe_or_dyn_lib) {
|
if (is_exe_or_dyn_lib) {
|
||||||
log.debug("queuing a job to build compiler_rt_lib", .{});
|
log.debug("queuing a job to build compiler_rt_lib", .{});
|
||||||
comp.job_queued_compiler_rt_lib = true;
|
comp.queued_jobs.compiler_rt_lib = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
} else if (output_mode != .Obj) {
|
} else if (output_mode != .Obj) {
|
||||||
log.debug("queuing a job to build compiler_rt_obj", .{});
|
log.debug("queuing a job to build compiler_rt_obj", .{});
|
||||||
// In this case we are making a static library, so we ask
|
// In this case we are making a static library, so we ask
|
||||||
// for a compiler-rt object to put in it.
|
// for a compiler-rt object to put in it.
|
||||||
comp.job_queued_compiler_rt_obj = true;
|
comp.queued_jobs.compiler_rt_obj = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_exe_or_dyn_lib and comp.config.any_fuzz and capable_of_building_compiler_rt) {
|
if (is_exe_or_dyn_lib and comp.config.any_fuzz and capable_of_building_compiler_rt) {
|
||||||
log.debug("queuing a job to build libfuzzer", .{});
|
log.debug("queuing a job to build libfuzzer", .{});
|
||||||
comp.job_queued_fuzzer_lib = true;
|
comp.queued_jobs.fuzzer_lib = true;
|
||||||
comp.remaining_prelink_tasks += 1;
|
comp.remaining_prelink_tasks += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3712,21 +3695,70 @@ fn performAllTheWorkInner(
|
|||||||
work_queue_wait_group.spawnManager(workerDocsWasm, .{ comp, main_progress_node });
|
work_queue_wait_group.spawnManager(workerDocsWasm, .{ comp, main_progress_node });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comp.job_queued_compiler_rt_lib) {
|
if (testAndClear(&comp.queued_jobs.compiler_rt_lib)) {
|
||||||
comp.job_queued_compiler_rt_lib = false;
|
|
||||||
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Lib, &comp.compiler_rt_lib, main_progress_node });
|
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Lib, &comp.compiler_rt_lib, main_progress_node });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comp.job_queued_compiler_rt_obj) {
|
if (testAndClear(&comp.queued_jobs.compiler_rt_obj)) {
|
||||||
comp.job_queued_compiler_rt_obj = false;
|
|
||||||
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Obj, &comp.compiler_rt_obj, main_progress_node });
|
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Obj, &comp.compiler_rt_obj, main_progress_node });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comp.job_queued_fuzzer_lib) {
|
if (testAndClear(&comp.queued_jobs.fuzzer_lib)) {
|
||||||
comp.job_queued_fuzzer_lib = false;
|
|
||||||
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "fuzzer.zig", .libfuzzer, .Lib, &comp.fuzzer_lib, main_progress_node });
|
comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "fuzzer.zig", .libfuzzer, .Lib, &comp.fuzzer_lib, main_progress_node });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.glibc_shared_objects)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildGlibcSharedObjects, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.libunwind)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildLibUnwind, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.libcxx)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildLibCxx, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.libcxxabi)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildLibCxxAbi, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.libtsan)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildLibTsan, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testAndClear(&comp.queued_jobs.zig_libc)) {
|
||||||
|
comp.link_task_wait_group.spawnManager(buildZigLibc, .{ comp, main_progress_node });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (0..@typeInfo(musl.CrtFile).@"enum".fields.len) |i| {
|
||||||
|
if (testAndClear(&comp.queued_jobs.musl_crt_file[i])) {
|
||||||
|
const tag: musl.CrtFile = @enumFromInt(i);
|
||||||
|
comp.link_task_wait_group.spawnManager(buildMuslCrtFile, .{ comp, tag, main_progress_node });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (0..@typeInfo(glibc.CrtFile).@"enum".fields.len) |i| {
|
||||||
|
if (testAndClear(&comp.queued_jobs.glibc_crt_file[i])) {
|
||||||
|
const tag: glibc.CrtFile = @enumFromInt(i);
|
||||||
|
comp.link_task_wait_group.spawnManager(buildGlibcCrtFile, .{ comp, tag, main_progress_node });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (0..@typeInfo(wasi_libc.CrtFile).@"enum".fields.len) |i| {
|
||||||
|
if (testAndClear(&comp.queued_jobs.wasi_libc_crt_file[i])) {
|
||||||
|
const tag: wasi_libc.CrtFile = @enumFromInt(i);
|
||||||
|
comp.link_task_wait_group.spawnManager(buildWasiLibcCrtFile, .{ comp, tag, main_progress_node });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (0..@typeInfo(mingw.CrtFile).@"enum".fields.len) |i| {
|
||||||
|
if (testAndClear(&comp.queued_jobs.mingw_crt_file[i])) {
|
||||||
|
const tag: mingw.CrtFile = @enumFromInt(i);
|
||||||
|
comp.link_task_wait_group.spawnManager(buildMingwCrtFile, .{ comp, tag, main_progress_node });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const astgen_frame = tracy.namedFrame("astgen");
|
const astgen_frame = tracy.namedFrame("astgen");
|
||||||
defer astgen_frame.end();
|
defer astgen_frame.end();
|
||||||
@ -3741,8 +3773,8 @@ fn performAllTheWorkInner(
|
|||||||
// 1. to avoid race condition of zig processes truncating each other's builtin.zig files
|
// 1. to avoid race condition of zig processes truncating each other's builtin.zig files
|
||||||
// 2. optimization; in the hot path it only incurs a stat() syscall, which happens
|
// 2. optimization; in the hot path it only incurs a stat() syscall, which happens
|
||||||
// in the `astgen_wait_group`.
|
// in the `astgen_wait_group`.
|
||||||
if (comp.job_queued_update_builtin_zig) b: {
|
if (comp.queued_jobs.update_builtin_zig) b: {
|
||||||
comp.job_queued_update_builtin_zig = false;
|
comp.queued_jobs.update_builtin_zig = false;
|
||||||
if (comp.zcu == null) break :b;
|
if (comp.zcu == null) break :b;
|
||||||
// TODO put all the modules in a flat array to make them easy to iterate.
|
// TODO put all the modules in a flat array to make them easy to iterate.
|
||||||
var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
|
var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
|
||||||
@ -3821,11 +3853,12 @@ fn performAllTheWorkInner(
|
|||||||
comp.link_task_wait_group.wait();
|
comp.link_task_wait_group.wait();
|
||||||
comp.link_task_wait_group.reset();
|
comp.link_task_wait_group.reset();
|
||||||
std.log.scoped(.link).debug("finished waiting for link_task_wait_group", .{});
|
std.log.scoped(.link).debug("finished waiting for link_task_wait_group", .{});
|
||||||
|
assert(comp.remaining_prelink_tasks == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
work: while (true) {
|
work: while (true) {
|
||||||
for (&comp.work_queues) |*work_queue| if (work_queue.readItem()) |job| {
|
for (&comp.work_queues) |*work_queue| if (work_queue.readItem()) |job| {
|
||||||
try processOneJob(@intFromEnum(Zcu.PerThread.Id.main), comp, job, main_progress_node);
|
try processOneJob(@intFromEnum(Zcu.PerThread.Id.main), comp, job);
|
||||||
continue :work;
|
continue :work;
|
||||||
};
|
};
|
||||||
if (comp.zcu) |zcu| {
|
if (comp.zcu) |zcu| {
|
||||||
@ -3860,7 +3893,7 @@ pub fn queueJobs(comp: *Compilation, jobs: []const Job) !void {
|
|||||||
for (jobs) |job| try comp.queueJob(job);
|
for (jobs) |job| try comp.queueJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progress.Node) JobError!void {
|
fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void {
|
||||||
switch (job) {
|
switch (job) {
|
||||||
.codegen_nav => |nav_index| {
|
.codegen_nav => |nav_index| {
|
||||||
const zcu = comp.zcu.?;
|
const zcu = comp.zcu.?;
|
||||||
@ -3956,56 +3989,6 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progre
|
|||||||
error.AnalysisFail => return,
|
error.AnalysisFail => return,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
.glibc_crt_file => |crt_file| {
|
|
||||||
const named_frame = tracy.namedFrame("glibc_crt_file");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
glibc.buildCrtFile(comp, crt_file, prog_node) catch |err| {
|
|
||||||
// TODO Surface more error details.
|
|
||||||
comp.lockAndSetMiscFailure(.glibc_crt_file, "unable to build glibc CRT file: {s}", .{
|
|
||||||
@errorName(err),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.glibc_shared_objects => {
|
|
||||||
const named_frame = tracy.namedFrame("glibc_shared_objects");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
glibc.buildSharedObjects(comp, prog_node) catch |err| {
|
|
||||||
// TODO Surface more error details.
|
|
||||||
comp.lockAndSetMiscFailure(
|
|
||||||
.glibc_shared_objects,
|
|
||||||
"unable to build glibc shared objects: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.musl_crt_file => |crt_file| {
|
|
||||||
const named_frame = tracy.namedFrame("musl_crt_file");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
musl.buildCrtFile(comp, crt_file, prog_node) catch |err| {
|
|
||||||
// TODO Surface more error details.
|
|
||||||
comp.lockAndSetMiscFailure(
|
|
||||||
.musl_crt_file,
|
|
||||||
"unable to build musl CRT file: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.mingw_crt_file => |crt_file| {
|
|
||||||
const named_frame = tracy.namedFrame("mingw_crt_file");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
mingw.buildCrtFile(comp, crt_file, prog_node) catch |err| {
|
|
||||||
// TODO Surface more error details.
|
|
||||||
comp.lockAndSetMiscFailure(
|
|
||||||
.mingw_crt_file,
|
|
||||||
"unable to build mingw-w64 CRT file {s}: {s}",
|
|
||||||
.{ @tagName(crt_file), @errorName(err) },
|
|
||||||
);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.windows_import_lib => |index| {
|
.windows_import_lib => |index| {
|
||||||
const named_frame = tracy.namedFrame("windows_import_lib");
|
const named_frame = tracy.namedFrame("windows_import_lib");
|
||||||
defer named_frame.end();
|
defer named_frame.end();
|
||||||
@ -4020,95 +4003,6 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progre
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
.libunwind => {
|
|
||||||
const named_frame = tracy.namedFrame("libunwind");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
libunwind.buildStaticLib(comp, prog_node) catch |err| switch (err) {
|
|
||||||
error.OutOfMemory => return error.OutOfMemory,
|
|
||||||
error.SubCompilationFailed => return, // error reported already
|
|
||||||
else => comp.lockAndSetMiscFailure(
|
|
||||||
.libunwind,
|
|
||||||
"unable to build libunwind: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.libcxx => {
|
|
||||||
const named_frame = tracy.namedFrame("libcxx");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
libcxx.buildLibCXX(comp, prog_node) catch |err| switch (err) {
|
|
||||||
error.OutOfMemory => return error.OutOfMemory,
|
|
||||||
error.SubCompilationFailed => return, // error reported already
|
|
||||||
else => comp.lockAndSetMiscFailure(
|
|
||||||
.libcxx,
|
|
||||||
"unable to build libcxx: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.libcxxabi => {
|
|
||||||
const named_frame = tracy.namedFrame("libcxxabi");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
libcxx.buildLibCXXABI(comp, prog_node) catch |err| switch (err) {
|
|
||||||
error.OutOfMemory => return error.OutOfMemory,
|
|
||||||
error.SubCompilationFailed => return, // error reported already
|
|
||||||
else => comp.lockAndSetMiscFailure(
|
|
||||||
.libcxxabi,
|
|
||||||
"unable to build libcxxabi: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.libtsan => {
|
|
||||||
const named_frame = tracy.namedFrame("libtsan");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
libtsan.buildTsan(comp, prog_node) catch |err| switch (err) {
|
|
||||||
error.OutOfMemory => return error.OutOfMemory,
|
|
||||||
error.SubCompilationFailed => return, // error reported already
|
|
||||||
else => comp.lockAndSetMiscFailure(
|
|
||||||
.libtsan,
|
|
||||||
"unable to build TSAN library: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.wasi_libc_crt_file => |crt_file| {
|
|
||||||
const named_frame = tracy.namedFrame("wasi_libc_crt_file");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
wasi_libc.buildCrtFile(comp, crt_file, prog_node) catch |err| {
|
|
||||||
// TODO Surface more error details.
|
|
||||||
comp.lockAndSetMiscFailure(
|
|
||||||
.wasi_libc_crt_file,
|
|
||||||
"unable to build WASI libc CRT file: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
.zig_libc => {
|
|
||||||
const named_frame = tracy.namedFrame("zig_libc");
|
|
||||||
defer named_frame.end();
|
|
||||||
|
|
||||||
comp.buildOutputFromZig(
|
|
||||||
"c.zig",
|
|
||||||
.Lib,
|
|
||||||
&comp.libc_static_lib,
|
|
||||||
.zig_libc,
|
|
||||||
prog_node,
|
|
||||||
) catch |err| switch (err) {
|
|
||||||
error.OutOfMemory => return error.OutOfMemory,
|
|
||||||
error.SubCompilationFailed => return, // error reported already
|
|
||||||
else => comp.lockAndSetMiscFailure(
|
|
||||||
.zig_libc,
|
|
||||||
"unable to build zig's multitarget libc: {s}",
|
|
||||||
.{@errorName(err)},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4761,6 +4655,92 @@ fn buildRt(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void {
|
||||||
|
musl.buildCrtFile(comp, crt_file, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.musl_crt_file, "unable to build musl {s}: {s}", .{
|
||||||
|
@tagName(crt_file), @errorName(err),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void {
|
||||||
|
glibc.buildCrtFile(comp, crt_file, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.glibc_crt_file, "unable to build glibc {s}: {s}", .{
|
||||||
|
@tagName(crt_file), @errorName(err),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
glibc.buildSharedObjects(comp, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.glibc_shared_objects, "unable to build glibc shared objects: {s}", .{
|
||||||
|
@errorName(err),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void {
|
||||||
|
mingw.buildCrtFile(comp, crt_file, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.mingw_crt_file, "unable to build mingw-w64 {s}: {s}", .{
|
||||||
|
@tagName(crt_file), @errorName(err),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void {
|
||||||
|
wasi_libc.buildCrtFile(comp, crt_file, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.wasi_libc_crt_file, "unable to build WASI libc {s}: {s}", .{
|
||||||
|
@tagName(crt_file), @errorName(err),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildLibUnwind(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
libunwind.buildStaticLib(comp, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.libunwind, "unable to build libunwind: {s}", .{@errorName(err)}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
libcxx.buildLibCxx(comp, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.libcxx, "unable to build libcxx: {s}", .{@errorName(err)}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
libcxx.buildLibCxxAbi(comp, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.libcxxabi, "unable to build libcxxabi: {s}", .{@errorName(err)}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildLibTsan(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
libtsan.buildTsan(comp, prog_node) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.libtsan, "unable to build TSAN library: {s}", .{@errorName(err)}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn buildZigLibc(comp: *Compilation, prog_node: std.Progress.Node) void {
|
||||||
|
comp.buildOutputFromZig(
|
||||||
|
"c.zig",
|
||||||
|
.Lib,
|
||||||
|
&comp.libc_static_lib,
|
||||||
|
.zig_libc,
|
||||||
|
prog_node,
|
||||||
|
) catch |err| switch (err) {
|
||||||
|
error.SubCompilationFailed => return, // error reported already
|
||||||
|
else => comp.lockAndSetMiscFailure(.zig_libc, "unable to build zig's multitarget libc: {s}", .{@errorName(err)}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn reportRetryableCObjectError(
|
fn reportRetryableCObjectError(
|
||||||
comp: *Compilation,
|
comp: *Compilation,
|
||||||
c_object: *CObject,
|
c_object: *CObject,
|
||||||
@ -6805,3 +6785,9 @@ pub fn compilerRtOptMode(comp: Compilation) std.builtin.OptimizeMode {
|
|||||||
pub fn compilerRtStrip(comp: Compilation) bool {
|
pub fn compilerRtStrip(comp: Compilation) bool {
|
||||||
return comp.root_mod.strip;
|
return comp.root_mod.strip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn testAndClear(b: *bool) bool {
|
||||||
|
const result = b.*;
|
||||||
|
b.* = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
108
src/glibc.zig
108
src/glibc.zig
@ -156,29 +156,14 @@ pub fn loadMetaData(gpa: Allocator, contents: []const u8) LoadMetaDataError!*ABI
|
|||||||
return abi;
|
return abi;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn useElfInitFini(target: std.Target) bool {
|
|
||||||
// Legacy architectures use _init/_fini.
|
|
||||||
return switch (target.cpu.arch) {
|
|
||||||
.arm, .armeb => true,
|
|
||||||
.aarch64, .aarch64_be => true,
|
|
||||||
.m68k => true,
|
|
||||||
.mips, .mipsel, .mips64, .mips64el => true,
|
|
||||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => true,
|
|
||||||
.s390x => true,
|
|
||||||
.sparc, .sparc64 => true,
|
|
||||||
.x86, .x86_64 => true,
|
|
||||||
else => false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const CrtFile = enum {
|
pub const CrtFile = enum {
|
||||||
crti_o,
|
|
||||||
crtn_o,
|
|
||||||
scrt1_o,
|
scrt1_o,
|
||||||
libc_nonshared_a,
|
libc_nonshared_a,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
|
/// TODO replace anyerror with explicit error set, recording user-friendly errors with
|
||||||
|
/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
|
||||||
|
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
@ -199,51 +184,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
|||||||
// waste computation and create false negatives.
|
// waste computation and create false negatives.
|
||||||
|
|
||||||
switch (crt_file) {
|
switch (crt_file) {
|
||||||
.crti_o => {
|
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
|
||||||
try add_include_dirs(comp, arena, &args);
|
|
||||||
try args.appendSlice(&[_][]const u8{
|
|
||||||
"-D_LIBC_REENTRANT",
|
|
||||||
"-include",
|
|
||||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"),
|
|
||||||
"-DMODULE_NAME=libc",
|
|
||||||
"-Wno-nonportable-include-path",
|
|
||||||
"-include",
|
|
||||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"),
|
|
||||||
"-DTOP_NAMESPACE=glibc",
|
|
||||||
"-DASSEMBLER",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
});
|
|
||||||
var files = [_]Compilation.CSourceFile{
|
|
||||||
.{
|
|
||||||
.src_path = try start_asm_path(comp, arena, "crti.S"),
|
|
||||||
.cache_exempt_flags = args.items,
|
|
||||||
.owner = comp.root_mod,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return comp.build_crt_file("crti", .Obj, .@"glibc crti.o", prog_node, &files, .{});
|
|
||||||
},
|
|
||||||
.crtn_o => {
|
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
|
||||||
try add_include_dirs(comp, arena, &args);
|
|
||||||
try args.appendSlice(&[_][]const u8{
|
|
||||||
"-D_LIBC_REENTRANT",
|
|
||||||
"-DMODULE_NAME=libc",
|
|
||||||
"-include",
|
|
||||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"),
|
|
||||||
"-DTOP_NAMESPACE=glibc",
|
|
||||||
"-DASSEMBLER",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
});
|
|
||||||
var files = [_]Compilation.CSourceFile{
|
|
||||||
.{
|
|
||||||
.src_path = try start_asm_path(comp, arena, "crtn.S"),
|
|
||||||
.cache_exempt_flags = args.items,
|
|
||||||
.owner = undefined,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return comp.build_crt_file("crtn", .Obj, .@"glibc crtn.o", prog_node, &files, .{});
|
|
||||||
},
|
|
||||||
.scrt1_o => {
|
.scrt1_o => {
|
||||||
const start_o: Compilation.CSourceFile = blk: {
|
const start_o: Compilation.CSourceFile = blk: {
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
var args = std.ArrayList([]const u8).init(arena);
|
||||||
@ -381,9 +321,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
|||||||
});
|
});
|
||||||
try add_include_dirs(comp, arena, &args);
|
try add_include_dirs(comp, arena, &args);
|
||||||
|
|
||||||
if (!useElfInitFini(target)) {
|
try args.append("-DNO_INITFINI");
|
||||||
try args.append("-DNO_INITFINI");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.cpu.arch == .x86) {
|
if (target.cpu.arch == .x86) {
|
||||||
// This prevents i386/sysdep.h from trying to do some
|
// This prevents i386/sysdep.h from trying to do some
|
||||||
@ -430,32 +368,15 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
|
|||||||
try result.appendSlice(comp.zig_lib_directory.path.?);
|
try result.appendSlice(comp.zig_lib_directory.path.?);
|
||||||
try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s);
|
try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s);
|
||||||
if (is_sparc) {
|
if (is_sparc) {
|
||||||
if (mem.eql(u8, basename, "crti.S") or mem.eql(u8, basename, "crtn.S")) {
|
if (is_64) {
|
||||||
try result.appendSlice("sparc");
|
try result.appendSlice("sparc" ++ s ++ "sparc64");
|
||||||
} else {
|
} else {
|
||||||
if (is_64) {
|
try result.appendSlice("sparc" ++ s ++ "sparc32");
|
||||||
try result.appendSlice("sparc" ++ s ++ "sparc64");
|
|
||||||
} else {
|
|
||||||
try result.appendSlice("sparc" ++ s ++ "sparc32");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (arch.isArm()) {
|
} else if (arch.isArm()) {
|
||||||
try result.appendSlice("arm");
|
try result.appendSlice("arm");
|
||||||
} else if (arch.isMIPS()) {
|
} else if (arch.isMIPS()) {
|
||||||
if (!mem.eql(u8, basename, "crti.S") and !mem.eql(u8, basename, "crtn.S")) {
|
try result.appendSlice("mips");
|
||||||
try result.appendSlice("mips");
|
|
||||||
} else {
|
|
||||||
if (is_64) {
|
|
||||||
const abi_dir = if (comp.getTarget().abi == .gnuabin32)
|
|
||||||
"n32"
|
|
||||||
else
|
|
||||||
"n64";
|
|
||||||
try result.appendSlice("mips" ++ s ++ "mips64" ++ s);
|
|
||||||
try result.appendSlice(abi_dir);
|
|
||||||
} else {
|
|
||||||
try result.appendSlice("mips" ++ s ++ "mips32");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (arch == .x86_64) {
|
} else if (arch == .x86_64) {
|
||||||
try result.appendSlice("x86_64");
|
try result.appendSlice("x86_64");
|
||||||
} else if (arch == .x86) {
|
} else if (arch == .x86) {
|
||||||
@ -735,7 +656,9 @@ fn wordDirective(target: std.Target) []const u8 {
|
|||||||
return if (target.ptrBitWidth() == 64) ".quad" else ".long";
|
return if (target.ptrBitWidth() == 64) ".quad" else ".long";
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !void {
|
/// TODO replace anyerror with explicit error set, recording user-friendly errors with
|
||||||
|
/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
|
||||||
|
pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anyerror!void {
|
||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
|
||||||
@ -1362,15 +1285,6 @@ fn buildSharedLib(
|
|||||||
try comp.updateSubCompilation(sub_compilation, .@"glibc shared object", prog_node);
|
try comp.updateSubCompilation(sub_compilation, .@"glibc shared object", prog_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if glibc has crti/crtn sources for that architecture.
|
|
||||||
pub fn needsCrtiCrtn(target: std.Target) bool {
|
|
||||||
return switch (target.cpu.arch) {
|
|
||||||
.riscv32, .riscv64 => false,
|
|
||||||
.loongarch64 => false,
|
|
||||||
else => true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
|
pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
|
||||||
return switch (output_mode) {
|
return switch (output_mode) {
|
||||||
.Obj, .Lib => null,
|
.Obj, .Lib => null,
|
||||||
|
|||||||
@ -114,7 +114,7 @@ pub const BuildError = error{
|
|||||||
ZigCompilerNotBuiltWithLLVMExtensions,
|
ZigCompilerNotBuiltWithLLVMExtensions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void {
|
pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
@ -357,7 +357,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
|
|||||||
comp.queueLinkTaskMode(crt_file.full_object_path, output_mode);
|
comp.queueLinkTaskMode(crt_file.full_object_path, output_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buildLibCXXABI(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void {
|
pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,9 @@ pub const CrtFile = enum {
|
|||||||
mingw32_lib,
|
mingw32_lib,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
|
/// TODO replace anyerror with explicit error set, recording user-friendly errors with
|
||||||
|
/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
|
||||||
|
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
55
src/musl.zig
55
src/musl.zig
@ -9,8 +9,6 @@ const Compilation = @import("Compilation.zig");
|
|||||||
const build_options = @import("build_options");
|
const build_options = @import("build_options");
|
||||||
|
|
||||||
pub const CrtFile = enum {
|
pub const CrtFile = enum {
|
||||||
crti_o,
|
|
||||||
crtn_o,
|
|
||||||
crt1_o,
|
crt1_o,
|
||||||
rcrt1_o,
|
rcrt1_o,
|
||||||
scrt1_o,
|
scrt1_o,
|
||||||
@ -18,7 +16,9 @@ pub const CrtFile = enum {
|
|||||||
libc_so,
|
libc_so,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) !void {
|
/// TODO replace anyerror with explicit error set, recording user-friendly errors with
|
||||||
|
/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
|
||||||
|
pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
@ -28,40 +28,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
|
|||||||
const arena = arena_allocator.allocator();
|
const arena = arena_allocator.allocator();
|
||||||
|
|
||||||
switch (in_crt_file) {
|
switch (in_crt_file) {
|
||||||
.crti_o => {
|
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
|
||||||
try addCcArgs(comp, arena, &args, false);
|
|
||||||
var files = [_]Compilation.CSourceFile{
|
|
||||||
.{
|
|
||||||
.src_path = try start_asm_path(comp, arena, "crti.s"),
|
|
||||||
.extra_flags = args.items,
|
|
||||||
.owner = undefined,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return comp.build_crt_file("crti", .Obj, .@"musl crti.o", prog_node, &files, .{
|
|
||||||
.function_sections = true,
|
|
||||||
.data_sections = true,
|
|
||||||
.omit_frame_pointer = true,
|
|
||||||
.no_builtin = true,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
.crtn_o => {
|
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
|
||||||
try addCcArgs(comp, arena, &args, false);
|
|
||||||
var files = [_]Compilation.CSourceFile{
|
|
||||||
.{
|
|
||||||
.src_path = try start_asm_path(comp, arena, "crtn.s"),
|
|
||||||
.extra_flags = args.items,
|
|
||||||
.owner = undefined,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return comp.build_crt_file("crtn", .Obj, .@"musl crtn.o", prog_node, &files, .{
|
|
||||||
.function_sections = true,
|
|
||||||
.data_sections = true,
|
|
||||||
.omit_frame_pointer = true,
|
|
||||||
.no_builtin = true,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
.crt1_o => {
|
.crt1_o => {
|
||||||
var args = std.ArrayList([]const u8).init(arena);
|
var args = std.ArrayList([]const u8).init(arena);
|
||||||
try addCcArgs(comp, arena, &args, false);
|
try addCcArgs(comp, arena, &args, false);
|
||||||
@ -327,21 +293,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if musl has arch-specific crti/crtn sources.
|
|
||||||
/// See lib/libc/musl/crt/ARCH/crt?.s .
|
|
||||||
pub fn needsCrtiCrtn(target: std.Target) bool {
|
|
||||||
return switch (target.cpu.arch) {
|
|
||||||
.loongarch64,
|
|
||||||
.m68k,
|
|
||||||
.riscv32,
|
|
||||||
.riscv64,
|
|
||||||
.wasm32,
|
|
||||||
.wasm64,
|
|
||||||
=> false,
|
|
||||||
else => true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.LinkMode, pie: bool) ?CrtFile {
|
pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.LinkMode, pie: bool) ?CrtFile {
|
||||||
return switch (output_mode) {
|
return switch (output_mode) {
|
||||||
.Obj, .Lib => null,
|
.Obj, .Lib => null,
|
||||||
|
|||||||
@ -57,7 +57,9 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
|
/// TODO replace anyerror with explicit error set, recording user-friendly errors with
|
||||||
|
/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
|
||||||
|
pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
|
||||||
if (!build_options.have_llvm) {
|
if (!build_options.have_llvm) {
|
||||||
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
return error.ZigCompilerNotBuiltWithLLVMExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
//! Here we test our ELF linker for correctness and functionality.
|
|
||||||
//! Currently, we support linking x86_64 Linux, but in the future we
|
|
||||||
//! will progressively relax those to exercise more combinations.
|
|
||||||
|
|
||||||
pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
|
pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
|
||||||
_ = build_opts;
|
_ = build_opts;
|
||||||
const elf_step = b.step("test-elf", "Run ELF tests");
|
const elf_step = b.step("test-elf", "Run ELF tests");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user