BuildSystem: Move all userpace libraries under the userspace directory

As the number of libraries is increasing, root directory starts to
expand. This adds better organization for libraries
This commit is contained in:
2024-06-18 13:14:35 +03:00
parent 1b5a01a6c9
commit c69919738b
157 changed files with 46 additions and 30 deletions

View File

@@ -0,0 +1,34 @@
.section .text
.global _start
_start:
pushl $0
pushl %edi
pushl %esi
pushl %edx
# STACK LAYOUT
# null
# argc
# argv
# envp
xorl %ebp, %ebp
# init libc (envp already as argument)
call _init_libc
# call global constructors
call _init
# call main
movl 0(%esp), %eax
xchgl %eax, 8(%esp)
movl %eax, (%esp)
call main
subl $12, %esp
pushl %eax
call exit
.size _start, . - _start

View File

@@ -0,0 +1,16 @@
/* i686 crti.s */
.section .init
.global _init
.type _init, @function
_init:
pushl %ebp
movl %esp, %ebp
/* gcc will nicely put the contents of crtbegin.o's .init section here. */
.section .fini
.global _fini
.type _fini, @function
_fini:
pushl %ebp
movl %esp, %ebp
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */

View File

@@ -0,0 +1,10 @@
/* i686 crtn.s */
.section .init
/* gcc will nicely put the contents of crtend.o's .init section here. */
popl %ebp
ret
.section .fini
/* gcc will nicely put the contents of crtend.o's .fini section here. */
popl %ebp
ret

View File

@@ -0,0 +1,35 @@
.section .text
.global _start
_start:
pushq $0
pushq %rdi
pushq %rsi
pushq %rdx
# STACK LAYOUT
# null
# argc
# argv
# envp
xorq %rbp, %rbp
# init libc
movq 0(%rsp), %rdi
call _init_libc
# call global constructors
call _init
# call main
movq 16(%rsp), %rdi
movq 8(%rsp), %rsi
movq 0(%rsp), %rdx
call main
# call exit
movq %rax, %rdi
call exit
.size _start, . - _start

View File

@@ -0,0 +1,16 @@
/* x86-64 crti.s */
.section .init
.global _init
.type _init, @function
_init:
pushq %rbp
movq %rsp, %rbp
/* gcc will nicely put the contents of crtbegin.o's .init section here. */
.section .fini
.global _fini
.type _fini, @function
_fini:
pushq %rbp
movq %rsp, %rbp
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */

View File

@@ -0,0 +1,10 @@
/* x86-64 crtn.s */
.section .init
/* gcc will nicely put the contents of crtend.o's .init section here. */
popq %rbp
ret
.section .fini
/* gcc will nicely put the contents of crtend.o's .fini section here. */
popq %rbp
ret