Recent

Author Topic: ElistError in FPC cross compiler release mode for x86_64 to loongarch  (Read 1769 times)

TYDQ

  • Full Member
  • ***
  • Posts: 102
My full pascal code is on Github https://github.com/TYDQSoft/UEFIPascalOS
I have run the buildall.sh to compile x86_64 arch,cross compile aarch64 arch and loongarch64 arch.
buildall.sh:
Code: Bash  [Select][+][-]
  1.         mkdir installer
  2.         mkdir kernel
  3.         /home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -Us -CX -XXs -Px86_64 -Rintel -Cg system.pas
  4.         /home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Px86_64 -Rintel -Cg uefiinstaller.pas
  5.         /home/tydq/source/compiler/ppc1 -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Px86_64 -Rintel -Cg uefimain.pas
  6.         ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefiinstaller.o uefi.o tydqfs.o system.o -e efi_main -o installer.so
  7.         objcopy -O efi-app-x86_64 installer.so installer/bootx64.efi
  8.         ld --gc-sections -nostdlib -znocombreloc -shared -Bsymbolic --no-keep-memory uefimain.o uefi.o tydqfs.o system.o -e efi_main -o main.so
  9.         objcopy -O efi-app-x86_64 main.so kernel/bootx64.efi
  10.         rm *.o
  11.         rm *.ppu
  12.         rm *.so
  13.         /home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -Us -CX -XXs -Cg -Tlinux system.pas
  14.         /home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Cg -Tlinux uefiinstaller.pas
  15.         /home/tydq/source/compiler/ppcrossa64 -XPaarch64-linux-gnu- -Aas -n -O1 -Si -Sc -Sg -Xd -CX -XXs -Cg -Tlinux uefimain.pas
  16.         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
  17.         aarch64-linux-gnu-objcopy -O efi-app-aarch64 installer.so installer/bootaa64.efi
  18.         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
  19.         aarch64-linux-gnu-objcopy -O efi-app-aarch64 main.so kernel/bootaa64.efi
  20.         rm *.o
  21.         rm *.ppu
  22.         rm *.so
  23.         /home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -Us -CX -XXs -Cg system.pas
  24.         /home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -CX -XXs -Cg uefiinstaller.pas
  25.         /home/tydq/source/compiler/ppcrossloongarch64 -XPloongarch64-linux-gnu -Aas -n -O- -Si -Sc -Sg -Xd -CX -XXs -Cg uefimain.pas
  26.         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
  27.         loongarch64-linux-gnu-objcopy -O efi-app-loongarch64 installer.so installer/bootloongarch.efi
  28.         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
  29.         loongarch64-linux-gnu-objcopy -O efi-app-loongarch64 main.so kernel/bootloongarch.efi
  30.         rm *.o
  31.         rm *.ppu
  32.         rm *.so
  33.         dd if=/dev/zero of=fat.img bs=512 count=131072
  34.         /usr/sbin/mkfs.vfat -F 32 fat.img
  35.         mmd -i fat.img ::
  36.         mmd -i fat.img ::/EFI
  37.         mmd -i fat.img ::/EFI/BOOT
  38.         mmd -i fat.img ::/EFI/SETUP
  39.         mcopy -i fat.img installer/*.efi ::/EFI/BOOT
  40.         mcopy -i fat.img kernel/*.efi ::/EFI/SETUP
  41.         mkdir iso
  42.         cp fat.img iso
  43.         xorriso -as mkisofs -R -f -e fat.img -no-emul-boot -o TestOS.iso iso
  44.         rm -rf iso
  45.         rm -rf fat.img
  46.         rm -rf installer
  47.         rm -rf kernel
  48.         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?
« Last Edit: May 27, 2024, 04:14:30 pm by TYDQ »

TYDQ

  • Full Member
  • ***
  • Posts: 102
I updated the binutils but the same error exists and I don't know why?Is it the internal error in fpc or my code is wrong?

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
loongarch is not a common platform. If your code works on AARCH it is likely that loongarch  is at fault here.
BTW, I find it commendable that your uefi compiler works, albeit not everywhere. That is a great achievement on its own!
If I smell bad code it usually is bad code and that includes my own code.

TYDQ

  • Full Member
  • ***
  • Posts: 102
loongarch is not a common platform. If your code works on AARCH it is likely that loongarch  is at fault here.
BTW, I find it commendable that your uefi compiler works, albeit not everywhere. That is a great achievement on its own!
Yeah,I hope as the fpc updates the support of loongarch64 will be stable and normally.
However,I cannot install clang cross compiler in x64 to aarch64 because my computer RAM is not enough and I need to change the way to generate efi files like using hacks  as gnu-efi do.The gnu-efi linker script is not suitable for pascal compiled objects because the exported file is too large.So it must have another way to solve the problem that elf to efi(I have tested the elf2efi in github,It is useless as it reminds .hash unrecognized).

 

TinyPortal © 2005-2018