delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/03/12/05:38:13

From: shanka AT aros DOT net (Steve Hanka)
Subject: Cygwin32 cross-compiler (to m68k)
12 Mar 1998 05:38:13 -0800 :
Message-ID: <199803111639.JAA07514.cygnus.gnu-win32@shell.aros.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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
shanka AT aros DOT net

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019