My full pascal code is on Github
https://github.com/TYDQSoft/UEFIPascalOSI have run the buildall.sh to compile x86_64 arch,cross compile aarch64 arch and loongarch64 arch.
buildall.sh:
mkdir installer
mkdir kernel
/home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -Us -CX -XXs -Px86_64 -Rintel -Cg system.pas
/home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Px86_64 -Rintel -Cg uefiinstaller.pas
/home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Px86_64 -Rintel -Cg uefimain.pas
ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefiinstaller.o uefi.o tydqfs.o system.o -e efi_main -o installer.so
objcopy -O efi-app-x86_64 installer.so installer/bootx64.efi
ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefimain.o uefi.o tydqfs.o system.o -e efi_main -o main.so
objcopy -O efi-app-x86_64 main.so kernel/bootx64.efi
rm *.o
rm *.ppu
rm *.so
/home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -Us -CX -XXs -Cg -Tlinux system.pas
/home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Cg -Tlinux uefiinstaller.pas
/home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Cg -Tlinux uefimain.pas
aarch64-linux-gnu-ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefiinstaller.o uefi.o tydqfs.o system.o -e efi_main -o installer.so
aarch64-linux-gnu-objcopy -O efi-app-aarch64 installer.so installer/bootaa64.efi
aarch64-linux-gnu-ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefimain.o uefi.o tydqfs.o system.o -e efi_main -o main.so
aarch64-linux-gnu-objcopy -O efi-app-aarch64 main.so kernel/bootaa64.efi
rm *.o
rm *.ppu
rm *.so
/home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -Us -CX -XXs -Cg system.pas
/home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -CX -XXs -Cg uefiinstaller.pas
/home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -CX -XXs -Cg uefimain.pas
loongarch64-linux-gnu-ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefiinstaller.o uefi.o tydqfs.o system.o -e efi_main -o installer.so
loongarch64-linux-gnu-objcopy -O efi-app-loongarch64 installer.so installer/bootloongarch.efi
loongarch64-linux-gnu-ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefimain.o uefi.o tydqfs.o system.o -e efi_main -o main.so
loongarch64-linux-gnu-objcopy -O efi-app-loongarch64 main.so kernel/bootloongarch.efi
rm *.o
rm *.ppu
rm *.so
dd if=/dev/zero of=fat.img bs=512 count=131072
/usr/sbin/mkfs.vfat -F 32 fat.img
mmd -i fat.img ::
mmd -i fat.img ::/EFI
mmd -i fat.img ::/EFI/BOOT
mmd -i fat.img ::/EFI/SETUP
mcopy -i fat.img installer/*.efi ::/EFI/BOOT
mcopy -i fat.img kernel/*.efi ::/EFI/SETUP
mkdir iso
cp fat.img iso
xorriso -as mkisofs -R -f -e fat.img -no-emul-boot -o TestOS.iso iso
rm -rf iso
rm -rf fat.img
rm -rf installer
rm -rf kernel
rm -rf *.so
The same code can be compiled in x86_64 and aarch64,but compile in loongarch64 it give me error:
Error: Compilation raised exception internally
An unhandled exception occurred at $000000000047C8B3:
EListError: List index exceeds bounds (0)
$000000000047C8B3
So does anyone know the same code only can't be compiled in loongarch64 mode?(I have tested x86_64(host),aarch64,loongarch64)
And does anyone know how to build aarch64 efi and loongarch64 efi correctly?