@zigc/lib 0.15.0-dev.0 → 0.15.1

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.
Files changed (92) hide show
  1. package/README.md +1 -5
  2. package/build-web/fuzz.zig +6 -6
  3. package/build-web/time_report.zig +13 -14
  4. package/compiler/reduce/Walk.zig +9 -10
  5. package/compiler/reduce.zig +20 -19
  6. package/compiler/resinator/compile.zig +1 -1
  7. package/compiler_rt/arm.zig +1 -1
  8. package/init/build.zig +1 -1
  9. package/libc/freebsd/lib/csu/aarch64/crt.h +1 -0
  10. package/libc/freebsd/lib/csu/aarch64/crt1_c.c +33 -0
  11. package/libc/freebsd/lib/csu/aarch64/crt1_s.S +68 -0
  12. package/libc/freebsd/lib/csu/amd64/crt.h +30 -0
  13. package/libc/freebsd/lib/csu/amd64/crt1_c.c +30 -0
  14. package/libc/freebsd/lib/csu/amd64/crt1_s.S +89 -0
  15. package/libc/freebsd/lib/csu/arm/crt.h +1 -0
  16. package/libc/freebsd/lib/csu/arm/crt1_c.c +80 -0
  17. package/libc/freebsd/lib/csu/arm/crt1_s.S +77 -0
  18. package/libc/freebsd/lib/csu/common/crtbegin.c +95 -0
  19. package/libc/freebsd/lib/csu/common/crtbrand.S +55 -0
  20. package/libc/freebsd/lib/csu/common/crtend.c +65 -0
  21. package/libc/freebsd/lib/csu/common/csu_common.h +50 -0
  22. package/libc/freebsd/lib/csu/common/feature_note.S +47 -0
  23. package/libc/freebsd/lib/csu/common/ignore_init_note.S +48 -0
  24. package/libc/freebsd/lib/csu/common/notes.h +32 -0
  25. package/libc/freebsd/lib/csu/i386/crt.h +30 -0
  26. package/libc/freebsd/lib/csu/i386/crt1_c.c +30 -0
  27. package/libc/freebsd/lib/csu/i386/crt1_s.S +91 -0
  28. package/libc/freebsd/lib/csu/powerpc/crt.h +31 -0
  29. package/libc/freebsd/lib/csu/powerpc/crt1_c.c +89 -0
  30. package/libc/freebsd/lib/csu/powerpc/crtsavres.S +189 -0
  31. package/libc/freebsd/lib/csu/powerpc64/crt.h +31 -0
  32. package/libc/freebsd/lib/csu/powerpc64/crt1_c.c +83 -0
  33. package/libc/freebsd/lib/csu/riscv/crt.h +8 -0
  34. package/libc/freebsd/lib/csu/riscv/crt1_c.c +51 -0
  35. package/libc/freebsd/lib/csu/riscv/crt1_s.S +51 -0
  36. package/libc/freebsd/lib/libc/include/libc_private.h +450 -0
  37. package/libc/include/generic-glibc/arpa/inet.h +0 -3
  38. package/libc/netbsd/lib/csu/arch/aarch64/crt0.S +45 -0
  39. package/libc/netbsd/lib/csu/arch/earm/crt0.S +61 -0
  40. package/libc/netbsd/lib/csu/arch/i386/crt0.S +48 -0
  41. package/libc/netbsd/lib/csu/arch/m68k/crt0.S +47 -0
  42. package/libc/netbsd/lib/csu/arch/mips/crt0.S +59 -0
  43. package/libc/netbsd/lib/csu/arch/powerpc/crt0.S +56 -0
  44. package/libc/netbsd/lib/csu/arch/sparc/crt0.S +55 -0
  45. package/libc/netbsd/lib/csu/arch/sparc64/crt0.S +59 -0
  46. package/libc/netbsd/lib/csu/arch/x86_64/crt0.S +48 -0
  47. package/libc/netbsd/lib/csu/common/crt0-common.c +351 -0
  48. package/libc/netbsd/lib/csu/common/crtbegin.c +135 -0
  49. package/libc/netbsd/lib/csu/common/csu-common.h +38 -0
  50. package/libc/netbsd/lib/csu/common/sysident.S +89 -0
  51. package/libc/netbsd/lib/csu/common/sysident_assym.h +17 -0
  52. package/package.json +2 -2
  53. package/std/Build/Step/Compile.zig +1 -20
  54. package/std/Build/Step/TranslateC.zig +0 -6
  55. package/std/Build/WebServer.zig +1 -1
  56. package/std/Build.zig +1 -4
  57. package/std/Io/Reader/Limited.zig +0 -44
  58. package/std/Io/Reader.zig +28 -128
  59. package/std/Io/Writer.zig +6 -31
  60. package/std/Target.zig +0 -8
  61. package/std/Thread.zig +4 -3
  62. package/std/c.zig +26 -87
  63. package/std/crypto/aes_ocb.zig +3 -32
  64. package/std/crypto/tls/Client.zig +8 -19
  65. package/std/debug.zig +1 -1
  66. package/std/fs/Dir.zig +1 -2
  67. package/std/fs/File.zig +104 -105
  68. package/std/http/Client.zig +2 -3
  69. package/std/json/static.zig +3 -3
  70. package/std/math/big/int.zig +4 -3
  71. package/std/math/powi.zig +0 -1
  72. package/std/mem/Allocator.zig +1 -3
  73. package/std/mem.zig +1 -3
  74. package/std/net.zig +2 -3
  75. package/std/os/linux/bpf.zig +2 -2
  76. package/std/os/linux/powerpc.zig +12 -74
  77. package/std/os/linux/powerpc64.zig +12 -74
  78. package/std/os/linux.zig +2 -7
  79. package/std/os/uefi/protocol/service_binding.zig +1 -1
  80. package/std/os/uefi/tables.zig +1 -1
  81. package/std/pie.zig +1 -1
  82. package/std/posix.zig +4 -6
  83. package/std/process/Child.zig +1 -5
  84. package/std/process.zig +2 -16
  85. package/std/sort/pdq.zig +1 -48
  86. package/std/testing.zig +0 -60
  87. package/std/zig/llvm/BitcodeReader.zig +1 -5
  88. package/std/zig/system/linux.zig +4 -1
  89. package/std/zig/system.zig +2 -3
  90. package/std/zon/parse.zig +0 -1
  91. package/ubsan_rt.zig +3 -3
  92. package/libc/musl/src/fenv/loongarch64/fenv-sf.c +0 -3
@@ -0,0 +1,89 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * SPDX-License-Identifier: BSD-4-Clause
4
+ *
5
+ * Copyright 2001 David E. O'Brien.
6
+ * All rights reserved.
7
+ * Copyright 1996-1998 John D. Polstra.
8
+ * All rights reserved.
9
+ * Copyright (c) 1997 Jason R. Thorpe.
10
+ * Copyright (c) 1995 Christopher G. Demetriou
11
+ * All rights reserved.
12
+ *
13
+ * Redistribution and use in source and binary forms, with or without
14
+ * modification, are permitted provided that the following conditions
15
+ * are met:
16
+ * 1. Redistributions of source code must retain the above copyright
17
+ * notice, this list of conditions and the following disclaimer.
18
+ * 2. Redistributions in binary form must reproduce the above copyright
19
+ * notice, this list of conditions and the following disclaimer in the
20
+ * documentation and/or other materials provided with the distribution.
21
+ * 3. All advertising materials mentioning features or use of this software
22
+ * must display the following acknowledgement:
23
+ * This product includes software developed for the
24
+ * FreeBSD Project. See https://www.freebsd.org/ for
25
+ * information about FreeBSD.
26
+ * This product includes software developed for the
27
+ * NetBSD Project. See http://www.netbsd.org/ for
28
+ * information about NetBSD.
29
+ * 4. The name of the author may not be used to endorse or promote products
30
+ * derived from this software without specific prior written permission
31
+ *
32
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
33
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
+ */
43
+
44
+ #include <sys/cdefs.h>
45
+ #include <stdlib.h>
46
+
47
+ #include "libc_private.h"
48
+ #include "csu_common.h"
49
+
50
+ struct Struct_Obj_Entry;
51
+ struct ps_strings;
52
+
53
+ struct ps_strings *__ps_strings;
54
+
55
+ void _start(int, char **, char **, const struct Struct_Obj_Entry *,
56
+ void (*)(void), struct ps_strings *) __dead2;
57
+
58
+ /* The entry function. */
59
+ /*
60
+ * First 5 arguments are specified by the PowerPC SVR4 ABI.
61
+ * The last argument, ps_strings, is a BSD extension.
62
+ */
63
+ /* ARGSUSED */
64
+ void
65
+ _start(int argc, char **argv, char **env,
66
+ const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void),
67
+ struct ps_strings *ps_strings)
68
+ {
69
+ if (ps_strings != (struct ps_strings *)0)
70
+ __ps_strings = ps_strings;
71
+
72
+ #ifdef GCRT
73
+ __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
74
+ #else
75
+ __libc_start1(argc, argv, env, cleanup, main);
76
+ #endif
77
+ }
78
+
79
+ #ifdef GCRT
80
+ __asm__(".text");
81
+ __asm__("eprol:");
82
+ __asm__(".previous");
83
+ #endif
84
+
85
+ #ifndef PIC
86
+ __asm__(".text\n"
87
+ "\t.global _GLOBAL_OFFSET_TABLE_\n"
88
+ "\t.reloc 0, R_PPC_NONE, _GLOBAL_OFFSET_TABLE_");
89
+ #endif
@@ -0,0 +1,189 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2019 Justin Hibbits
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ *
12
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+ */
23
+
24
+ #include <machine/asm.h>
25
+ .text
26
+
27
+ /*
28
+ * The PowerPC ABI spec requires the following save/restore functions to be
29
+ * provided:
30
+ *
31
+ * _savefpr_N
32
+ * _restfpr_N
33
+ * _restfpr_N_x
34
+ * _savegpr_N
35
+ * _restgpr_N
36
+ * _restgpr_N_x
37
+ *
38
+ * With N ranging from 14 to 31, to save the nonvolatile registers.
39
+ */
40
+
41
+ #define _CRTENTRY(name) \
42
+ .text; \
43
+ .globl name; \
44
+ .type name,@function; \
45
+ name:
46
+
47
+ #define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \
48
+ stfd r,(-256 + r * 8)(11)
49
+
50
+ SAVEFPR(14)
51
+ SAVEFPR(15)
52
+ SAVEFPR(16)
53
+ SAVEFPR(17)
54
+ SAVEFPR(18)
55
+ SAVEFPR(19)
56
+ SAVEFPR(20)
57
+ SAVEFPR(21)
58
+ SAVEFPR(22)
59
+ SAVEFPR(23)
60
+ SAVEFPR(24)
61
+ SAVEFPR(25)
62
+ SAVEFPR(26)
63
+ SAVEFPR(27)
64
+ SAVEFPR(28)
65
+ SAVEFPR(29)
66
+ SAVEFPR(30)
67
+ SAVEFPR(31)
68
+ blr
69
+
70
+ #define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \
71
+ lfd r,(-256 + r * 8)(11)
72
+
73
+ RESTFPR(14)
74
+ RESTFPR(15)
75
+ RESTFPR(16)
76
+ RESTFPR(17)
77
+ RESTFPR(18)
78
+ RESTFPR(19)
79
+ RESTFPR(20)
80
+ RESTFPR(21)
81
+ RESTFPR(22)
82
+ RESTFPR(23)
83
+ RESTFPR(24)
84
+ RESTFPR(25)
85
+ RESTFPR(26)
86
+ RESTFPR(27)
87
+ RESTFPR(28)
88
+ RESTFPR(29)
89
+ RESTFPR(30)
90
+ RESTFPR(31)
91
+ blr
92
+
93
+ #define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \
94
+ stw r,(-128 + r * 4)(11)
95
+
96
+ SAVEGPR(14)
97
+ SAVEGPR(15)
98
+ SAVEGPR(16)
99
+ SAVEGPR(17)
100
+ SAVEGPR(18)
101
+ SAVEGPR(19)
102
+ SAVEGPR(20)
103
+ SAVEGPR(21)
104
+ SAVEGPR(22)
105
+ SAVEGPR(23)
106
+ SAVEGPR(24)
107
+ SAVEGPR(25)
108
+ SAVEGPR(26)
109
+ SAVEGPR(27)
110
+ SAVEGPR(28)
111
+ SAVEGPR(29)
112
+ SAVEGPR(30)
113
+ SAVEGPR(31)
114
+ blr
115
+
116
+ #define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \
117
+ lwz r,(-128 + r*4)(11)
118
+
119
+ RESTGPR(14)
120
+ RESTGPR(15)
121
+ RESTGPR(16)
122
+ RESTGPR(17)
123
+ RESTGPR(18)
124
+ RESTGPR(19)
125
+ RESTGPR(20)
126
+ RESTGPR(21)
127
+ RESTGPR(22)
128
+ RESTGPR(23)
129
+ RESTGPR(24)
130
+ RESTGPR(25)
131
+ RESTGPR(26)
132
+ RESTGPR(27)
133
+ RESTGPR(28)
134
+ RESTGPR(29)
135
+ RESTGPR(30)
136
+ RESTGPR(31)
137
+ blr
138
+
139
+ #define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \
140
+ lfd r,(-256 + r * 8)(11)
141
+
142
+ RESTFPR_X(14)
143
+ RESTFPR_X(15)
144
+ RESTFPR_X(16)
145
+ RESTFPR_X(17)
146
+ RESTFPR_X(18)
147
+ RESTFPR_X(19)
148
+ RESTFPR_X(20)
149
+ RESTFPR_X(21)
150
+ RESTFPR_X(22)
151
+ RESTFPR_X(23)
152
+ RESTFPR_X(24)
153
+ RESTFPR_X(25)
154
+ RESTFPR_X(26)
155
+ RESTFPR_X(27)
156
+ RESTFPR_X(28)
157
+ RESTFPR_X(29)
158
+ RESTFPR_X(30)
159
+ RESTFPR_X(31)
160
+ lwz 0,4(11)
161
+ mtlr 0
162
+ mr 1,11
163
+ blr
164
+
165
+ #define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \
166
+ lwz r,(-128 + r * 4)(11)
167
+
168
+ RESTGPR_X(14)
169
+ RESTGPR_X(15)
170
+ RESTGPR_X(16)
171
+ RESTGPR_X(17)
172
+ RESTGPR_X(18)
173
+ RESTGPR_X(19)
174
+ RESTGPR_X(20)
175
+ RESTGPR_X(21)
176
+ RESTGPR_X(22)
177
+ RESTGPR_X(23)
178
+ RESTGPR_X(24)
179
+ RESTGPR_X(25)
180
+ RESTGPR_X(26)
181
+ RESTGPR_X(27)
182
+ RESTGPR_X(28)
183
+ RESTGPR_X(29)
184
+ RESTGPR_X(30)
185
+ RESTGPR_X(31)
186
+ lwz 0,4(11)
187
+ mtlr 0
188
+ mr 1,11
189
+ blr
@@ -0,0 +1,31 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2018 Andrew Turner
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ *
12
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+ */
23
+
24
+ #ifndef _CRT_H_
25
+ #define _CRT_H_
26
+
27
+ /* zig patch: no HAVE_CTORS */
28
+ #define CTORS_CONSTRUCTORS
29
+ #define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
30
+
31
+ #endif
@@ -0,0 +1,83 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * SPDX-License-Identifier: BSD-4-Clause
4
+ *
5
+ * Copyright 2001 David E. O'Brien.
6
+ * All rights reserved.
7
+ * Copyright 1996-1998 John D. Polstra.
8
+ * All rights reserved.
9
+ * Copyright (c) 1997 Jason R. Thorpe.
10
+ * Copyright (c) 1995 Christopher G. Demetriou
11
+ * All rights reserved.
12
+ *
13
+ * Redistribution and use in source and binary forms, with or without
14
+ * modification, are permitted provided that the following conditions
15
+ * are met:
16
+ * 1. Redistributions of source code must retain the above copyright
17
+ * notice, this list of conditions and the following disclaimer.
18
+ * 2. Redistributions in binary form must reproduce the above copyright
19
+ * notice, this list of conditions and the following disclaimer in the
20
+ * documentation and/or other materials provided with the distribution.
21
+ * 3. All advertising materials mentioning features or use of this software
22
+ * must display the following acknowledgement:
23
+ * This product includes software developed for the
24
+ * FreeBSD Project. See https://www.freebsd.org/ for
25
+ * information about FreeBSD.
26
+ * This product includes software developed for the
27
+ * NetBSD Project. See http://www.netbsd.org/ for
28
+ * information about NetBSD.
29
+ * 4. The name of the author may not be used to endorse or promote products
30
+ * derived from this software without specific prior written permission
31
+ *
32
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
33
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
+ */
43
+
44
+ #include <sys/cdefs.h>
45
+ #include <stdint.h>
46
+ #include <sys/elf.h>
47
+
48
+ #include "libc_private.h"
49
+ #include "csu_common.h"
50
+
51
+ struct Struct_Obj_Entry;
52
+ struct ps_strings;
53
+
54
+ void _start(int, char **, char **, const struct Struct_Obj_Entry *,
55
+ void (*)(void), struct ps_strings *) __dead2;
56
+
57
+ struct ps_strings *__ps_strings;
58
+
59
+ /* The entry function. */
60
+ /*
61
+ * First 5 arguments are specified by the PowerPC SVR4 ABI.
62
+ * The last argument, ps_strings, is a BSD extension.
63
+ */
64
+ void
65
+ _start(int argc, char **argv, char **env,
66
+ const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void),
67
+ struct ps_strings *ps_strings)
68
+ {
69
+ if (ps_strings != (struct ps_strings *)0)
70
+ __ps_strings = ps_strings;
71
+
72
+ #ifdef GCRT
73
+ __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
74
+ #else
75
+ __libc_start1(argc, argv, env, cleanup, main);
76
+ #endif
77
+ }
78
+
79
+ #ifdef GCRT
80
+ __asm__(".text");
81
+ __asm__("eprol:");
82
+ __asm__(".previous");
83
+ #endif
@@ -0,0 +1,8 @@
1
+
2
+ #ifndef _CRT_H_
3
+ #define _CRT_H_
4
+
5
+ /* zig patch: no HAVE_CTORS */
6
+ #define INIT_CALL_SEQ(func) "call " __STRING(func)
7
+
8
+ #endif
@@ -0,0 +1,51 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * Copyright 1996-1998 John D. Polstra.
4
+ * Copyright (c) 2015-2017 Ruslan Bukin <br@bsdpad.com>
5
+ * All rights reserved.
6
+ *
7
+ * Portions of this software were developed by SRI International and the
8
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
9
+ * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
10
+ *
11
+ * Portions of this software were developed by the University of Cambridge
12
+ * Computer Laboratory as part of the CTSRD Project, with support from the
13
+ * UK Higher Education Innovation Fund (HEIF).
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions
17
+ * are met:
18
+ * 1. Redistributions of source code must retain the above copyright
19
+ * notice, this list of conditions and the following disclaimer.
20
+ * 2. Redistributions in binary form must reproduce the above copyright
21
+ * notice, this list of conditions and the following disclaimer in the
22
+ * documentation and/or other materials provided with the distribution.
23
+ *
24
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ */
35
+
36
+ #include <sys/cdefs.h>
37
+ #include "libc_private.h"
38
+ #include "csu_common.h"
39
+
40
+ void __start(int argc, char **argv, char **env, void (*cleanup)(void)) __dead2;
41
+
42
+ void
43
+ __start(int argc, char **argv, char **env, void (*cleanup)(void))
44
+ {
45
+ #ifdef GCRT
46
+ __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
47
+ __asm__("eprol:");
48
+ #else
49
+ __libc_start1(argc, argv, env, cleanup, main);
50
+ #endif
51
+ }
@@ -0,0 +1,51 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * Copyright 1996-1998 John D. Polstra.
4
+ * Copyright (c) 2015-2017 Ruslan Bukin <br@bsdpad.com>
5
+ * All rights reserved.
6
+ *
7
+ * Portions of this software were developed by SRI International and the
8
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
9
+ * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
10
+ *
11
+ * Portions of this software were developed by the University of Cambridge
12
+ * Computer Laboratory as part of the CTSRD Project, with support from the
13
+ * UK Higher Education Innovation Fund (HEIF).
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions
17
+ * are met:
18
+ * 1. Redistributions of source code must retain the above copyright
19
+ * notice, this list of conditions and the following disclaimer.
20
+ * 2. Redistributions in binary form must reproduce the above copyright
21
+ * notice, this list of conditions and the following disclaimer in the
22
+ * documentation and/or other materials provided with the distribution.
23
+ *
24
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ */
35
+
36
+ #include <machine/asm.h>
37
+ ENTRY(_start)
38
+ mv a3, a2 # cleanup
39
+ addi a1, a0, 8 # get argv
40
+ ld a0, 0(a0) # load argc
41
+ slli t0, a0, 3 # mult by arg size
42
+ add a2, a1, t0 # env is after argv
43
+ addi a2, a2, 8 # argv is null terminated
44
+ .option push
45
+ .option norelax
46
+ lla gp, __global_pointer$
47
+ .option pop
48
+ call __start
49
+ END(_start)
50
+
51
+ .section .note.GNU-stack,"",%progbits