@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,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,95 @@
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/cdefs.h>
25
+ #include <sys/param.h>
26
+
27
+ #include "crt.h"
28
+
29
+ typedef void (*crt_func)(void);
30
+
31
+ extern void *__dso_handle __hidden;
32
+
33
+ #ifndef SHARED
34
+ void *__dso_handle = 0;
35
+ #else
36
+ void *__dso_handle = &__dso_handle;
37
+ void __cxa_finalize(void *) __weak_symbol;
38
+
39
+ /*
40
+ * Call __cxa_finalize with the dso handle in shared objects.
41
+ * When we have ctors/dtors call from the dtor handler before calling
42
+ * any dtors, otherwise use a destructor.
43
+ */
44
+ #ifndef HAVE_CTORS
45
+ __attribute__((destructor))
46
+ #endif
47
+ static void
48
+ run_cxa_finalize(void)
49
+ {
50
+
51
+ if (__cxa_finalize != NULL)
52
+ __cxa_finalize(__dso_handle);
53
+ }
54
+ #endif
55
+
56
+ /*
57
+ * On some architectures and toolchains we may need to call the .dtors.
58
+ * These are called in the order they are in the ELF file.
59
+ */
60
+ #ifdef HAVE_CTORS
61
+ static void __do_global_dtors_aux(void) __used;
62
+
63
+ static crt_func __CTOR_LIST__[] __section(".ctors") __used = {
64
+ (crt_func)-1
65
+ };
66
+ static crt_func __DTOR_LIST__[] __section(".dtors") __used = {
67
+ (crt_func)-1
68
+ };
69
+
70
+ static void
71
+ __do_global_dtors_aux(void)
72
+ {
73
+ crt_func fn;
74
+ int n;
75
+
76
+ #ifdef SHARED
77
+ run_cxa_finalize();
78
+ #endif
79
+
80
+ for (n = 1;; n++) {
81
+ fn = __DTOR_LIST__[n];
82
+ if (fn == (crt_func)0 || fn == (crt_func)-1)
83
+ break;
84
+ fn();
85
+ }
86
+ }
87
+
88
+ asm (
89
+ ".pushsection .fini \n"
90
+ "\t" INIT_CALL_SEQ(__do_global_dtors_aux) "\n"
91
+ ".popsection \n"
92
+ );
93
+ #endif
94
+
95
+ /* zig patch: remove gcj nonsense */
@@ -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,"aG",%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,65 @@
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/cdefs.h>
25
+ #include "crt.h"
26
+
27
+ typedef void (*crt_func)(void);
28
+
29
+ /* zig patch: remove gcj nonsense */
30
+
31
+ #ifdef HAVE_CTORS
32
+
33
+ /*
34
+ * On some architectures and toolchains we may need to call the .ctors.
35
+ * These are called in the reverse order they are in the ELF file.
36
+ */
37
+ static void __do_global_ctors_aux(void) __used;
38
+
39
+ static crt_func __CTOR_END__[] __section(".ctors") __used = {
40
+ (crt_func)0
41
+ };
42
+ static crt_func __DTOR_END__[] __section(".dtors") __used = {
43
+ (crt_func)0
44
+ };
45
+
46
+ static void
47
+ __do_global_ctors_aux(void)
48
+ {
49
+ crt_func fn;
50
+ int n;
51
+
52
+ for (n = 1;; n++) {
53
+ fn = __CTOR_END__[-n];
54
+ if (fn == (crt_func)0 || fn == (crt_func)-1)
55
+ break;
56
+ fn();
57
+ }
58
+ }
59
+
60
+ asm (
61
+ ".pushsection .init \n"
62
+ "\t" INIT_CALL_SEQ(__do_global_ctors_aux) "\n"
63
+ ".popsection \n"
64
+ );
65
+ #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,"a",%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,"a",%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
@@ -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,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