diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
commit | 8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch) | |
tree | df55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/musl/crt | |
parent | Initial commit. (diff) | |
download | wasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.tar.xz wasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.zip |
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/crt')
33 files changed, 380 insertions, 0 deletions
diff --git a/libc-top-half/musl/crt/Scrt1.c b/libc-top-half/musl/crt/Scrt1.c new file mode 100644 index 0000000..822f10b --- /dev/null +++ b/libc-top-half/musl/crt/Scrt1.c @@ -0,0 +1 @@ +#include "crt1.c" diff --git a/libc-top-half/musl/crt/aarch64/crti.s b/libc-top-half/musl/crt/aarch64/crti.s new file mode 100644 index 0000000..775df0a --- /dev/null +++ b/libc-top-half/musl/crt/aarch64/crti.s @@ -0,0 +1,13 @@ +.section .init +.global _init +.type _init,%function +_init: + stp x29,x30,[sp,-16]! + mov x29,sp + +.section .fini +.global _fini +.type _fini,%function +_fini: + stp x29,x30,[sp,-16]! + mov x29,sp diff --git a/libc-top-half/musl/crt/aarch64/crtn.s b/libc-top-half/musl/crt/aarch64/crtn.s new file mode 100644 index 0000000..73cab69 --- /dev/null +++ b/libc-top-half/musl/crt/aarch64/crtn.s @@ -0,0 +1,7 @@ +.section .init + ldp x29,x30,[sp],#16 + ret + +.section .fini + ldp x29,x30,[sp],#16 + ret diff --git a/libc-top-half/musl/crt/arm/crti.s b/libc-top-half/musl/crt/arm/crti.s new file mode 100644 index 0000000..18dc1e4 --- /dev/null +++ b/libc-top-half/musl/crt/arm/crti.s @@ -0,0 +1,13 @@ +.syntax unified + +.section .init +.global _init +.type _init,%function +_init: + push {r0,lr} + +.section .fini +.global _fini +.type _fini,%function +_fini: + push {r0,lr} diff --git a/libc-top-half/musl/crt/arm/crtn.s b/libc-top-half/musl/crt/arm/crtn.s new file mode 100644 index 0000000..dc020f9 --- /dev/null +++ b/libc-top-half/musl/crt/arm/crtn.s @@ -0,0 +1,9 @@ +.syntax unified + +.section .init + pop {r0,lr} + bx lr + +.section .fini + pop {r0,lr} + bx lr diff --git a/libc-top-half/musl/crt/crt1.c b/libc-top-half/musl/crt/crt1.c new file mode 100644 index 0000000..8fe8ab5 --- /dev/null +++ b/libc-top-half/musl/crt/crt1.c @@ -0,0 +1,19 @@ +#include <features.h> +#include "libc.h" + +#define START "_start" + +#include "crt_arch.h" + +int main(); +weak void _init(); +weak void _fini(); +int __libc_start_main(int (*)(), int, char **, + void (*)(), void(*)(), void(*)()); + +void _start_c(long *p) +{ + int argc = p[0]; + char **argv = (void *)(p+1); + __libc_start_main(main, argc, argv, _init, _fini, 0); +} diff --git a/libc-top-half/musl/crt/crti.c b/libc-top-half/musl/crt/crti.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libc-top-half/musl/crt/crti.c diff --git a/libc-top-half/musl/crt/crtn.c b/libc-top-half/musl/crt/crtn.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libc-top-half/musl/crt/crtn.c diff --git a/libc-top-half/musl/crt/i386/crti.s b/libc-top-half/musl/crt/i386/crti.s new file mode 100644 index 0000000..d2682a2 --- /dev/null +++ b/libc-top-half/musl/crt/i386/crti.s @@ -0,0 +1,9 @@ +.section .init +.global _init +_init: + sub $12,%esp + +.section .fini +.global _fini +_fini: + sub $12,%esp diff --git a/libc-top-half/musl/crt/i386/crtn.s b/libc-top-half/musl/crt/i386/crtn.s new file mode 100644 index 0000000..f3b61e0 --- /dev/null +++ b/libc-top-half/musl/crt/i386/crtn.s @@ -0,0 +1,7 @@ +.section .init + add $12,%esp + ret + +.section .fini + add $12,%esp + ret diff --git a/libc-top-half/musl/crt/microblaze/crti.s b/libc-top-half/musl/crt/microblaze/crti.s new file mode 100644 index 0000000..ed1c2fa --- /dev/null +++ b/libc-top-half/musl/crt/microblaze/crti.s @@ -0,0 +1,13 @@ +.section .init +.global _init +.align 2 +_init: + addi r1, r1, -32 + swi r15, r1, 0 + +.section .fini +.global _fini +.align 2 +_fini: + addi r1, r1, -32 + swi r15, r1, 0 diff --git a/libc-top-half/musl/crt/microblaze/crtn.s b/libc-top-half/musl/crt/microblaze/crtn.s new file mode 100644 index 0000000..1e02c98 --- /dev/null +++ b/libc-top-half/musl/crt/microblaze/crtn.s @@ -0,0 +1,9 @@ +.section .init + lwi r15, r1, 0 + rtsd r15, 8 + addi r1, r1, 32 + +.section .fini + lwi r15, r1, 0 + rtsd r15, 8 + addi r1, r1, 32 diff --git a/libc-top-half/musl/crt/mips/crti.s b/libc-top-half/musl/crt/mips/crti.s new file mode 100644 index 0000000..39dee38 --- /dev/null +++ b/libc-top-half/musl/crt/mips/crti.s @@ -0,0 +1,19 @@ +.set noreorder + +.section .init +.global _init +.type _init,@function +.align 2 +_init: + subu $sp,$sp,32 + sw $gp,24($sp) + sw $ra,28($sp) + +.section .fini +.global _fini +.type _fini,@function +.align 2 +_fini: + subu $sp,$sp,32 + sw $gp,24($sp) + sw $ra,28($sp) diff --git a/libc-top-half/musl/crt/mips/crtn.s b/libc-top-half/musl/crt/mips/crtn.s new file mode 100644 index 0000000..506a04b --- /dev/null +++ b/libc-top-half/musl/crt/mips/crtn.s @@ -0,0 +1,13 @@ +.set noreorder + +.section .init + lw $gp,24($sp) + lw $ra,28($sp) + j $ra + addu $sp,$sp,32 + +.section .fini + lw $gp,24($sp) + lw $ra,28($sp) + j $ra + addu $sp,$sp,32 diff --git a/libc-top-half/musl/crt/mips64/crti.s b/libc-top-half/musl/crt/mips64/crti.s new file mode 100644 index 0000000..c962dd0 --- /dev/null +++ b/libc-top-half/musl/crt/mips64/crti.s @@ -0,0 +1,17 @@ +.set noreorder + +.section .init +.global _init +.align 3 +_init: + dsubu $sp, $sp, 32 + sd $gp, 16($sp) + sd $ra, 24($sp) + +.section .fini +.global _fini +.align 3 +_fini: + dsubu $sp, $sp, 32 + sd $gp, 16($sp) + sd $ra, 24($sp) diff --git a/libc-top-half/musl/crt/mips64/crtn.s b/libc-top-half/musl/crt/mips64/crtn.s new file mode 100644 index 0000000..f3930b2 --- /dev/null +++ b/libc-top-half/musl/crt/mips64/crtn.s @@ -0,0 +1,13 @@ +.set noreorder + +.section .init + ld $gp,16($sp) + ld $ra,24($sp) + j $ra + daddu $sp,$sp,32 + +.section .fini + ld $gp,16($sp) + ld $ra,24($sp) + j $ra + daddu $sp,$sp,32 diff --git a/libc-top-half/musl/crt/mipsn32/crti.s b/libc-top-half/musl/crt/mipsn32/crti.s new file mode 100644 index 0000000..14fa28d --- /dev/null +++ b/libc-top-half/musl/crt/mipsn32/crti.s @@ -0,0 +1,18 @@ +.set noreorder +.section .init +.global _init +.type _init,@function +.align 2 +_init: + subu $sp, $sp, 32 + sd $gp, 16($sp) + sd $ra, 24($sp) + +.section .fini +.global _fini +.type _fini,@function +.align 2 +_fini: + subu $sp, $sp, 32 + sd $gp, 16($sp) + sd $ra, 24($sp) diff --git a/libc-top-half/musl/crt/mipsn32/crtn.s b/libc-top-half/musl/crt/mipsn32/crtn.s new file mode 100644 index 0000000..dccd7e8 --- /dev/null +++ b/libc-top-half/musl/crt/mipsn32/crtn.s @@ -0,0 +1,12 @@ +.set noreorder +.section .init + ld $gp, 16($sp) + ld $ra, 24($sp) + j $ra + addu $sp, $sp, 32 + +.section .fini + ld $gp, 16($sp) + ld $ra, 24($sp) + j $ra + addu $sp, $sp, 32 diff --git a/libc-top-half/musl/crt/or1k/crti.s b/libc-top-half/musl/crt/or1k/crti.s new file mode 100644 index 0000000..7e74145 --- /dev/null +++ b/libc-top-half/musl/crt/or1k/crti.s @@ -0,0 +1,11 @@ +.section .init +.global _init +_init: + l.addi r1,r1,-4 + l.sw 0(r1),r9 + +.section .fini +.global _fini +_fini: + l.addi r1,r1,-4 + l.sw 0(r1),r9 diff --git a/libc-top-half/musl/crt/or1k/crtn.s b/libc-top-half/musl/crt/or1k/crtn.s new file mode 100644 index 0000000..4185a02 --- /dev/null +++ b/libc-top-half/musl/crt/or1k/crtn.s @@ -0,0 +1,9 @@ +.section .init + l.lwz r9,0(r1) + l.jr r9 + l.addi r1,r1,4 + +.section .fini + l.lwz r9,0(r1) + l.jr r9 + l.addi r1,r1,4 diff --git a/libc-top-half/musl/crt/powerpc/crti.s b/libc-top-half/musl/crt/powerpc/crti.s new file mode 100644 index 0000000..60461ca --- /dev/null +++ b/libc-top-half/musl/crt/powerpc/crti.s @@ -0,0 +1,15 @@ +.section .init +.align 2 +.global _init +_init: + stwu 1,-32(1) + mflr 0 + stw 0,36(1) + +.section .fini +.align 2 +.global _fini +_fini: + stwu 1,-32(1) + mflr 0 + stw 0,36(1) diff --git a/libc-top-half/musl/crt/powerpc/crtn.s b/libc-top-half/musl/crt/powerpc/crtn.s new file mode 100644 index 0000000..2d14a6f --- /dev/null +++ b/libc-top-half/musl/crt/powerpc/crtn.s @@ -0,0 +1,13 @@ +.section .init +.align 2 + lwz 0,36(1) + addi 1,1,32 + mtlr 0 + blr + +.section .fini +.align 2 + lwz 0,36(1) + addi 1,1,32 + mtlr 0 + blr diff --git a/libc-top-half/musl/crt/powerpc64/crti.s b/libc-top-half/musl/crt/powerpc64/crti.s new file mode 100644 index 0000000..9f712f0 --- /dev/null +++ b/libc-top-half/musl/crt/powerpc64/crti.s @@ -0,0 +1,21 @@ +.section .init +.align 2 +.global _init +_init: + addis 2, 12, .TOC.-_init@ha + addi 2, 2, .TOC.-_init@l + .localentry _init,.-_init + mflr 0 + std 0, 16(1) + stdu 1,-32(1) + +.section .fini +.align 2 +.global _fini +_fini: + addis 2, 12, .TOC.-_fini@ha + addi 2, 2, .TOC.-_fini@l + .localentry _fini,.-_fini + mflr 0 + std 0, 16(1) + stdu 1,-32(1) diff --git a/libc-top-half/musl/crt/powerpc64/crtn.s b/libc-top-half/musl/crt/powerpc64/crtn.s new file mode 100644 index 0000000..a7a9f4a --- /dev/null +++ b/libc-top-half/musl/crt/powerpc64/crtn.s @@ -0,0 +1,13 @@ +.section .init +.align 2 + addi 1, 1, 32 + ld 0, 16(1) + mtlr 0 + blr + +.section .fini +.align 2 + addi 1, 1, 32 + ld 0, 16(1) + mtlr 0 + blr diff --git a/libc-top-half/musl/crt/rcrt1.c b/libc-top-half/musl/crt/rcrt1.c new file mode 100644 index 0000000..901dff6 --- /dev/null +++ b/libc-top-half/musl/crt/rcrt1.c @@ -0,0 +1,14 @@ +#define START "_start" +#define _dlstart_c _start_c +#include "../ldso/dlstart.c" + +int main(); +weak void _init(); +weak void _fini(); +int __libc_start_main(int (*)(), int, char **, + void (*)(), void(*)(), void(*)()); + +hidden void __dls2(unsigned char *base, size_t *sp) +{ + __libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0); +} diff --git a/libc-top-half/musl/crt/s390x/crti.s b/libc-top-half/musl/crt/s390x/crti.s new file mode 100644 index 0000000..f453205 --- /dev/null +++ b/libc-top-half/musl/crt/s390x/crti.s @@ -0,0 +1,17 @@ +.section .init +.align 2 +.global _init +_init: + stmg %r14, %r15, 112(%r15) + lgr %r0, %r15 + aghi %r15, -160 + stg %r0, 0(%r15) + +.section .fini +.align 2 +.global _fini +_fini: + stmg %r14, %r15, 112(%r15) + lgr %r0, %r15 + aghi %r15, -160 + stg %r0, 0(%r15) diff --git a/libc-top-half/musl/crt/s390x/crtn.s b/libc-top-half/musl/crt/s390x/crtn.s new file mode 100644 index 0000000..06066dc --- /dev/null +++ b/libc-top-half/musl/crt/s390x/crtn.s @@ -0,0 +1,9 @@ +.section .init +.align 2 + lmg %r14, %r15, 272(%r15) + br %r14 + +.section .fini +.align 2 + lmg %r14, %r15, 272(%r15) + br %r14 diff --git a/libc-top-half/musl/crt/sh/crti.s b/libc-top-half/musl/crt/sh/crti.s new file mode 100644 index 0000000..d99bfd5 --- /dev/null +++ b/libc-top-half/musl/crt/sh/crti.s @@ -0,0 +1,21 @@ +.section .init +.global _init +.type _init, @function +_init: + add #-4, r15 + mov.l r12, @-r15 + mov.l r14, @-r15 + sts.l pr, @-r15 + mov r15, r14 + nop + +.section .fini +.global _fini +.type _fini, @function +_fini: + add #-4, r15 + mov.l r12, @-r15 + mov.l r14, @-r15 + sts.l pr, @-r15 + mov r15, r14 + nop diff --git a/libc-top-half/musl/crt/sh/crtn.s b/libc-top-half/musl/crt/sh/crtn.s new file mode 100644 index 0000000..958ce95 --- /dev/null +++ b/libc-top-half/musl/crt/sh/crtn.s @@ -0,0 +1,13 @@ +.section .init + lds.l @r15+, pr + mov.l @r15+, r14 + mov.l @r15+, r12 + rts + add #4, r15 + +.section .fini + lds.l @r15+, pr + mov.l @r15+, r14 + mov.l @r15+, r12 + rts + add #4, r15 diff --git a/libc-top-half/musl/crt/x32/crti.s b/libc-top-half/musl/crt/x32/crti.s new file mode 100644 index 0000000..4788968 --- /dev/null +++ b/libc-top-half/musl/crt/x32/crti.s @@ -0,0 +1,9 @@ +.section .init +.global _init +_init: + push %rax + +.section .fini +.global _fini +_fini: + push %rax diff --git a/libc-top-half/musl/crt/x32/crtn.s b/libc-top-half/musl/crt/x32/crtn.s new file mode 100644 index 0000000..29198b7 --- /dev/null +++ b/libc-top-half/musl/crt/x32/crtn.s @@ -0,0 +1,7 @@ +.section .init + pop %rax + ret + +.section .fini + pop %rax + ret diff --git a/libc-top-half/musl/crt/x86_64/crti.s b/libc-top-half/musl/crt/x86_64/crti.s new file mode 100644 index 0000000..4788968 --- /dev/null +++ b/libc-top-half/musl/crt/x86_64/crti.s @@ -0,0 +1,9 @@ +.section .init +.global _init +_init: + push %rax + +.section .fini +.global _fini +_fini: + push %rax diff --git a/libc-top-half/musl/crt/x86_64/crtn.s b/libc-top-half/musl/crt/x86_64/crtn.s new file mode 100644 index 0000000..29198b7 --- /dev/null +++ b/libc-top-half/musl/crt/x86_64/crtn.s @@ -0,0 +1,7 @@ +.section .init + pop %rax + ret + +.section .fini + pop %rax + ret |