Various C library adjustments
Fix weird linking issues with newlib: - Get rid of dlmalloc - Also get rid of klmalloc Adjust crt0 operation: - Kill the dead loop at the end - Pass main to pre_main as a function pointer to move `main` reference into crt0.o - Fix a build script derp with trying to remove build and local directories (gets rid of some warnings)
This commit is contained in:
parent
038a899b45
commit
a7cd255546
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,13 +5,9 @@ global _start
|
||||
_start: ; Global entry point
|
||||
pop eax ; Our stack is slightly off
|
||||
extern pre_main ;
|
||||
extern main
|
||||
push main
|
||||
call pre_main ; call C main function
|
||||
mov ebx, eax ; return value from main
|
||||
mov eax, 0x0 ; sys_exit
|
||||
int 0x7F ; syscall
|
||||
_wait: ; wait until we've been deschuled
|
||||
hlt
|
||||
jmp _wait
|
||||
|
||||
; vim:syntax=nasm
|
||||
; vim:noexpandtab
|
||||
|
@ -320,7 +320,7 @@ struct dirent * readdir (DIR * dirp) {
|
||||
return &ent;
|
||||
}
|
||||
|
||||
void pre_main(int argc, char * argv[]) {
|
||||
void pre_main(int (*main)(int,char**), int argc, char * argv[]) {
|
||||
unsigned int x = 0;
|
||||
unsigned int nulls = 0;
|
||||
for (x = 0; 1; ++x) {
|
||||
|
@ -73,7 +73,11 @@ pushd "$DIR" > /dev/null
|
||||
installNewlibStuff "newlib-1.19.0"
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d build ]; then
|
||||
mkdir build
|
||||
fi
|
||||
if [ ! -d local ]; then
|
||||
mkdir local
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
|
@ -31,8 +31,6 @@ function patc () {
|
||||
function installNewlibStuff () {
|
||||
cp -r ../patches/newlib/toaru $1/newlib/libc/sys/toaru
|
||||
cp -r ../patches/newlib/include/* $1/newlib/libc/sys/toaru/
|
||||
# dlmalloc
|
||||
cp -r ../patches/newlib/malloc.c $1/newlib/libc/stdlib/malloc.c
|
||||
cp -r ../patches/newlib/setjmp.S $1/newlib/libc/machine/i386/setjmp.S
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user