Recent

Author Topic: Assembler error ‘illegal operands’ when compiling on RISC-V 64 computer  (Read 3913 times)

yurets_z

  • Newbie
  • Posts: 3
I’m new to the topic of compiling the IDE from source and crosscompiling.
I found it interesting to try porting a couple of my Lazarus GUI projects on RISC-V 64 SBC (VisionFive 2) operating under Debian OS.

For that I used a cross compiled version of FPC 3.3.1 from trunk  (http://downloads.freepascal.org/fpc/snapshot/trunk/riscv64-linux/fpc-3.3.1.riscv64-linux.built.on.x86_64-linux.tar.gz) and Lazarus 3.4.0 source files.

When trying to build the IDE (via “make clean all” ) I get the following output and assembler error in the mid of the process:

Code: Pascal  [Select][+][-]
  1. (3104) Compiling formeditingintf.pas
  2. /home/user/Lazarus/components/ideintf/formeditingintf.pas(321,12) Note: (6058) Call to subroutine "function LeftFromDesignInfo(ADesignInfo:LongInt):System.SmallInt;" marked as inline is not inlined
  3. /home/user/Lazarus/components/ideintf/formeditingintf.pas(323,11) Note: (6058) Call to subroutine "function TopFromDesignInfo(ADesignInfo:LongInt):System.SmallInt;" marked as inline is not inlined
  4. /home/user/Lazarus/components/ideintf/formeditingintf.pas(337,26) Note: (6058) Call to subroutine "function LeftTopToDesignInfo(const ALeft:SmallInt;const ATop:SmallInt):System.LongInt;" marked as inline is not inlined
  5. /home/user/Lazarus/components/ideintf/formeditingintf.pas(150,43) Hint: (5024) Parameter "aForm" not used
  6. /home/user/Lazarus/components/ideintf/formeditingintf.pas(162,35) Hint: (5024) Parameter "AComponent" not used
  7. /home/user/Lazarus/components/ideintf/formeditingintf.pas(163,38) Hint: (5024) Parameter "Parent" not used
  8. /home/user/Lazarus/components/ideintf/formeditingintf.pas(163,63) Hint: (5024) Parameter "ChildClass" not used
  9. /home/user/Lazarus/components/ideintf/formeditingintf.pas(165,38) Hint: (5024) Parameter "AComponent" not used
  10. /home/user/Lazarus/components/ideintf/formeditingintf.pas(166,41) Hint: (5024) Parameter "AComponent" not used
  11. /home/user/Lazarus/components/ideintf/formeditingintf.pas(170,37) Hint: (5024) Parameter "aComponent" not used
  12. /home/user/Lazarus/components/ideintf/formeditingintf.pas(174,23) Hint: (5024) Parameter "Sender" not used
  13. /home/user/Lazarus/components/ideintf/formeditingintf.pas(174,50) Hint: (5024) Parameter "Key" not used
  14. /home/user/Lazarus/components/ideintf/formeditingintf.pas(174,66) Hint: (5024) Parameter "Shift" not used
  15. /home/user/Lazarus/components/ideintf/formeditingintf.pas(175,21) Hint: (5024) Parameter "Sender" not used
  16. /home/user/Lazarus/components/ideintf/formeditingintf.pas(175,48) Hint: (5024) Parameter "Key" not used
  17. /home/user/Lazarus/components/ideintf/formeditingintf.pas(175,64) Hint: (5024) Parameter "Shift" not used
  18. /home/user/Lazarus/components/ideintf/formeditingintf.pas(176,30) Hint: (5024) Parameter "Button" not used
  19. /home/user/Lazarus/components/ideintf/formeditingintf.pas(176,57) Hint: (5024) Parameter "Shift" not used
  20. /home/user/Lazarus/components/ideintf/formeditingintf.pas(176,82) Hint: (5024) Parameter "p" not used
  21. /home/user/Lazarus/components/ideintf/formeditingintf.pas(176,102) Hint: (5024) Parameter "Handled" not used
  22. /home/user/Lazarus/components/ideintf/formeditingintf.pas(177,30) Hint: (5024) Parameter "Shift" not used
  23. /home/user/Lazarus/components/ideintf/formeditingintf.pas(177,55) Hint: (5024) Parameter "p" not used
  24. /home/user/Lazarus/components/ideintf/formeditingintf.pas(177,75) Hint: (5024) Parameter "Handled" not used
  25. /home/user/Lazarus/components/ideintf/formeditingintf.pas(178,28) Hint: (5024) Parameter "Button" not used
  26. /home/user/Lazarus/components/ideintf/formeditingintf.pas(178,55) Hint: (5024) Parameter "Shift" not used
  27. /home/user/Lazarus/components/ideintf/formeditingintf.pas(178,80) Hint: (5024) Parameter "p" not used
  28. /home/user/Lazarus/components/ideintf/formeditingintf.pas(178,100) Hint: (5024) Parameter "Handled" not used
  29. /home/user/Lazarus/components/ideintf/formeditingintf.pas(179,45) Hint: (5024) Parameter "APersistent" not used
  30. /home/user/Lazarus/components/ideintf/formeditingintf.pas(179,80) Hint: (5024) Parameter "AIndex" not used
  31. (9009) Assembling formeditingintf
  32. units/riscv64-linux/nogui/formeditingintf.s: Assembler messages:
  33. units/riscv64-linux/nogui/formeditingintf.s:4040: Error: illegal operands `lui ireg32,1'
  34. units/riscv64-linux/nogui/formeditingintf.s:4041: Error: illegal operands `addiw ireg32,ireg32,-1760'
  35. units/riscv64-linux/nogui/formeditingintf.s:4042: Error: illegal operands `add ireg33,x5,ireg32'
  36. units/riscv64-linux/nogui/formeditingintf.s:4043: Error: illegal operands `ld x5,0(ireg33)'
  37. units/riscv64-linux/nogui/formeditingintf.s:4127: Error: illegal operands `lui ireg32,1'
  38. units/riscv64-linux/nogui/formeditingintf.s:4128: Error: illegal operands `addiw ireg32,ireg32,-1760'
  39. units/riscv64-linux/nogui/formeditingintf.s:4129: Error: illegal operands `add ireg33,x5,ireg32'
  40. units/riscv64-linux/nogui/formeditingintf.s:4130: Error: illegal operands `ld x5,0(ireg33)'
  41. units/riscv64-linux/nogui/formeditingintf.s:4214: Error: illegal operands `lui ireg32,1'
  42. units/riscv64-linux/nogui/formeditingintf.s:4215: Error: illegal operands `addiw ireg32,ireg32,-1760'
  43. units/riscv64-linux/nogui/formeditingintf.s:4216: Error: illegal operands `add ireg33,x5,ireg32'
  44. units/riscv64-linux/nogui/formeditingintf.s:4217: Error: illegal operands `ld x5,0(ireg33)'
  45. units/riscv64-linux/nogui/formeditingintf.s:4231: Error: illegal operands `lui ireg32,1'
  46. units/riscv64-linux/nogui/formeditingintf.s:4232: Error: illegal operands `addiw ireg32,ireg32,-1456'
  47. units/riscv64-linux/nogui/formeditingintf.s:4233: Error: illegal operands `add ireg33,x5,ireg32'
  48. units/riscv64-linux/nogui/formeditingintf.s:4234: Error: illegal operands `ld x5,0(ireg33)'
  49. /home/user/Lazarus/components/ideintf/formeditingintf.pas(847) Error: (9007) Error while assembling exitcode 1
  50. /home/user/Lazarus/components/ideintf/formeditingintf.pas(847) Fatal: (10026) There were 2 errors compiling module, stopping
  51. Fatal: (1018) Compilation aborted
  52. make[2]: *** [Makefile:3768: ideintf.ppu] Error 1
  53. make[2]: Leaving directory '/home/user/Lazarus/components/ideintf'
  54. make[1]: *** [Makefile:1912: lazbuildlclpackages] Error 2
  55. make[1]: Leaving directory '/home/user/Lazarus/components'
  56. make: *** [Makefile:3129: lazbuild] Error 2
  57.  

I guess the complain is about ireg32 and ireg33 operands. Any ideas/suggestions about the reason and how that could be fixed?


Kind regards,

Yuriy

jma_sp

  • Full Member
  • ***
  • Posts: 154
  • El conocimiento si ocupa lugar.
Hello.
Have you do any advance about it. I am also interested about having working FreePascal and Lazarus under Debian 64 bits and RISC-V
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12538
  • FPC developer.
ireg are register allocator failures, they are virtual registers that should have been replaced by real ones after register allocation.

Laksen

  • Hero Member
  • *****
  • Posts: 801
    • J-Software
Looks like thlcgriscv.g_intf_wrapper was never properly implemented

yurets_z

  • Newbie
  • Posts: 3
Hello.
Have you do any advance about it. I am also interested about having working FreePascal and Lazarus under Debian 64 bits and RISC-V

I've dropped the idea for a while.

Google says the same problem was experienced at least by 1 more user

https://lists.freepascal.org/fpc-devel/2024-August/045745.html

Thaddy

  • Hero Member
  • *****
  • Posts: 18376
  • Here stood a man who saw the Elbe and jumped it.
1. the link is http, not https, so I would not download such a tarball.
(Just in case you did not notice, or still studying for your Internet license)

2. Trunk is usually build from source. I am not aware that tarball is even legal.
Please remove that link.

3. Build from source and remember 3.3.1 is a moving target and especially Risc-V has very regulat updates,
4. Never download from an insecure source,
5. Never download from an insecure source,
6. Never download from an insecure source.

The other user is also stupid.
« Last Edit: October 07, 2025, 01:41:34 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Thaddy

  • Hero Member
  • *****
  • Posts: 18376
  • Here stood a man who saw the Elbe and jumped it.
When trying to build the IDE (via “make clean all” ) I get the following output and assembler error in the mid of the process:

Use git clone or afterwards git pull

Only after that try to build.

git clone https://gitlab.com/freepascal.org/fpc/source.git fpc
That is safe. The clone takes seconds, not hours. (note I am on fiber, may be minutes)
« Last Edit: October 07, 2025, 01:40:33 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

ccrause

  • Hero Member
  • *****
  • Posts: 1080
It seems that the use of (or at least compiling for) RISC-V is slowly picking up.  Other related bug reports:
https://gitlab.com/freepascal.org/fpc/source/-/issues/40880
https://gitlab.com/freepascal.org/fpc/source/-/issues/41389

Thaddy

  • Hero Member
  • *****
  • Posts: 18376
  • Here stood a man who saw the Elbe and jumped it.
It seems that the use of (or at least compiling for) RISC-V is slowly picking up.  Other related bug reports:
https://gitlab.com/freepascal.org/fpc/source/-/issues/40880
https://gitlab.com/freepascal.org/fpc/source/-/issues/41389
Not slowly for those that are interested. There are quite a lot of RISC-V based platforms available at super available prices.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2663
1. the link is http, not https, so I would not download such a tarball.
(Just in case you did not notice, or still studying for your Internet license)

2. Trunk is usually build from source. I am not aware that tarball is even legal.
Please remove that link.

3. Build from source and remember 3.3.1 is a moving target and especially Risc-V has very regulat updates,
4. Never download from an insecure source,
5. Never download from an insecure source,
6. Never download from an insecure source.

The other user is also stupid.

I'm not maintaining it, but IIRC downloads.freepascal.org is a valid source. And should point to the same location as the lazarus-ide counterpart, which currently isn't the case. Need to sort this out
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018