mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-11 17:24:08 +03:00
Implement support functions ourselves instead of relying on libgcc
This commit is contained in:
parent
c53122516a
commit
ef6ef5865b
@ -32,16 +32,12 @@ limine.bin: libgcc.a $(BC) $(ASM_OBJ)
|
||||
llvm-link $(BC) -o bundle.bc
|
||||
opt --O$(OPT_LEVEL) bundle.bc -o optimised_bundle.bc
|
||||
clang --target=i386-elf -O$(OPT_LEVEL) -c optimised_bundle.bc -o optimised_bundle.o
|
||||
ld.lld optimised_bundle.o $(ASM_OBJ) libgcc.a $(INTERNAL_LDFLAGS) -o stage2.elf
|
||||
ld.lld optimised_bundle.o $(ASM_OBJ) $(INTERNAL_LDFLAGS) -o stage2.elf
|
||||
llvm-objcopy -O binary stage2.elf stage2.bin
|
||||
gzip -9 stage2.bin
|
||||
$(MAKE) -C decompressor
|
||||
cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin
|
||||
|
||||
libgcc.a:
|
||||
curl https://mirror.netcologne.de/archlinux/core/os/x86_64/gcc-10.2.0-2-x86_64.pkg.tar.zst | \
|
||||
tar -I zstd -xv --strip-components=6 --occurrence=1 usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/32/libgcc.a
|
||||
|
||||
%.bc: %.c
|
||||
clang --target=i386-elf $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
||||
|
||||
|
@ -30,7 +30,7 @@ decompressor.bin: $(BC)
|
||||
llvm-link $(BC) -o bundle.bc
|
||||
opt --O$(OPT_LEVEL) bundle.bc -o optimised_bundle.bc
|
||||
clang --target=i386-elf -O$(OPT_LEVEL) -c optimised_bundle.bc -o optimised_bundle.o
|
||||
ld.lld optimised_bundle.o ../libgcc.a $(INTERNAL_LDFLAGS) -o decompressor.elf
|
||||
ld.lld optimised_bundle.o $(INTERNAL_LDFLAGS) -o decompressor.elf
|
||||
llvm-objcopy -O binary decompressor.elf decompressor.bin
|
||||
|
||||
%.bc: %.c
|
||||
|
@ -1,5 +1,50 @@
|
||||
section .text
|
||||
|
||||
global __ashldi3
|
||||
__ashldi3:
|
||||
push ebx
|
||||
mov eax, dword [esp+8]
|
||||
mov edx, dword [esp+12]
|
||||
mov ecx, dword [esp+16]
|
||||
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
.next:
|
||||
shl edx, 1
|
||||
shl eax, 1
|
||||
setc bl
|
||||
or dl, bl
|
||||
loop .next
|
||||
|
||||
.done:
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
global __udivdi3
|
||||
__udivdi3:
|
||||
mov eax, dword [esp+4]
|
||||
mov edx, dword [esp+8]
|
||||
div dword [esp+12]
|
||||
xor edx, edx
|
||||
ret
|
||||
|
||||
global __divdi3
|
||||
__divdi3:
|
||||
mov eax, dword [esp+4]
|
||||
mov edx, dword [esp+8]
|
||||
idiv dword [esp+12]
|
||||
xor edx, edx
|
||||
ret
|
||||
|
||||
global __umoddi3
|
||||
__umoddi3:
|
||||
mov eax, dword [esp+4]
|
||||
mov edx, dword [esp+8]
|
||||
div dword [esp+12]
|
||||
mov eax, edx
|
||||
xor edx, edx
|
||||
ret
|
||||
|
||||
global memcpy
|
||||
memcpy:
|
||||
push esi
|
||||
|
Loading…
Reference in New Issue
Block a user