@zigc/lib 0.16.0-dev.3013 → 0.16.0-test.0

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 @@
1
+ /* Empty so we can include this unconditionally */
@@ -0,0 +1,33 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * Copyright 1996-1998 John D. Polstra.
4
+ * Copyright 2014 Andrew Turner.
5
+ * Copyright 2014-2015 The FreeBSD Foundation.
6
+ * All rights reserved.
7
+ *
8
+ * Portions of this software were developed by Andrew Turner
9
+ * under sponsorship from the FreeBSD Foundation.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without
12
+ * modification, are permitted provided that the following conditions
13
+ * are met:
14
+ * 1. Redistributions of source code must retain the above copyright
15
+ * notice, this list of conditions and the following disclaimer.
16
+ * 2. Redistributions in binary form must reproduce the above copyright
17
+ * notice, this list of conditions and the following disclaimer in the
18
+ * documentation and/or other materials provided with the distribution.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ #include <sys/cdefs.h>
33
+ #include "csu_common.h"
@@ -0,0 +1,68 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * Copyright 1996-1998 John D. Polstra.
4
+ * Copyright 2014 Andrew Turner.
5
+ * Copyright 2014-2015 The FreeBSD Foundation.
6
+ * All rights reserved.
7
+ *
8
+ * Portions of this software were developed by Andrew Turner
9
+ * under sponsorship from the FreeBSD Foundation.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without
12
+ * modification, are permitted provided that the following conditions
13
+ * are met:
14
+ * 1. Redistributions of source code must retain the above copyright
15
+ * notice, this list of conditions and the following disclaimer.
16
+ * 2. Redistributions in binary form must reproduce the above copyright
17
+ * notice, this list of conditions and the following disclaimer in the
18
+ * documentation and/or other materials provided with the distribution.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ #include <machine/asm.h>
33
+ #include <sys/elf_common.h>
34
+
35
+ /*
36
+ * The program entry point
37
+ * void _start(char **ap, void (*cleanup)(void)) __dead2
38
+ */
39
+ ENTRY(_start)
40
+ .cfi_undefined x30
41
+ mov x3, x2 /* cleanup */
42
+ add x1, x0, #8 /* load argv */
43
+ ldr x0, [x0] /* load argc */
44
+ add x2, x1, x0, lsl #3 /* env is after argv */
45
+ add x2, x2, #8 /* argv is null terminated */
46
+ #ifdef PIC
47
+ adrp x4, :got:main
48
+ ldr x4, [x4, :got_lo12:main]
49
+ #else
50
+ ldr x4, =main
51
+ #endif
52
+ #ifdef GCRT
53
+ ldr x5, =eprol
54
+ ldr x6, =etext
55
+ /*
56
+ * __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext)
57
+ */
58
+ bl __libc_start1_gcrt
59
+ eprol:
60
+ #else
61
+ /* __libc_start1(argc, argv, env, cleanup, main) */
62
+ bl __libc_start1
63
+ #endif
64
+ END(_start)
65
+
66
+ .section .note.GNU-stack,"",@progbits
67
+
68
+ GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
@@ -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
+ * SPDX-License-Identifier: BSD-2-Clause
4
+ *
5
+ * Copyright 1996-1998 John D. Polstra.
6
+ * All rights reserved.
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 AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+
29
+ #include <sys/cdefs.h>
30
+ #include "csu_common.h"
@@ -0,0 +1,86 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-2-Clause
3
+ *
4
+ * Copyright (C) 2023 Dmitry Chagin <dchagin@FreeBSD.org>
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 AND CONTRIBUTORS ``AS IS'' AND
16
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
+ * SUCH DAMAGE.
26
+ */
27
+
28
+ #include <machine/asm.h>
29
+
30
+
31
+ .text
32
+ .align 8
33
+
34
+ /*
35
+ * The program entry point
36
+ * %rdi %rsi
37
+ * void _start(char **ap, void (*cleanup)(void)) __dead2
38
+ */
39
+ .globl _start
40
+ .type _start, @function
41
+ _start:
42
+ .cfi_startproc
43
+ .cfi_undefined %rip /* Terminate call chain. */
44
+ pushq %rbp /* Align stack, terminate call chain. */
45
+ .cfi_def_cfa_offset 8
46
+ movq %rsp, %rbp
47
+ .cfi_offset %rbp, -16
48
+ .cfi_def_cfa_register %rbp
49
+ #ifdef GCRT
50
+ subq $16, %rsp
51
+ #endif
52
+ movq %rsi, %rcx /* cleanup */
53
+ movslq (%rdi), %rax /* long *ap; tmpargc = *ap */
54
+ leaq 0x8(%rdi), %rsi /* argv = ap + 1 */
55
+ leaq 0x10(%rdi, %rax, 8), %rdx /* env = ap + 2 + tmpargc */
56
+ movl %eax, %edi /* argc = tmpargc */
57
+
58
+ #ifdef PIC
59
+ /*
60
+ * XXX. %rip relative addressing is not intended for use in the
61
+ * large memory model due to the offset from %rip being limited
62
+ * to 32 bits.
63
+ */
64
+ leaq main@plt(%rip), %r8
65
+ #else
66
+ movabsq $main, %r8
67
+ #endif
68
+ #ifdef GCRT
69
+ movabsq $eprol, %r9
70
+ movabsq $etext, %rax
71
+ movq %rax, (%rsp)
72
+ /*
73
+ * %edi %rsi %rdx %rcx %r8 %r9 (%rsp)
74
+ * __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext)
75
+ */
76
+ callq __libc_start1_gcrt
77
+ eprol:
78
+ #else
79
+ /* __libc_start1(argc, argv, env, cleanup, main) */
80
+ callq __libc_start1
81
+ #endif
82
+ int3
83
+ .cfi_endproc
84
+ .size _start, . - _start
85
+
86
+ .section .note.GNU-stack,"",%progbits
@@ -0,0 +1 @@
1
+ /* Empty so we can include this unconditionally */
@@ -0,0 +1,79 @@
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/param.h>
45
+ #include <sys/elf_common.h>
46
+
47
+ #include "libc_private.h"
48
+ #include "csu_common.h"
49
+
50
+ struct Struct_Obj_Entry;
51
+ struct ps_strings;
52
+
53
+ void _start(int, char **, char **, const struct Struct_Obj_Entry *,
54
+ void (*)(void), struct ps_strings *) __dead2;
55
+
56
+ struct ps_strings *__ps_strings;
57
+
58
+ void __start(int, char **, char **, struct ps_strings *,
59
+ const struct Struct_Obj_Entry *, void (*)(void)) __dead2;
60
+
61
+ void
62
+ __start(int argc, char **argv, char **env, struct ps_strings *ps_strings,
63
+ const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void))
64
+ {
65
+ if (ps_strings != (struct ps_strings *)0)
66
+ __ps_strings = ps_strings;
67
+
68
+ #ifdef GCRT
69
+ __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
70
+ #else
71
+ __libc_start1(argc, argv, env, cleanup, main);
72
+ #endif
73
+ }
74
+
75
+ #ifdef GCRT
76
+ __asm__(".text");
77
+ __asm__("eprol:");
78
+ __asm__(".previous");
79
+ #endif
@@ -0,0 +1,77 @@
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 <machine/asm.h>
45
+ #include <sys/param.h>
46
+ #include <sys/elf_common.h>
47
+ #include "notes.h"
48
+
49
+ ENTRY(_start)
50
+ mov r5, r2 /* cleanup */
51
+ mov r4, r1 /* obj_main */
52
+ mov r3, r0 /* ps_strings */
53
+ /* Get argc, argv, and envp from stack */
54
+ ldr r0, [sp, #0x0000]
55
+ add r1, sp, #0x0004
56
+ add r2, r1, r0, lsl #2
57
+ add r2, r2, #0x0004
58
+ /* Ensure the stack is properly aligned before calling C code. */
59
+ bic sp, sp, #7
60
+ sub sp, sp, #8
61
+ str r5, [sp, #4]
62
+ str r4, [sp, #0]
63
+
64
+ b __start
65
+ END(_start)
66
+
67
+ .section .note.tag,"a",%note
68
+ .p2align 2
69
+ .4byte 2f-1f
70
+ .4byte 4f-3f
71
+ .4byte NT_FREEBSD_ARCH_TAG
72
+ 1: .asciz NOTE_FREEBSD_VENDOR
73
+ 2: .p2align 2
74
+ 3: .asciz MACHINE_ARCH
75
+ 4:
76
+
77
+ .section .note.GNU-stack,"",%progbits
@@ -0,0 +1,54 @@
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
+ #include <sys/param.h>
25
+
26
+ #include "crt.h"
27
+
28
+ typedef void (*crt_func)(void);
29
+
30
+ extern void *__dso_handle __hidden;
31
+
32
+ #ifndef SHARED
33
+ void *__dso_handle = 0;
34
+ #else
35
+ void *__dso_handle = &__dso_handle;
36
+ void __cxa_finalize(void *) __weak_symbol;
37
+
38
+ /*
39
+ * Call __cxa_finalize with the dso handle in shared objects.
40
+ * When we have ctors/dtors call from the dtor handler before calling
41
+ * any dtors, otherwise use a destructor.
42
+ */
43
+ /* zig patch: no HAVE_CTORS */
44
+ __attribute__((destructor))
45
+ static void
46
+ run_cxa_finalize(void)
47
+ {
48
+
49
+ if (__cxa_finalize != NULL)
50
+ __cxa_finalize(__dso_handle);
51
+ }
52
+ #endif
53
+
54
+ /* zig patch: no HAVE_CTORS */
@@ -0,0 +1,55 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-2-Clause
3
+ *
4
+ * Copyright 2000 David E. O'Brien, John D. Polstra.
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
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #include <machine/asm.h>
29
+ #include <sys/param.h>
30
+ #include <sys/elf_common.h>
31
+ #include "notes.h"
32
+
33
+ /*
34
+ * Special ".note.tag" entry specifying the ABI version. See
35
+ * http://www.netbsd.org/Documentation/kernel/elf-notes.html
36
+ * for more information.
37
+ */
38
+
39
+ .section .note.tag,"aGR",%note,.freebsd.noteG,comdat
40
+ .p2align 2
41
+ .4byte 2f-1f
42
+ .4byte 4f-3f
43
+ .4byte NT_FREEBSD_ABI_TAG
44
+ 1: .asciz NOTE_FREEBSD_VENDOR
45
+ 2: .p2align 2
46
+ /* zig patch: use __FreeBSD_version which is defined by the compiler */
47
+ 3: .4byte __FreeBSD_version
48
+ 4:
49
+
50
+ .section .note.GNU-stack,"",%progbits
51
+
52
+ #ifdef __aarch64__
53
+ /* This is needed in all objects for BTI to be used in the linked elf file */
54
+ GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
55
+ #endif
@@ -0,0 +1,50 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-2-Clause
3
+ *
4
+ * Copyright 1996-1998 John D. Polstra.
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
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #ifdef _CSU_COMMON_H_
29
+
30
+ /*
31
+ * This file includes both definitions and declarations, it can be
32
+ * included only into one compilation unit for csu objects. We cannot
33
+ * practically check this, but at least guard against
34
+ * double-inclusion.
35
+ */
36
+ #error "Include this file only once"
37
+ #else
38
+ #define _CSU_COMMON_H_
39
+
40
+ char **environ;
41
+ const char *__progname = "";
42
+
43
+ #ifdef GCRT
44
+ extern int eprol;
45
+ extern int etext;
46
+ #endif
47
+
48
+ int main(int, char **, char **);
49
+
50
+ #endif /* _CSU_COMMON_H_ */
@@ -0,0 +1,47 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-2-Clause
3
+ *
4
+ * Copyright 2000 David E. O'Brien, John D. Polstra.
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
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #include <machine/asm.h>
29
+ #include <sys/elf_common.h>
30
+ #include "notes.h"
31
+
32
+ .section .note.tag,"aR",%note
33
+ .p2align 2
34
+ .4byte 2f-1f
35
+ .4byte 4f-3f
36
+ .4byte NT_FREEBSD_FEATURE_CTL
37
+ 1: .asciz NOTE_FREEBSD_VENDOR
38
+ 2: .p2align 2
39
+ 3: .4byte 0
40
+ 4:
41
+
42
+ .section .note.GNU-stack,"",%progbits
43
+
44
+ #ifdef __aarch64__
45
+ /* This is needed in all objects for BTI to be used in the linked elf file */
46
+ GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
47
+ #endif
@@ -0,0 +1,48 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
5
+ * Copyright (c) 2018 The FreeBSD Foundation
6
+ *
7
+ * Parts of this software was developed by Konstantin Belousov
8
+ * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ * notice, this list of conditions and the following disclaimer.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #include <machine/asm.h>
29
+ #include <sys/elf_common.h>
30
+
31
+ #include "notes.h"
32
+
33
+ .section .note.tag,"aR",%note
34
+ .p2align 2
35
+ .4byte 2f-1f
36
+ .4byte 4f-3f
37
+ .4byte NT_FREEBSD_NOINIT_TAG
38
+ 1: .asciz NOTE_FREEBSD_VENDOR
39
+ 2: .p2align 2
40
+ 3: .4byte 0
41
+ 4:
42
+
43
+ .section .note.GNU-stack,"",%progbits
44
+
45
+ #ifdef __aarch64__
46
+ /* This is needed in all objects for BTI to be used in the linked elf file */
47
+ GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
48
+ #endif