Hello, List!
I've successfully built cross-compiler for PowerPC GPC configuration attached below.
Anyway, I cannot execute simple program built with my new compiler. Program looks like:
program test;
type MyRecord = record x: word; y: word; end;
var t1, t2: MyRecord;
begin writeln ('SizeOf (word)', Sizeof (word)); writeln ('SizeOf (longword)', Sizeof (longword)); writeln ('SizeOf (CInteger)', Sizeof (CInteger)); t1.x := 1; t1.y := 1; writeln ('before assignment'); t2 := t1; writeln ('after assignment'); end.
Program output:
bash-2.05b# ./test SizeOf (word)4 SizeOf (longword)8 SizeOf (CInteger)4 before assignment Illegal instruction
When I change type of fields fo MyRecord to longword, it works fine. Is it anything wrong with alignment or packed records? But my record isn't packed ... I could avoid usage of whole records assignments and assign the values field by field but there are two reason why I don't want to do that: 1. it shows that something is wrong, isn't it? 2. assignment of the whole records is used in crt.pas unit, for example, in function ScreenSize of crt.pas unit which return the value of TPoint type which is record (this assignment doesn't work as well). I really don't want change anything in crt.pas unit:).
Please, any ideas or hints ... Thank you, regards, Igor Marnat
GPC configuration: (Reading specs from /home/igor/denx_tools/usr/lib/gcc-lib/ppc-linux/3.3.3/specs Configured with: ../configure --prefix=/home/igor/denx_tools/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --with-newlib --enable-languages=c,c++,pascal --disable-libgcj --host=i386-redhat-linux --target=ppc-linux Thread model: posix gpc version 20050217, based on gcc-3.3.3 (DENX ELDK custom version 3.3.3-8) ).
~
Igor Marnat wrote:
Anyway, I cannot execute simple program built with my new compiler. Program looks like:
program test;
type MyRecord = record x: word; y: word; end;
var t1, t2: MyRecord;
begin writeln ('SizeOf (word)', Sizeof (word)); writeln ('SizeOf (longword)', Sizeof (longword)); writeln ('SizeOf (CInteger)', Sizeof (CInteger)); t1.x := 1; t1.y := 1; writeln ('before assignment'); t2 := t1; writeln ('after assignment'); end.
Program output:
bash-2.05b# ./test SizeOf (word)4 SizeOf (longword)8 SizeOf (CInteger)4 before assignment Illegal instruction
When I change type of fields fo MyRecord to longword, it works fine. Is it anything wrong with alignment or packed records? But my record isn't packed ... I could avoid usage of whole records assignments and assign the values field by field but there are two reason why I don't want to do that:
- it shows that something is wrong, isn't it?
- assignment of the whole records is used in crt.pas unit, for example, in
function ScreenSize of crt.pas unit which return the value of TPoint type which is record (this assignment doesn't work as well). I really don't want change anything in crt.pas unit:).
Please, any ideas or hints ...
Use gpc -S -fverbose-asm to find out offending instructions. I have tried your program on MacOS cross-compiler, it seems to use floating point double moves for whole record assignment, maybe this is the problem?
BTW there is quite a lot of different Power and PowerPC chips, so maybe you need to tell gpc to generate code for your processor?
On 14 March 2005 19:28, Waldek Hebisch wrote:
BTW there is quite a lot of different Power and PowerPC chips, so maybe you need to tell gpc to generate code for your processor?
Waldek, thank you once again! I give it an option -mcpu=405 (I'm using ppc405ep processor) and things go better now. At least, CRT unit works (those test program works as well). It tells "undefined instruction" when I try to work with files (assign, rewrite) but I obviously have to rebuild rts part of compiler (its library) using this option. Regards, Igor Marnat