Subject: Cygwin32 cross-compiler (to m68k)
From: [email-masked] (Steve Hanka)

12 Mar 1998 05:38:13 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
To: [email-masked]

Hi all,

I am trying to build a gcc-2.8.1 Win32 to m68k-coff cross-compiler.  I
used the cygwin32 b19 release to make the 2.8.1 cross-compiler. I used
../config --host=i386-cygwin32 --target=m68k-coff --with-gnu-as 
   --with-gnu-ld

The compiler seems to work except that the 68K code generation is a
bit weird.

I have the following C program:

#include <stdio.h>

void
main(void)
{
   int i;
   char *x;
   printf("\nHello World\n");
   printf("This is a test of the GNU C compiler\n");
   for (i = 0; i < 10; i++) {
      printf("iteration = %d\n",i);
   }

}

When I compile it on my Sun 5 using a gcc-2.7.2 cross compiler I get the 
following m68k assembler output:

xgcc -O -S -gcoff hello.c

gives:

	.
	.
	.
_main:
	.def	.bf;	.val	.;	.scl	101;	.line	5;	.endef
	link.w %a6,#0
	move.l %a2,-(%sp)
	jsr ___main
	.ln	2
	.def	_i;	.val	10;	.scl	4;	.type	04;	.endef
	.ln	4
	pea .LC0
	lea _printf,%a2
	jsr (%a2)
	.ln	5
	pea .LC1
	jsr (%a2)
	.ln	6
	sub.l %a2,%a2
	addq.w #8,%sp	-- this is desireable
..L5:
	.
	.
	.
Of interest is the addq.w #8,%sp before .L5:

When I compile it on the Win32 box, with the same switches, I get:

	.
	.
	.
main:
	.def	.bf;	.val	.;	.scl	101;	.line	5;	.endef
	link.w %a6,#0
	move.l %a2,-(%sp)
	jsr __main
	.ln	2
	.def	i;	.val	10;	.scl	4;	.type	04;	.endef
	.ln	4
	pea .LC0
	lea printf,%a2
	jsr (%a2)
	.ln	5
	pea .LC1
	jsr (%a2)
	.ln	6
	sub.l %a2,%a2
	addq.l #8,%sp
	.even
..L5:
 	.
	.
	.

Note the "addq.l #8,%sp" followed by the ".even" directive.  The 16 bit 
add has been changed to a 32 bit add (I know that all adds to address 
registers turn into 32 bit results).  I would prefer the addq.w over the 
addq.l.  Also, the extra .even directive is disturbing.  Has anyone out 
there seen this before?  

If so, what am I doing wrong in my configuration?

Steve Hanka
[email-masked]

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".