@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.
Files changed (121) hide show
  1. package/README.md +1 -5
  2. package/compiler/build_runner.zig +10 -5
  3. package/libc/darwin/SDKSettings.json +1 -1
  4. package/libc/darwin/libSystem.tbd +357 -427
  5. package/libc/freebsd/lib/csu/aarch64/crt.h +1 -0
  6. package/libc/freebsd/lib/csu/aarch64/crt1_c.c +33 -0
  7. package/libc/freebsd/lib/csu/aarch64/crt1_s.S +68 -0
  8. package/libc/freebsd/lib/csu/amd64/crt.h +30 -0
  9. package/libc/freebsd/lib/csu/amd64/crt1_c.c +30 -0
  10. package/libc/freebsd/lib/csu/amd64/crt1_s.S +86 -0
  11. package/libc/freebsd/lib/csu/arm/crt.h +1 -0
  12. package/libc/freebsd/lib/csu/arm/crt1_c.c +79 -0
  13. package/libc/freebsd/lib/csu/arm/crt1_s.S +77 -0
  14. package/libc/freebsd/lib/csu/common/crtbegin.c +54 -0
  15. package/libc/freebsd/lib/csu/common/crtbrand.S +55 -0
  16. package/libc/freebsd/lib/csu/common/csu_common.h +50 -0
  17. package/libc/freebsd/lib/csu/common/feature_note.S +47 -0
  18. package/libc/freebsd/lib/csu/common/ignore_init_note.S +48 -0
  19. package/libc/freebsd/lib/csu/common/notes.h +32 -0
  20. package/libc/freebsd/lib/csu/i386/crt.h +30 -0
  21. package/libc/freebsd/lib/csu/i386/crt1_c.c +30 -0
  22. package/libc/freebsd/lib/csu/i386/crt1_s.S +91 -0
  23. package/libc/freebsd/lib/csu/powerpc/crt.h +30 -0
  24. package/libc/freebsd/lib/csu/powerpc/crt1_c.c +89 -0
  25. package/libc/freebsd/lib/csu/powerpc/crtsavres.S +189 -0
  26. package/libc/freebsd/lib/csu/powerpc64/crt.h +30 -0
  27. package/libc/freebsd/lib/csu/powerpc64/crt1_c.c +83 -0
  28. package/libc/freebsd/lib/csu/riscv/crt.h +8 -0
  29. package/libc/freebsd/lib/csu/riscv/crt1_c.c +51 -0
  30. package/libc/freebsd/lib/csu/riscv/crt1_s.S +51 -0
  31. package/libc/freebsd/lib/libc/include/libc_private.h +386 -0
  32. package/libc/include/any-darwin-any/AssertMacros.h +1 -1
  33. package/libc/include/any-darwin-any/AvailabilityInternal.h +10 -10
  34. package/libc/include/any-darwin-any/AvailabilityInternalLegacy.h +1 -1
  35. package/libc/include/any-darwin-any/AvailabilityVersions.h +16 -0
  36. package/libc/include/any-darwin-any/TargetConditionals.h +5 -21
  37. package/libc/include/any-darwin-any/_regex.h +11 -3
  38. package/libc/include/any-darwin-any/copyfile.h +1 -0
  39. package/libc/include/any-darwin-any/dirent.h +32 -2
  40. package/libc/include/any-darwin-any/dispatch/base.h +8 -0
  41. package/libc/include/any-darwin-any/dispatch/dispatch_swift_shims.h +4 -2
  42. package/libc/include/any-darwin-any/dispatch/once.h +2 -1
  43. package/libc/include/any-darwin-any/dispatch/workloop.h +2 -0
  44. package/libc/include/any-darwin-any/glob.h +7 -5
  45. package/libc/include/any-darwin-any/mach/arm/_structs.h +1 -0
  46. package/libc/include/any-darwin-any/mach/arm/exception.h +1 -0
  47. package/libc/include/any-darwin-any/mach/arm/thread_status.h +1 -1
  48. package/libc/include/any-darwin-any/mach/kern_return.h +4 -0
  49. package/libc/include/any-darwin-any/mach/mach_host.h +52 -2
  50. package/libc/include/any-darwin-any/mach/mach_traps.h +5 -1
  51. package/libc/include/any-darwin-any/mach/mach_types.h +4 -0
  52. package/libc/include/any-darwin-any/mach/mach_voucher_types.h +9 -0
  53. package/libc/include/any-darwin-any/mach/machine.h +1 -0
  54. package/libc/include/any-darwin-any/mach/message.h +21 -0
  55. package/libc/include/any-darwin-any/mach/port.h +48 -11
  56. package/libc/include/any-darwin-any/mach/thread_act.h +79 -2
  57. package/libc/include/any-darwin-any/mach/vm_map.h +54 -2
  58. package/libc/include/any-darwin-any/mach/vm_prot.h +0 -1
  59. package/libc/include/any-darwin-any/mach/vm_region.h +8 -0
  60. package/libc/include/any-darwin-any/mach/vm_statistics.h +39 -12
  61. package/libc/include/any-darwin-any/mach/vm_types.h +6 -0
  62. package/libc/include/any-darwin-any/mach-o/loader.h +3 -3
  63. package/libc/include/any-darwin-any/mach_debug/ipc_info.h +1 -0
  64. package/libc/include/any-darwin-any/malloc/malloc.h +0 -2
  65. package/libc/include/any-darwin-any/net/if_var.h +2 -2
  66. package/libc/include/any-darwin-any/signal.h +5 -2
  67. package/libc/include/any-darwin-any/simd/math.h +2 -2
  68. package/libc/include/any-darwin-any/sys/_symbol_aliasing.h +24 -0
  69. package/libc/include/any-darwin-any/sys/attr.h +5 -1
  70. package/libc/include/any-darwin-any/sys/fcntl.h +2 -0
  71. package/libc/include/any-darwin-any/sys/mman.h +3 -4
  72. package/libc/include/any-darwin-any/sys/paths.h +12 -9
  73. package/libc/include/any-darwin-any/sys/proc.h +2 -2
  74. package/libc/include/any-darwin-any/sys/sysctl.h +24 -20
  75. package/libc/include/any-darwin-any/unistd.h +2 -2
  76. package/libc/include/any-darwin-any/xpc/activity.h +7 -7
  77. package/libc/include/any-darwin-any/xpc/connection.h +15 -15
  78. package/libc/include/any-darwin-any/xpc/listener.h +2 -2
  79. package/libc/include/any-darwin-any/xpc/peer_requirement.h +13 -13
  80. package/libc/include/any-darwin-any/xpc/session.h +6 -6
  81. package/libc/include/any-darwin-any/xpc/xpc.h +14 -14
  82. package/libc/netbsd/lib/csu/arch/aarch64/crt0.S +45 -0
  83. package/libc/netbsd/lib/csu/arch/earm/crt0.S +61 -0
  84. package/libc/netbsd/lib/csu/arch/i386/crt0.S +48 -0
  85. package/libc/netbsd/lib/csu/arch/m68k/crt0.S +47 -0
  86. package/libc/netbsd/lib/csu/arch/mips/crt0.S +59 -0
  87. package/libc/netbsd/lib/csu/arch/powerpc/crt0.S +56 -0
  88. package/libc/netbsd/lib/csu/arch/sparc/crt0.S +55 -0
  89. package/libc/netbsd/lib/csu/arch/sparc64/crt0.S +59 -0
  90. package/libc/netbsd/lib/csu/arch/x86_64/crt0.S +48 -0
  91. package/libc/netbsd/lib/csu/common/crt0-common.c +351 -0
  92. package/libc/netbsd/lib/csu/common/crtbegin.c +135 -0
  93. package/libc/netbsd/lib/csu/common/csu-common.h +38 -0
  94. package/libc/netbsd/lib/csu/common/sysident.S +89 -0
  95. package/libc/netbsd/lib/csu/common/sysident_assym.h +17 -0
  96. package/libc/openbsd/lib/csu/aarch64/md_init.h +83 -0
  97. package/libc/openbsd/lib/csu/amd64/md_init.h +80 -0
  98. package/libc/openbsd/lib/csu/arm/md_init.h +112 -0
  99. package/libc/openbsd/lib/csu/crt0.c +76 -0
  100. package/libc/openbsd/lib/csu/crtbegin.c +61 -0
  101. package/libc/openbsd/lib/csu/extern.h +54 -0
  102. package/libc/openbsd/lib/csu/i386/md_init.h +83 -0
  103. package/libc/openbsd/lib/csu/mips64/md_init.h +127 -0
  104. package/libc/openbsd/lib/csu/os-note-elf.h +19 -0
  105. package/libc/openbsd/lib/csu/powerpc/md_init.h +80 -0
  106. package/libc/openbsd/lib/csu/powerpc64/md_init.h +75 -0
  107. package/libc/openbsd/lib/csu/riscv64/md_init.h +74 -0
  108. package/libc/openbsd/lib/csu/sparc64/md_init.h +85 -0
  109. package/package.json +2 -2
  110. package/std/Build/Step/Run.zig +4 -4
  111. package/std/Io/Dir.zig +122 -7
  112. package/std/Io/File.zig +6 -118
  113. package/std/Io/Kqueue.zig +1 -0
  114. package/std/Io/Threaded.zig +50 -46
  115. package/std/Io/Uring.zig +1 -0
  116. package/std/Io/net.zig +4 -0
  117. package/std/Io.zig +3 -3
  118. package/std/Target.zig +1 -1
  119. package/std/c.zig +2 -1
  120. package/std/http/Client.zig +3 -2
  121. package/std/tar.zig +76 -36
@@ -0,0 +1,32 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
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
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ */
24
+
25
+ #ifndef CSU_COMMON_NOTES_H
26
+ #define CSU_COMMON_NOTES_H
27
+
28
+ #define NOTE_FREEBSD_VENDOR "FreeBSD"
29
+
30
+ #define NOTE_SECTION ".note.tag"
31
+
32
+ #endif
@@ -0,0 +1,30 @@
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 INIT_CALL_SEQ(func) "call " __STRING(func)
29
+
30
+ #endif
@@ -0,0 +1,30 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * Copyright 1996-1998 John D. Polstra.
4
+ * All rights reserved.
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
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ */
26
+
27
+ #include <sys/cdefs.h>
28
+ #include "csu_common.h"
29
+
30
+ void _start(char *, ...) __dead2;
@@ -0,0 +1,91 @@
1
+ /*-
2
+ * Copyright 2009 Konstantin Belousov.
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
+ *
11
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
12
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
13
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
+ */
22
+
23
+ #include <machine/asm.h>
24
+ .text
25
+ .align 4
26
+ .globl _start
27
+ .type _start, @function
28
+ _start:
29
+ .cfi_startproc
30
+ .cfi_undefined %eip
31
+ popl %esi # Pop argc
32
+ .cfi_def_cfa_offset -4
33
+ movl %esp,%edi # argv starts at stack top
34
+ xorl %ebp,%ebp
35
+ pushl %ebp
36
+ .cfi_def_cfa_offset 0
37
+ movl %esp,%ebp
38
+ .cfi_offset %ebp,-4
39
+ .cfi_def_cfa_register %ebp
40
+ andl $0xfffffff0,%esp # align stack
41
+
42
+ #ifdef GCRT
43
+ subl $4,%esp # Align stack for 7 arguments
44
+ pushl $etext
45
+ pushl $eprol
46
+ eprol:
47
+ #else
48
+ subl $12,%esp # Align stack for 5 arguments
49
+ #endif /* GCRT */
50
+
51
+ #ifdef PIC
52
+ calll 1f
53
+ 1: popl %ebx
54
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
55
+ leal main@GOTOFF(%ebx),%eax
56
+ pushl %eax
57
+ #else
58
+ pushl $main
59
+ #endif /* PIC */
60
+
61
+ pushl %edx # rtld cleanup
62
+ /* env = argv + argc + 1 */
63
+ movl %edi,%eax # env = argv
64
+ movl %esi,%ecx
65
+ shll $2,%ecx # argc * 4
66
+ addl %ecx,%eax # env += argc
67
+ addl $4,%eax # env += 1
68
+ pushl %eax # env
69
+ pushl %edi # argv
70
+ pushl %esi # argc
71
+
72
+ #ifdef GCRT
73
+ /*
74
+ * __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
75
+ */
76
+ calll __libc_start1_gcrt
77
+ #else
78
+ /*
79
+ * __libc_start1(argc, argv, env, cleanup, main);
80
+ */
81
+ #ifdef PIC
82
+ calll __libc_start1@PLT
83
+ #else
84
+ calll __libc_start1
85
+ #endif
86
+ #endif /* GCRT */
87
+ int3
88
+ .cfi_endproc
89
+ .size _start, . - _start
90
+
91
+ .section .note.GNU-stack,"",%progbits
@@ -0,0 +1,30 @@
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/CTORS_CONSTRUCTORS */
28
+ #define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
29
+
30
+ #endif
@@ -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,30 @@
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/CTORS_CONSTRUCTORS */
28
+ #define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
29
+
30
+ #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
+ }