@zigc/lib 0.16.0-dev.3013 → 0.16.0-dev.3041
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/compiler/build_runner.zig +10 -5
- package/libc/darwin/SDKSettings.json +1 -1
- package/libc/darwin/libSystem.tbd +357 -427
- package/libc/freebsd/lib/csu/aarch64/crt.h +1 -0
- package/libc/freebsd/lib/csu/aarch64/crt1_c.c +33 -0
- package/libc/freebsd/lib/csu/aarch64/crt1_s.S +68 -0
- package/libc/freebsd/lib/csu/amd64/crt.h +30 -0
- package/libc/freebsd/lib/csu/amd64/crt1_c.c +30 -0
- package/libc/freebsd/lib/csu/amd64/crt1_s.S +86 -0
- package/libc/freebsd/lib/csu/arm/crt.h +1 -0
- package/libc/freebsd/lib/csu/arm/crt1_c.c +79 -0
- package/libc/freebsd/lib/csu/arm/crt1_s.S +77 -0
- package/libc/freebsd/lib/csu/common/crtbegin.c +54 -0
- package/libc/freebsd/lib/csu/common/crtbrand.S +55 -0
- package/libc/freebsd/lib/csu/common/csu_common.h +50 -0
- package/libc/freebsd/lib/csu/common/feature_note.S +47 -0
- package/libc/freebsd/lib/csu/common/ignore_init_note.S +48 -0
- package/libc/freebsd/lib/csu/common/notes.h +32 -0
- package/libc/freebsd/lib/csu/i386/crt.h +30 -0
- package/libc/freebsd/lib/csu/i386/crt1_c.c +30 -0
- package/libc/freebsd/lib/csu/i386/crt1_s.S +91 -0
- package/libc/freebsd/lib/csu/powerpc/crt.h +30 -0
- package/libc/freebsd/lib/csu/powerpc/crt1_c.c +89 -0
- package/libc/freebsd/lib/csu/powerpc/crtsavres.S +189 -0
- package/libc/freebsd/lib/csu/powerpc64/crt.h +30 -0
- package/libc/freebsd/lib/csu/powerpc64/crt1_c.c +83 -0
- package/libc/freebsd/lib/csu/riscv/crt.h +8 -0
- package/libc/freebsd/lib/csu/riscv/crt1_c.c +51 -0
- package/libc/freebsd/lib/csu/riscv/crt1_s.S +51 -0
- package/libc/freebsd/lib/libc/include/libc_private.h +386 -0
- package/libc/include/any-darwin-any/AssertMacros.h +1 -1
- package/libc/include/any-darwin-any/AvailabilityInternal.h +10 -10
- package/libc/include/any-darwin-any/AvailabilityInternalLegacy.h +1 -1
- package/libc/include/any-darwin-any/AvailabilityVersions.h +16 -0
- package/libc/include/any-darwin-any/TargetConditionals.h +5 -21
- package/libc/include/any-darwin-any/_regex.h +11 -3
- package/libc/include/any-darwin-any/copyfile.h +1 -0
- package/libc/include/any-darwin-any/dirent.h +32 -2
- package/libc/include/any-darwin-any/dispatch/base.h +8 -0
- package/libc/include/any-darwin-any/dispatch/dispatch_swift_shims.h +4 -2
- package/libc/include/any-darwin-any/dispatch/once.h +2 -1
- package/libc/include/any-darwin-any/dispatch/workloop.h +2 -0
- package/libc/include/any-darwin-any/glob.h +7 -5
- package/libc/include/any-darwin-any/mach/arm/_structs.h +1 -0
- package/libc/include/any-darwin-any/mach/arm/exception.h +1 -0
- package/libc/include/any-darwin-any/mach/arm/thread_status.h +1 -1
- package/libc/include/any-darwin-any/mach/kern_return.h +4 -0
- package/libc/include/any-darwin-any/mach/mach_host.h +52 -2
- package/libc/include/any-darwin-any/mach/mach_traps.h +5 -1
- package/libc/include/any-darwin-any/mach/mach_types.h +4 -0
- package/libc/include/any-darwin-any/mach/mach_voucher_types.h +9 -0
- package/libc/include/any-darwin-any/mach/machine.h +1 -0
- package/libc/include/any-darwin-any/mach/message.h +21 -0
- package/libc/include/any-darwin-any/mach/port.h +48 -11
- package/libc/include/any-darwin-any/mach/thread_act.h +79 -2
- package/libc/include/any-darwin-any/mach/vm_map.h +54 -2
- package/libc/include/any-darwin-any/mach/vm_prot.h +0 -1
- package/libc/include/any-darwin-any/mach/vm_region.h +8 -0
- package/libc/include/any-darwin-any/mach/vm_statistics.h +39 -12
- package/libc/include/any-darwin-any/mach/vm_types.h +6 -0
- package/libc/include/any-darwin-any/mach-o/loader.h +3 -3
- package/libc/include/any-darwin-any/mach_debug/ipc_info.h +1 -0
- package/libc/include/any-darwin-any/malloc/malloc.h +0 -2
- package/libc/include/any-darwin-any/net/if_var.h +2 -2
- package/libc/include/any-darwin-any/signal.h +5 -2
- package/libc/include/any-darwin-any/simd/math.h +2 -2
- package/libc/include/any-darwin-any/sys/_symbol_aliasing.h +24 -0
- package/libc/include/any-darwin-any/sys/attr.h +5 -1
- package/libc/include/any-darwin-any/sys/fcntl.h +2 -0
- package/libc/include/any-darwin-any/sys/mman.h +3 -4
- package/libc/include/any-darwin-any/sys/paths.h +12 -9
- package/libc/include/any-darwin-any/sys/proc.h +2 -2
- package/libc/include/any-darwin-any/sys/sysctl.h +24 -20
- package/libc/include/any-darwin-any/unistd.h +2 -2
- package/libc/include/any-darwin-any/xpc/activity.h +7 -7
- package/libc/include/any-darwin-any/xpc/connection.h +15 -15
- package/libc/include/any-darwin-any/xpc/listener.h +2 -2
- package/libc/include/any-darwin-any/xpc/peer_requirement.h +13 -13
- package/libc/include/any-darwin-any/xpc/session.h +6 -6
- package/libc/include/any-darwin-any/xpc/xpc.h +14 -14
- package/libc/netbsd/lib/csu/arch/aarch64/crt0.S +45 -0
- package/libc/netbsd/lib/csu/arch/earm/crt0.S +61 -0
- package/libc/netbsd/lib/csu/arch/i386/crt0.S +48 -0
- package/libc/netbsd/lib/csu/arch/m68k/crt0.S +47 -0
- package/libc/netbsd/lib/csu/arch/mips/crt0.S +59 -0
- package/libc/netbsd/lib/csu/arch/powerpc/crt0.S +56 -0
- package/libc/netbsd/lib/csu/arch/sparc/crt0.S +55 -0
- package/libc/netbsd/lib/csu/arch/sparc64/crt0.S +59 -0
- package/libc/netbsd/lib/csu/arch/x86_64/crt0.S +48 -0
- package/libc/netbsd/lib/csu/common/crt0-common.c +351 -0
- package/libc/netbsd/lib/csu/common/crtbegin.c +135 -0
- package/libc/netbsd/lib/csu/common/csu-common.h +38 -0
- package/libc/netbsd/lib/csu/common/sysident.S +89 -0
- package/libc/netbsd/lib/csu/common/sysident_assym.h +17 -0
- package/libc/openbsd/lib/csu/aarch64/md_init.h +83 -0
- package/libc/openbsd/lib/csu/amd64/md_init.h +80 -0
- package/libc/openbsd/lib/csu/arm/md_init.h +112 -0
- package/libc/openbsd/lib/csu/crt0.c +76 -0
- package/libc/openbsd/lib/csu/crtbegin.c +61 -0
- package/libc/openbsd/lib/csu/extern.h +54 -0
- package/libc/openbsd/lib/csu/i386/md_init.h +83 -0
- package/libc/openbsd/lib/csu/mips64/md_init.h +127 -0
- package/libc/openbsd/lib/csu/os-note-elf.h +19 -0
- package/libc/openbsd/lib/csu/powerpc/md_init.h +80 -0
- package/libc/openbsd/lib/csu/powerpc64/md_init.h +75 -0
- package/libc/openbsd/lib/csu/riscv64/md_init.h +74 -0
- package/libc/openbsd/lib/csu/sparc64/md_init.h +85 -0
- package/package.json +2 -2
- package/std/Build/Step/Run.zig +4 -4
- package/std/Io/Dir.zig +122 -7
- package/std/Io/File.zig +6 -118
- package/std/Io/Kqueue.zig +1 -0
- package/std/Io/Threaded.zig +50 -46
- package/std/Io/Uring.zig +1 -0
- package/std/Io/net.zig +4 -0
- package/std/Io.zig +3 -3
- package/std/Target.zig +1 -1
- package/std/c.zig +2 -1
- package/std/http/Client.zig +3 -2
- package/std/tar.zig +76 -36
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This code is derived from software contributed to The NetBSD Foundation
|
|
6
|
+
* by Matt Thomas of 3am Software Foundry.
|
|
7
|
+
*
|
|
8
|
+
* Redistribution and use in source and binary forms, with or without
|
|
9
|
+
* modification, are permitted provided that the following conditions
|
|
10
|
+
* are met:
|
|
11
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
12
|
+
* notice, this list of conditions and the following disclaimer.
|
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
18
|
+
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
19
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
20
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
21
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
25
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
26
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
27
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
*/
|
|
29
|
+
#include <sys/cdefs.h>
|
|
30
|
+
__RCSID("$NetBSD: crtbegin.c,v 1.17 2018/12/28 18:17:11 christos Exp $");
|
|
31
|
+
|
|
32
|
+
/* zig patch: no crtbegin.h */
|
|
33
|
+
|
|
34
|
+
typedef void (*fptr_t)(void);
|
|
35
|
+
|
|
36
|
+
/* zig patch: remove gcj nonsense */
|
|
37
|
+
|
|
38
|
+
#if !defined(HAVE_INITFINI_ARRAY)
|
|
39
|
+
extern __dso_hidden const fptr_t __CTOR_LIST__start __asm("__CTOR_LIST__");
|
|
40
|
+
|
|
41
|
+
__dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
|
|
42
|
+
(fptr_t) -1,
|
|
43
|
+
};
|
|
44
|
+
__dso_hidden extern const fptr_t __CTOR_LIST_END__[];
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
#ifdef SHARED
|
|
48
|
+
__dso_hidden void *__dso_handle = &__dso_handle;
|
|
49
|
+
|
|
50
|
+
__weakref_visible void cxa_finalize(void *)
|
|
51
|
+
__weak_reference(__cxa_finalize);
|
|
52
|
+
#else
|
|
53
|
+
__dso_hidden void *__dso_handle;
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#if !defined(__ARM_EABI__) || defined(__ARM_DWARF_EH__)
|
|
57
|
+
__dso_hidden const long __EH_FRAME_LIST__[0] __section(".eh_frame");
|
|
58
|
+
|
|
59
|
+
__weakref_visible void register_frame_info(const void *, const void *)
|
|
60
|
+
__weak_reference(__register_frame_info);
|
|
61
|
+
__weakref_visible void deregister_frame_info(const void *)
|
|
62
|
+
__weak_reference(__deregister_frame_info);
|
|
63
|
+
|
|
64
|
+
static long dwarf_eh_object[8];
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
static void __do_global_ctors_aux(void) __used;
|
|
68
|
+
|
|
69
|
+
/* zig patch: use .init_array */
|
|
70
|
+
__attribute__((constructor))
|
|
71
|
+
static void
|
|
72
|
+
__do_global_ctors_aux(void)
|
|
73
|
+
{
|
|
74
|
+
static unsigned char __initialized;
|
|
75
|
+
|
|
76
|
+
if (__initialized)
|
|
77
|
+
return;
|
|
78
|
+
|
|
79
|
+
__initialized = 1;
|
|
80
|
+
|
|
81
|
+
#if !defined(__ARM_EABI__) || defined(__ARM_DWARF_EH__)
|
|
82
|
+
if (register_frame_info)
|
|
83
|
+
register_frame_info(__EH_FRAME_LIST__, &dwarf_eh_object);
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
/* zig patch: remove gcj nonsense */
|
|
87
|
+
|
|
88
|
+
#if !defined(HAVE_INITFINI_ARRAY)
|
|
89
|
+
for (const fptr_t *p = __CTOR_LIST_END__; p > &__CTOR_LIST__start + 1; ) {
|
|
90
|
+
(*(*--p))();
|
|
91
|
+
}
|
|
92
|
+
#endif
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#if !defined(__ARM_EABI__) || defined(SHARED) || defined(__ARM_DWARF_EH__)
|
|
96
|
+
#if !defined(HAVE_INITFINI_ARRAY)
|
|
97
|
+
extern __dso_hidden const fptr_t __DTOR_LIST__start __asm("__DTOR_LIST__");
|
|
98
|
+
|
|
99
|
+
__dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(".dtors") = {
|
|
100
|
+
(fptr_t) -1,
|
|
101
|
+
};
|
|
102
|
+
__dso_hidden extern const fptr_t __DTOR_LIST_END__[];
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
static void __do_global_dtors_aux(void) __used;
|
|
106
|
+
|
|
107
|
+
/* zig patch: use .fini_array */
|
|
108
|
+
__attribute__((destructor))
|
|
109
|
+
static void
|
|
110
|
+
__do_global_dtors_aux(void)
|
|
111
|
+
{
|
|
112
|
+
static unsigned char __finished;
|
|
113
|
+
|
|
114
|
+
if (__finished)
|
|
115
|
+
return;
|
|
116
|
+
|
|
117
|
+
__finished = 1;
|
|
118
|
+
|
|
119
|
+
#ifdef SHARED
|
|
120
|
+
if (cxa_finalize)
|
|
121
|
+
(*cxa_finalize)(__dso_handle);
|
|
122
|
+
#endif
|
|
123
|
+
|
|
124
|
+
#if !defined(HAVE_INITFINI_ARRAY)
|
|
125
|
+
for (const fptr_t *p = &__DTOR_LIST__start + 1; p < __DTOR_LIST_END__; ) {
|
|
126
|
+
(*(*p++))();
|
|
127
|
+
}
|
|
128
|
+
#endif
|
|
129
|
+
|
|
130
|
+
#if !defined(__ARM_EABI__) || defined(__ARM_DWARF_EH__)
|
|
131
|
+
if (deregister_frame_info)
|
|
132
|
+
deregister_frame_info(__EH_FRAME_LIST__);
|
|
133
|
+
#endif
|
|
134
|
+
}
|
|
135
|
+
#endif /* !__ARM_EABI__ || SHARED || __ARM_DWARF_EH__ */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 2021 The NetBSD Foundation, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
15
|
+
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
16
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
17
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
18
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
21
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
22
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
23
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
24
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* For historical reasons the following symbols are defined both in libc
|
|
29
|
+
* and csu and need to be common
|
|
30
|
+
*/
|
|
31
|
+
#if __has_attribute(__common__)
|
|
32
|
+
#define __common __attribute((__common__))
|
|
33
|
+
#else
|
|
34
|
+
#define __common
|
|
35
|
+
#endif
|
|
36
|
+
extern char *__progname __common;
|
|
37
|
+
extern char **environ __common;
|
|
38
|
+
extern struct ps_strings *__ps_strings __common;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* $NetBSD: sysident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 1997 Christopher G. Demetriou
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions
|
|
9
|
+
* are met:
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
|
15
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
16
|
+
* must display the following acknowledgement:
|
|
17
|
+
* This product includes software developed for the
|
|
18
|
+
* NetBSD Project. See http://www.NetBSD.org/ for
|
|
19
|
+
* information about NetBSD.
|
|
20
|
+
* 4. The name of the author may not be used to endorse or promote products
|
|
21
|
+
* derived from this software without specific prior written permission.
|
|
22
|
+
*
|
|
23
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
24
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
25
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
26
|
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
28
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
32
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*
|
|
34
|
+
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* Here we define the NetBSD OS Version in an ELF .note section, structured
|
|
39
|
+
* like:
|
|
40
|
+
*
|
|
41
|
+
* [NOTE HEADER]
|
|
42
|
+
* long name size
|
|
43
|
+
* long description size
|
|
44
|
+
* long note type
|
|
45
|
+
*
|
|
46
|
+
* [NOTE DATUM]
|
|
47
|
+
* string OS name
|
|
48
|
+
*
|
|
49
|
+
* OSVERSION notes also have:
|
|
50
|
+
* long OS version (__NetBSD_Version__ constant from param.h)
|
|
51
|
+
*
|
|
52
|
+
* The DATUM fields should be padded out such that their actual (not
|
|
53
|
+
* declared) sizes % 4 == 0.
|
|
54
|
+
*
|
|
55
|
+
* These are used by the kernel to determine if this binary is really a
|
|
56
|
+
* NetBSD binary, or some other OS's.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
#include "sysident_assym.h"
|
|
60
|
+
|
|
61
|
+
.section ".note.netbsd.ident", "a"
|
|
62
|
+
.p2align 2
|
|
63
|
+
|
|
64
|
+
.long ELF_NOTE_NETBSD_NAMESZ
|
|
65
|
+
.long ELF_NOTE_NETBSD_DESCSZ
|
|
66
|
+
.long ELF_NOTE_TYPE_NETBSD_TAG
|
|
67
|
+
.ascii "NetBSD\0\0" /* ELF_NOTE_NETBSD_NAME */
|
|
68
|
+
.long __NetBSD_Version__
|
|
69
|
+
|
|
70
|
+
.section ".note.netbsd.pax", "a"
|
|
71
|
+
.p2align 2
|
|
72
|
+
|
|
73
|
+
.long ELF_NOTE_PAX_NAMESZ
|
|
74
|
+
.long ELF_NOTE_PAX_DESCSZ
|
|
75
|
+
.long ELF_NOTE_TYPE_PAX_TAG
|
|
76
|
+
.ascii "PaX\0" /* ELF_NOTE_PAX_NAME */
|
|
77
|
+
.long 0
|
|
78
|
+
|
|
79
|
+
#ifdef ELF_NOTE_MARCH_DESC
|
|
80
|
+
.section ".note.netbsd.march", "a"
|
|
81
|
+
.p2align 2
|
|
82
|
+
|
|
83
|
+
.long ELF_NOTE_MARCH_NAMESZ
|
|
84
|
+
.long ELF_NOTE_MARCH_DESCSZ
|
|
85
|
+
.long ELF_NOTE_TYPE_MARCH_TAG
|
|
86
|
+
.ascii "NetBSD\0\0"
|
|
87
|
+
.asciz ELF_NOTE_MARCH_DESC
|
|
88
|
+
.p2align 2
|
|
89
|
+
#endif
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* zig patch: manually expanded from sysident_assym.cf */
|
|
2
|
+
|
|
3
|
+
#define ELF_NOTE_NETBSD_NAMESZ 7
|
|
4
|
+
#define ELF_NOTE_NETBSD_DESCSZ 4
|
|
5
|
+
#define ELF_NOTE_TYPE_NETBSD_TAG 1
|
|
6
|
+
#define ELF_NOTE_PAX_NAMESZ 4
|
|
7
|
+
#define ELF_NOTE_PAX_DESCSZ 4
|
|
8
|
+
#define ELF_NOTE_TYPE_PAX_TAG 3
|
|
9
|
+
|
|
10
|
+
/* zig patch: ELF_NOTE_MARCH_DESC and ELF_NOTE_MARCH_DESCSZ defined by the compiler */
|
|
11
|
+
#ifdef ELF_NOTE_MARCH_DESC
|
|
12
|
+
#define ELF_NOTE_MARCH_NAMESZ 7
|
|
13
|
+
#define ELF_NOTE_TYPE_MARCH_TAG 5
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#define ELF_NOTE_MCMODEL_NAMESZ 7
|
|
17
|
+
#define ELF_NOTE_TYPE_MCMODEL_TAG 6
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* $OpenBSD: md_init.h,v 1.12 2023/11/18 16:26:16 deraadt Exp $ */
|
|
2
|
+
|
|
3
|
+
/*-
|
|
4
|
+
* Copyright (c) 2001 Ross Harvey
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions
|
|
9
|
+
* are met:
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
|
15
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
16
|
+
* must display the following acknowledgement:
|
|
17
|
+
* This product includes software developed by the NetBSD
|
|
18
|
+
* Foundation, Inc. and its contributors.
|
|
19
|
+
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
20
|
+
* contributors may be used to endorse or promote products derived
|
|
21
|
+
* from this software without specific prior written permission.
|
|
22
|
+
*
|
|
23
|
+
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
24
|
+
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
25
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
26
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
27
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
28
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
29
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
30
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
31
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
32
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
#define MD_SECT_CALL_FUNC(section, func) \
|
|
37
|
+
__asm (".section "#section", \"ax\" \n" \
|
|
38
|
+
" bl " #func " \n" \
|
|
39
|
+
" .previous")
|
|
40
|
+
|
|
41
|
+
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
|
|
42
|
+
__asm ( \
|
|
43
|
+
".section "#sect",\"ax\",%progbits \n" \
|
|
44
|
+
" .globl " #entry_pt " \n" \
|
|
45
|
+
" .type " #entry_pt ",%function \n" \
|
|
46
|
+
" .align 4 \n" \
|
|
47
|
+
#entry_pt": \n" \
|
|
48
|
+
" bti c \n" \
|
|
49
|
+
" sub sp, sp, #16 \n" \
|
|
50
|
+
" str lr, [sp] \n" \
|
|
51
|
+
" /* fall thru */ \n" \
|
|
52
|
+
" .previous")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#define MD_SECTION_EPILOGUE(sect) \
|
|
56
|
+
__asm ( \
|
|
57
|
+
".section "#sect",\"ax\",%progbits \n" \
|
|
58
|
+
" ldr lr, [sp] \n" \
|
|
59
|
+
" add sp, sp, #16 \n" \
|
|
60
|
+
" ret \n" \
|
|
61
|
+
" .previous")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#define MD_CRT0_START \
|
|
65
|
+
__asm( \
|
|
66
|
+
".text \n" \
|
|
67
|
+
" .align 0 \n" \
|
|
68
|
+
" .globl _start \n" \
|
|
69
|
+
" .globl __start \n" \
|
|
70
|
+
"_start: \n" \
|
|
71
|
+
"__start: \n" \
|
|
72
|
+
" bti c \n" \
|
|
73
|
+
" mov x3, x2 /* cleanup */ \n" \
|
|
74
|
+
"/* Get argc/argv/envp from stack */ \n" \
|
|
75
|
+
" ldr x0, [sp] \n" \
|
|
76
|
+
" add x1, sp, #0x0008 \n" \
|
|
77
|
+
" add x2, x1, x0, lsl #3 \n" \
|
|
78
|
+
" add x2, x2, #0x0008 \n" \
|
|
79
|
+
" \n" \
|
|
80
|
+
" b ___start \n" \
|
|
81
|
+
".previous");
|
|
82
|
+
|
|
83
|
+
/* zig patch: no static crt support */
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* $OpenBSD: md_init.h,v 1.11 2023/11/18 16:26:16 deraadt Exp $ */
|
|
2
|
+
|
|
3
|
+
/*-
|
|
4
|
+
* Copyright (c) 2001 Ross Harvey
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions
|
|
9
|
+
* are met:
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
|
15
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
16
|
+
* must display the following acknowledgement:
|
|
17
|
+
* This product includes software developed by the NetBSD
|
|
18
|
+
* Foundation, Inc. and its contributors.
|
|
19
|
+
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
20
|
+
* contributors may be used to endorse or promote products derived
|
|
21
|
+
* from this software without specific prior written permission.
|
|
22
|
+
*
|
|
23
|
+
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
24
|
+
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
25
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
26
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
27
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
28
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
29
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
30
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
31
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
32
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
#define MD_SECT_CALL_FUNC(section, func) \
|
|
37
|
+
__asm (".section "#section", \"ax\"\n" \
|
|
38
|
+
" call " #func "\n" \
|
|
39
|
+
" .previous")
|
|
40
|
+
|
|
41
|
+
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
|
|
42
|
+
__asm ( \
|
|
43
|
+
".section "#sect",\"ax\",@progbits \n" \
|
|
44
|
+
" .globl " #entry_pt " \n" \
|
|
45
|
+
" .type " #entry_pt ",@function \n" \
|
|
46
|
+
" .align 16 \n" \
|
|
47
|
+
#entry_pt": \n" \
|
|
48
|
+
" endbr64 \n" \
|
|
49
|
+
" subq $8,%rsp \n" \
|
|
50
|
+
" .previous")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
#define MD_SECTION_EPILOGUE(sect) \
|
|
54
|
+
__asm ( \
|
|
55
|
+
".section "#sect",\"ax\",@progbits \n" \
|
|
56
|
+
" addq $8,%rsp \n" \
|
|
57
|
+
" ret \n" \
|
|
58
|
+
" .previous")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
#define MD_CRT0_START \
|
|
62
|
+
__asm( \
|
|
63
|
+
".text \n" \
|
|
64
|
+
" .align 8 \n" \
|
|
65
|
+
" .globl __start \n" \
|
|
66
|
+
" .globl _start \n" \
|
|
67
|
+
"_start: \n" \
|
|
68
|
+
"__start: \n" \
|
|
69
|
+
" endbr64 \n" \
|
|
70
|
+
" movq %rdx,%rcx \n" \
|
|
71
|
+
" movq (%rsp),%rdi \n" \
|
|
72
|
+
" leaq 16(%rsp,%rdi,8),%rdx \n" \
|
|
73
|
+
" leaq 8(%rsp),%rsi \n" \
|
|
74
|
+
" subq $8,%rsp \n" \
|
|
75
|
+
" andq $~15,%rsp \n" \
|
|
76
|
+
" addq $8,%rsp \n" \
|
|
77
|
+
" jmp ___start \n" \
|
|
78
|
+
" .previous")
|
|
79
|
+
|
|
80
|
+
/* zig patch: no static crt support */
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* $OpenBSD: md_init.h,v 1.19 2024/08/17 09:48:31 phessler Exp $ */
|
|
2
|
+
|
|
3
|
+
/*-
|
|
4
|
+
* Copyright (c) 2001 Ross Harvey
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions
|
|
9
|
+
* are met:
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
|
15
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
16
|
+
* must display the following acknowledgement:
|
|
17
|
+
* This product includes software developed by the NetBSD
|
|
18
|
+
* Foundation, Inc. and its contributors.
|
|
19
|
+
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
20
|
+
* contributors may be used to endorse or promote products derived
|
|
21
|
+
* from this software without specific prior written permission.
|
|
22
|
+
*
|
|
23
|
+
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
24
|
+
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
25
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
26
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
27
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
28
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
29
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
30
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
31
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
32
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* arm overrides these because it uses %progbits instead of @progbits
|
|
38
|
+
*/
|
|
39
|
+
#define MD_DATA_SECTION_FLAGS_SYMBOL(section, flags, type, symbol) \
|
|
40
|
+
extern __dso_hidden type symbol[]; \
|
|
41
|
+
__asm(" .section "section",\""flags"\",%progbits \n" \
|
|
42
|
+
" .balign 4 \n" \
|
|
43
|
+
#symbol": \n" \
|
|
44
|
+
" .previous")
|
|
45
|
+
#define MD_DATA_SECTION_SYMBOL_VALUE(section, type, symbol, value) \
|
|
46
|
+
extern __dso_hidden type symbol[]; \
|
|
47
|
+
__asm(" .section "section",\"aw\",%progbits \n" \
|
|
48
|
+
" .balign 4 \n" \
|
|
49
|
+
#symbol": \n" \
|
|
50
|
+
" .int "#value" \n" \
|
|
51
|
+
" .previous")
|
|
52
|
+
#define MD_DATA_SECTION_FLAGS_VALUE(section, flags, value) \
|
|
53
|
+
__asm(" .section "section",\""flags"\",%progbits \n" \
|
|
54
|
+
" .balign 4 \n" \
|
|
55
|
+
" .int "#value" \n" \
|
|
56
|
+
" .previous")
|
|
57
|
+
|
|
58
|
+
#define MD_SECT_CALL_FUNC(section, func) \
|
|
59
|
+
__asm (".section "#section", \"ax\" \n" \
|
|
60
|
+
" movw r0, #:lower16:" #func "- 1f - 8 \n" \
|
|
61
|
+
" movt r0, #:upper16:" #func "- 1f - 8 \n" \
|
|
62
|
+
"1: add r0, r0, pc \n" \
|
|
63
|
+
" blx r0 \n" \
|
|
64
|
+
" .previous")
|
|
65
|
+
|
|
66
|
+
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
|
|
67
|
+
__asm ( \
|
|
68
|
+
".section "#sect",\"ax\",%progbits \n" \
|
|
69
|
+
" .globl " #entry_pt " \n" \
|
|
70
|
+
" .type " #entry_pt ",%function \n" \
|
|
71
|
+
" .align 4 \n" \
|
|
72
|
+
#entry_pt": \n" \
|
|
73
|
+
" push {r4, lr} \n" \
|
|
74
|
+
" /* fall thru */ \n" \
|
|
75
|
+
" .previous")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
#define MD_SECTION_EPILOGUE(sect) \
|
|
79
|
+
__asm ( \
|
|
80
|
+
".section "#sect",\"ax\",%progbits \n" \
|
|
81
|
+
" pop {r4, pc} \n" \
|
|
82
|
+
" .previous")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* The definitions of environ and __progname prevent the creation
|
|
87
|
+
* of COPY relocations for WEAK symbols.
|
|
88
|
+
*/
|
|
89
|
+
#define MD_CRT0_START \
|
|
90
|
+
__asm( \
|
|
91
|
+
".text \n" \
|
|
92
|
+
" .align 0 \n" \
|
|
93
|
+
" .globl _start \n" \
|
|
94
|
+
" .globl __start \n" \
|
|
95
|
+
"_start: \n" \
|
|
96
|
+
"__start: \n" \
|
|
97
|
+
" mov r3, r0 /* cleanup */ \n" \
|
|
98
|
+
"/* Get argc/argv/envp from stack */ \n" \
|
|
99
|
+
" ldr r0, [sp, #0] \n" \
|
|
100
|
+
" add r1, sp, #4 \n" \
|
|
101
|
+
" add r2, r1, r0, lsl #2 \n" \
|
|
102
|
+
" add r2, r2, #4 \n" \
|
|
103
|
+
" \n" \
|
|
104
|
+
"/* \n" \
|
|
105
|
+
" * Ensure the stack is properly \n" \
|
|
106
|
+
" * aligned before calling C code. \n" \
|
|
107
|
+
" */ \n" \
|
|
108
|
+
" bic sp, sp, #7" /*__STRING(STACKALIGNBYTES)*/ " \n" \
|
|
109
|
+
" b ___start \n" \
|
|
110
|
+
".previous");
|
|
111
|
+
|
|
112
|
+
/* zig patch: no static crt support */
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* $OpenBSD: crt0.c,v 1.19 2025/05/24 06:32:12 deraadt Exp $ */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 1995 Christopher G. Demetriou
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions
|
|
9
|
+
* are met:
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
|
15
|
+
* 3. All advertising materials mentioning features or use of this software
|
|
16
|
+
* must display the following acknowledgement:
|
|
17
|
+
* This product includes software developed by Christopher G. Demetriou
|
|
18
|
+
* for the NetBSD Project.
|
|
19
|
+
* 4. The name of the author may not be used to endorse or promote products
|
|
20
|
+
* derived from this software without specific prior written permission
|
|
21
|
+
*
|
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
23
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
24
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
25
|
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
26
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
27
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
31
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
#include <sys/syscall.h>
|
|
35
|
+
#include <stdlib.h>
|
|
36
|
+
#include <limits.h>
|
|
37
|
+
|
|
38
|
+
#include "md_init.h"
|
|
39
|
+
/* zig patch: no static crt support */
|
|
40
|
+
#include "extern.h"
|
|
41
|
+
|
|
42
|
+
#define STR(x) __STRING(x) /* shorter macro name for MD_RCRT0_START */
|
|
43
|
+
|
|
44
|
+
/* some defaults */
|
|
45
|
+
#ifndef MD_START_ARGS
|
|
46
|
+
#define MD_START_ARGS \
|
|
47
|
+
int argc, char **argv, char **envp, void (*cleanup)(void)
|
|
48
|
+
#endif
|
|
49
|
+
static void ___start(MD_START_ARGS) __used;
|
|
50
|
+
#ifndef MD_EPROL_LABEL
|
|
51
|
+
#define MD_EPROL_LABEL __asm(" .text\n_eprol:")
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
char ***_csu_finish(char **_argv, char **_envp, void (*_cleanup)(void));
|
|
55
|
+
|
|
56
|
+
/* zig patch: no profiling support */
|
|
57
|
+
|
|
58
|
+
#ifdef MD_CRT0_START
|
|
59
|
+
MD_CRT0_START;
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
/* zig patch: no legacy leanup abi support */
|
|
63
|
+
|
|
64
|
+
static void
|
|
65
|
+
___start(MD_START_ARGS)
|
|
66
|
+
{
|
|
67
|
+
size_t size, i;
|
|
68
|
+
char ***environp;
|
|
69
|
+
#ifdef MD_START_SETUP
|
|
70
|
+
MD_START_SETUP
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
environp = _csu_finish(argv, envp, cleanup);
|
|
74
|
+
|
|
75
|
+
exit(main(argc, argv, *environp));
|
|
76
|
+
}
|