This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems using -mrtd and -mshort for m68k


Hi,

>this may be a bug in the m68k machine description for gcc.
>
>In order to confirm it, can you please re-run your compile and link
>commands, but add the option '-v' to the each of the command lines, to
>generate a verbose listing of the compiler's activity; and then please
>post the output to the list.

I have compiled and linked with the -v option now:

D:\GCC-TEST>gcc -g -v -b 68k -mcpu32 -mshort -mrtd -c -O1 -o test.o
test.c
Reading specs from d:/xgcc/68k/2_8_1/specs
gcc driver version 2.8.1 executing gcc version egcs-2.90.29
 d:/xgcc/68k/2_8_1/cpp.exe -lang-c -v -iprefix d:/xgcc/68k/2_8_1/
-undef -D__GNUC__=2 -D__GNUC_MINOR__=90 -Dmc68000 -D__embedded__
-D__mc68000__ -D__embedded__ -D__mc68000 -Asystem(embedded)
-Amachine(mc68000) -D__OPTIMIZE__ -g -D__INT_MAX__=32767 -Dmcpu32
-D__mcpu32__ -D__mcpu32 test.c d:/xgcc/tmp/ccaaaaaa.i
GNU CPP version egcs-2.90.29 980515 (egcs-1.0.3 release) (68k,
Motorola syntax)
#include "..." search starts here:
#include <...> search starts here:
 d:/xgcc/68k/2_8_1/include
End of search list.
 d:/xgcc/68k/2_8_1/cc1.exe d:/xgcc/tmp/ccaaaaaa.i -quiet -dumpbase
test.c -mcpu32 -mshort -mrtd -g -O1 -version -o d:/xgcc/tmp/ccaaaaaa.s
GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release) (68k) compiled
by GNU C version 2.8.1.
test.c: In function `main':
test.c:4: warning: return type of `main' is not `int'
 d:/xgcc/68k/2_8_1/as.exe -mcpu32 -o test.o d:/xgcc/tmp/ccaaaaaa.s


D:\GCC-TEST>gcc -g -v -b 68k -mcpu32 -mshort -mrtd -o test.cof test.o
-Ttest.ld
Reading specs from d:/xgcc/68k/2_8_1/specs
gcc driver version 2.8.1 executing gcc version egcs-2.90.29
 d:/xgcc/68k/2_8_1/ld.exe -o test.cof
d:/xgcc/68k/2_8_1/mshort/mrtd/mcpu32/crt0.o
-Ld:/xgcc/68k/2_8_1/mshort/mrtd/mcpu32 -Ld:/xgcc/68k/2_8_1 -Ld:/xgcc
test.o -lgcc -lgcc -Ttest.ld


Here's the relevant part of the generated code:

00030026 <main>:
double main(int i){
   30026:	4e56 ffe0      	linkw %fp,#-32
   3002a:	48e7 3020      	moveml %d2-%d3/%a2,%sp@-
   3002e:	346e 0008      	moveaw %fp@(8),%a2
   30032:	4eb9 0003 0006 	jsr 30006 <__main>
double d;
char ch[30];
d = (double)i;
   30038:	344a           	moveaw %a2,%a2
   3003a:	2f0a           	movel %a2,%sp@-
   3003c:	4eb9 0003 006c 	jsr 3006c <__floatsidf>
   30042:	588f           	addql #4,%sp
   30044:	2400           	movel %d0,%d2
   30046:	2601           	movel %d1,%d3
strcpy(&ch[0], "Just some string for testing");
   30048:	3f3c 001d      	movew #29,%sp@-
   3004c:	486e ffe2      	pea %fp@(-30)
   30050:	487a ffb6      	pea %pc@(30008 <.text>)
   30054:	4eb9 0003 0280 	jsr 30280 <bcopy>
return d;
   3005a:	2002           	movel %d2,%d0
   3005c:	2203           	movel %d3,%d1
}
   3005e:	4cee 040c ffd4 	moveml %fp@(-44),%d2-%d3/%a2
   30064:	4e5e           	unlk %fp
   30066:	4e74 0002      	rtd #2


0003006c <__floatsidf>:
   3006c:	4e56 0000      	linkw %fp,#0
   ....
   300e6:	4e5e           	unlk %fp
   300e8:	4e74 0004      	rtd #4


00030280 <bcopy>:
   30280:	4e56 0000      	linkw %fp,#0
   30284:	2f2e 0010      	movel %fp@(16),%sp@-
   30288:	2f2e 0008      	movel %fp@(8),%sp@-
   3028c:	2f2e 000c      	movel %fp@(12),%sp@-
   30290:	4eb9 0003 029c 	jsr 3029c <memmove>
   30296:	4e5e           	unlk %fp
   30298:	4e74 000c      	rtd #12


The problems:

Argument for __floatsidf is popped twice (-mtrd problem):
   30042:	588f           	addql #4,%sp
   300e8:	4e74 0004      	rtd #4
This problem occurrs for all fp conversion functions.

The size of the 'number of characters' argument for bcopy differs
(-mshort problem):
   30048:	3f3c 001d      	movew #29,%sp@-
   30284:	2f2e 0010      	movel %fp@(16),%sp@-
   30298:	4e74 000c      	rtd #12


Arjan Koers.
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.