@zigc/lib 0.15.2-test.1 → 0.15.2-test.99

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 (45) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +1 -5
  3. package/libc/freebsd/lib/csu/aarch64/crt.h +1 -0
  4. package/libc/freebsd/lib/csu/aarch64/crt1_c.c +33 -0
  5. package/libc/freebsd/lib/csu/aarch64/crt1_s.S +68 -0
  6. package/libc/freebsd/lib/csu/amd64/crt.h +30 -0
  7. package/libc/freebsd/lib/csu/amd64/crt1_c.c +30 -0
  8. package/libc/freebsd/lib/csu/amd64/crt1_s.S +89 -0
  9. package/libc/freebsd/lib/csu/arm/crt.h +1 -0
  10. package/libc/freebsd/lib/csu/arm/crt1_c.c +80 -0
  11. package/libc/freebsd/lib/csu/arm/crt1_s.S +77 -0
  12. package/libc/freebsd/lib/csu/common/crtbegin.c +95 -0
  13. package/libc/freebsd/lib/csu/common/crtbrand.S +55 -0
  14. package/libc/freebsd/lib/csu/common/crtend.c +65 -0
  15. package/libc/freebsd/lib/csu/common/csu_common.h +50 -0
  16. package/libc/freebsd/lib/csu/common/feature_note.S +47 -0
  17. package/libc/freebsd/lib/csu/common/ignore_init_note.S +48 -0
  18. package/libc/freebsd/lib/csu/common/notes.h +32 -0
  19. package/libc/freebsd/lib/csu/i386/crt.h +30 -0
  20. package/libc/freebsd/lib/csu/i386/crt1_c.c +30 -0
  21. package/libc/freebsd/lib/csu/i386/crt1_s.S +91 -0
  22. package/libc/freebsd/lib/csu/powerpc/crt.h +31 -0
  23. package/libc/freebsd/lib/csu/powerpc/crt1_c.c +89 -0
  24. package/libc/freebsd/lib/csu/powerpc/crtsavres.S +189 -0
  25. package/libc/freebsd/lib/csu/powerpc64/crt.h +31 -0
  26. package/libc/freebsd/lib/csu/powerpc64/crt1_c.c +83 -0
  27. package/libc/freebsd/lib/csu/riscv/crt.h +8 -0
  28. package/libc/freebsd/lib/csu/riscv/crt1_c.c +51 -0
  29. package/libc/freebsd/lib/csu/riscv/crt1_s.S +51 -0
  30. package/libc/freebsd/lib/libc/include/libc_private.h +450 -0
  31. package/libc/netbsd/lib/csu/arch/aarch64/crt0.S +45 -0
  32. package/libc/netbsd/lib/csu/arch/earm/crt0.S +61 -0
  33. package/libc/netbsd/lib/csu/arch/i386/crt0.S +48 -0
  34. package/libc/netbsd/lib/csu/arch/m68k/crt0.S +47 -0
  35. package/libc/netbsd/lib/csu/arch/mips/crt0.S +59 -0
  36. package/libc/netbsd/lib/csu/arch/powerpc/crt0.S +56 -0
  37. package/libc/netbsd/lib/csu/arch/sparc/crt0.S +55 -0
  38. package/libc/netbsd/lib/csu/arch/sparc64/crt0.S +59 -0
  39. package/libc/netbsd/lib/csu/arch/x86_64/crt0.S +48 -0
  40. package/libc/netbsd/lib/csu/common/crt0-common.c +351 -0
  41. package/libc/netbsd/lib/csu/common/crtbegin.c +135 -0
  42. package/libc/netbsd/lib/csu/common/csu-common.h +38 -0
  43. package/libc/netbsd/lib/csu/common/sysident.S +89 -0
  44. package/libc/netbsd/lib/csu/common/sysident_assym.h +17 -0
  45. package/package.json +2 -2
@@ -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
@@ -0,0 +1,89 @@
1
+ /* LINTLIBRARY */
2
+ /*-
3
+ * SPDX-License-Identifier: BSD-4-Clause
4
+ *
5
+ * Copyright 2001 David E. O'Brien.
6
+ * All rights reserved.
7
+ * Copyright 1996-1998 John D. Polstra.
8
+ * All rights reserved.
9
+ * Copyright (c) 1997 Jason R. Thorpe.
10
+ * Copyright (c) 1995 Christopher G. Demetriou
11
+ * All rights reserved.
12
+ *
13
+ * Redistribution and use in source and binary forms, with or without
14
+ * modification, are permitted provided that the following conditions
15
+ * are met:
16
+ * 1. Redistributions of source code must retain the above copyright
17
+ * notice, this list of conditions and the following disclaimer.
18
+ * 2. Redistributions in binary form must reproduce the above copyright
19
+ * notice, this list of conditions and the following disclaimer in the
20
+ * documentation and/or other materials provided with the distribution.
21
+ * 3. All advertising materials mentioning features or use of this software
22
+ * must display the following acknowledgement:
23
+ * This product includes software developed for the
24
+ * FreeBSD Project. See https://www.freebsd.org/ for
25
+ * information about FreeBSD.
26
+ * This product includes software developed for the
27
+ * NetBSD Project. See http://www.netbsd.org/ for
28
+ * information about NetBSD.
29
+ * 4. The name of the author may not be used to endorse or promote products
30
+ * derived from this software without specific prior written permission
31
+ *
32
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
33
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
+ */
43
+
44
+ #include <sys/cdefs.h>
45
+ #include <stdlib.h>
46
+
47
+ #include "libc_private.h"
48
+ #include "csu_common.h"
49
+
50
+ struct Struct_Obj_Entry;
51
+ struct ps_strings;
52
+
53
+ struct ps_strings *__ps_strings;
54
+
55
+ void _start(int, char **, char **, const struct Struct_Obj_Entry *,
56
+ void (*)(void), struct ps_strings *) __dead2;
57
+
58
+ /* The entry function. */
59
+ /*
60
+ * First 5 arguments are specified by the PowerPC SVR4 ABI.
61
+ * The last argument, ps_strings, is a BSD extension.
62
+ */
63
+ /* ARGSUSED */
64
+ void
65
+ _start(int argc, char **argv, char **env,
66
+ const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void),
67
+ struct ps_strings *ps_strings)
68
+ {
69
+ if (ps_strings != (struct ps_strings *)0)
70
+ __ps_strings = ps_strings;
71
+
72
+ #ifdef GCRT
73
+ __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext);
74
+ #else
75
+ __libc_start1(argc, argv, env, cleanup, main);
76
+ #endif
77
+ }
78
+
79
+ #ifdef GCRT
80
+ __asm__(".text");
81
+ __asm__("eprol:");
82
+ __asm__(".previous");
83
+ #endif
84
+
85
+ #ifndef PIC
86
+ __asm__(".text\n"
87
+ "\t.global _GLOBAL_OFFSET_TABLE_\n"
88
+ "\t.reloc 0, R_PPC_NONE, _GLOBAL_OFFSET_TABLE_");
89
+ #endif
@@ -0,0 +1,189 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2019 Justin Hibbits
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ *
12
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+ */
23
+
24
+ #include <machine/asm.h>
25
+ .text
26
+
27
+ /*
28
+ * The PowerPC ABI spec requires the following save/restore functions to be
29
+ * provided:
30
+ *
31
+ * _savefpr_N
32
+ * _restfpr_N
33
+ * _restfpr_N_x
34
+ * _savegpr_N
35
+ * _restgpr_N
36
+ * _restgpr_N_x
37
+ *
38
+ * With N ranging from 14 to 31, to save the nonvolatile registers.
39
+ */
40
+
41
+ #define _CRTENTRY(name) \
42
+ .text; \
43
+ .globl name; \
44
+ .type name,@function; \
45
+ name:
46
+
47
+ #define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \
48
+ stfd r,(-256 + r * 8)(11)
49
+
50
+ SAVEFPR(14)
51
+ SAVEFPR(15)
52
+ SAVEFPR(16)
53
+ SAVEFPR(17)
54
+ SAVEFPR(18)
55
+ SAVEFPR(19)
56
+ SAVEFPR(20)
57
+ SAVEFPR(21)
58
+ SAVEFPR(22)
59
+ SAVEFPR(23)
60
+ SAVEFPR(24)
61
+ SAVEFPR(25)
62
+ SAVEFPR(26)
63
+ SAVEFPR(27)
64
+ SAVEFPR(28)
65
+ SAVEFPR(29)
66
+ SAVEFPR(30)
67
+ SAVEFPR(31)
68
+ blr
69
+
70
+ #define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \
71
+ lfd r,(-256 + r * 8)(11)
72
+
73
+ RESTFPR(14)
74
+ RESTFPR(15)
75
+ RESTFPR(16)
76
+ RESTFPR(17)
77
+ RESTFPR(18)
78
+ RESTFPR(19)
79
+ RESTFPR(20)
80
+ RESTFPR(21)
81
+ RESTFPR(22)
82
+ RESTFPR(23)
83
+ RESTFPR(24)
84
+ RESTFPR(25)
85
+ RESTFPR(26)
86
+ RESTFPR(27)
87
+ RESTFPR(28)
88
+ RESTFPR(29)
89
+ RESTFPR(30)
90
+ RESTFPR(31)
91
+ blr
92
+
93
+ #define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \
94
+ stw r,(-128 + r * 4)(11)
95
+
96
+ SAVEGPR(14)
97
+ SAVEGPR(15)
98
+ SAVEGPR(16)
99
+ SAVEGPR(17)
100
+ SAVEGPR(18)
101
+ SAVEGPR(19)
102
+ SAVEGPR(20)
103
+ SAVEGPR(21)
104
+ SAVEGPR(22)
105
+ SAVEGPR(23)
106
+ SAVEGPR(24)
107
+ SAVEGPR(25)
108
+ SAVEGPR(26)
109
+ SAVEGPR(27)
110
+ SAVEGPR(28)
111
+ SAVEGPR(29)
112
+ SAVEGPR(30)
113
+ SAVEGPR(31)
114
+ blr
115
+
116
+ #define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \
117
+ lwz r,(-128 + r*4)(11)
118
+
119
+ RESTGPR(14)
120
+ RESTGPR(15)
121
+ RESTGPR(16)
122
+ RESTGPR(17)
123
+ RESTGPR(18)
124
+ RESTGPR(19)
125
+ RESTGPR(20)
126
+ RESTGPR(21)
127
+ RESTGPR(22)
128
+ RESTGPR(23)
129
+ RESTGPR(24)
130
+ RESTGPR(25)
131
+ RESTGPR(26)
132
+ RESTGPR(27)
133
+ RESTGPR(28)
134
+ RESTGPR(29)
135
+ RESTGPR(30)
136
+ RESTGPR(31)
137
+ blr
138
+
139
+ #define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \
140
+ lfd r,(-256 + r * 8)(11)
141
+
142
+ RESTFPR_X(14)
143
+ RESTFPR_X(15)
144
+ RESTFPR_X(16)
145
+ RESTFPR_X(17)
146
+ RESTFPR_X(18)
147
+ RESTFPR_X(19)
148
+ RESTFPR_X(20)
149
+ RESTFPR_X(21)
150
+ RESTFPR_X(22)
151
+ RESTFPR_X(23)
152
+ RESTFPR_X(24)
153
+ RESTFPR_X(25)
154
+ RESTFPR_X(26)
155
+ RESTFPR_X(27)
156
+ RESTFPR_X(28)
157
+ RESTFPR_X(29)
158
+ RESTFPR_X(30)
159
+ RESTFPR_X(31)
160
+ lwz 0,4(11)
161
+ mtlr 0
162
+ mr 1,11
163
+ blr
164
+
165
+ #define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \
166
+ lwz r,(-128 + r * 4)(11)
167
+
168
+ RESTGPR_X(14)
169
+ RESTGPR_X(15)
170
+ RESTGPR_X(16)
171
+ RESTGPR_X(17)
172
+ RESTGPR_X(18)
173
+ RESTGPR_X(19)
174
+ RESTGPR_X(20)
175
+ RESTGPR_X(21)
176
+ RESTGPR_X(22)
177
+ RESTGPR_X(23)
178
+ RESTGPR_X(24)
179
+ RESTGPR_X(25)
180
+ RESTGPR_X(26)
181
+ RESTGPR_X(27)
182
+ RESTGPR_X(28)
183
+ RESTGPR_X(29)
184
+ RESTGPR_X(30)
185
+ RESTGPR_X(31)
186
+ lwz 0,4(11)
187
+ mtlr 0
188
+ mr 1,11
189
+ blr
@@ -0,0 +1,31 @@
1
+ /*-
2
+ * SPDX-License-Identifier: BSD-1-Clause
3
+ *
4
+ * Copyright 2018 Andrew Turner
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ *
12
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+ */
23
+
24
+ #ifndef _CRT_H_
25
+ #define _CRT_H_
26
+
27
+ /* zig patch: no HAVE_CTORS */
28
+ #define CTORS_CONSTRUCTORS
29
+ #define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop"
30
+
31
+ #endif