🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #271

GCC on a MIPS Magnum with RISCos 5.0

#271
From: andy
Date: Sat, 25 Jul 1992 22:46
130 lines
3339 bytes
Hello there !

I am trying to get the GCC 1.40 (as distributed by MIPS
on a PD-Tape) running on my Magnum 3000/33 with RiscOs 5.0.
My final intention is to use the GCC as a mc68k-crosscompiler,
but to check if I am able to compile and run GCC at all,
I decided to first compile it as it should be.

I invoked config.gcc with the `mips-sysv' option.
For error-free compiling I had to add the -systype svr3
(mips-)compiler-flag, #include <unistd.h> instead of
<sys/file.h> and finally add `-lc and -lbsd' to the
CLIB-variable.
Compilation in a separate directory was not possible
because the Mips-compiler could not find some files.
(Sorry, I don't remember which ones).

But that's not my real problem.

After some `trial and error' I was able to compile it,
and GCC seems to work. I am now able to generate .s and
.o files, but the Mips-linker says:

ABI incompatible stack frame instruction sequence in object hello.o,
instruction 0x27bdfff0

The mentioned instruction is:
	subu	$sp,$sp,16

I found out, that the Mips-cc allocates a stack frame of 32 bytes,
in contrast to the gcc, which allocates only 16 bytes. I assume
that this is the problem (hopefully the only one).

I include the .s files at the end of my mail,
first the mips-cc output, then the gcc-output.

Now my questions:

1. Are there any fixes to solve this problem ?
2. If not, what must I change ?
3. Is there a GNU-linker available ?
4. Do you have experience with using GCC as
   a crosscompiler ? Are there any `specials'
   to take care about ?

I hope you can help me !
Thank you very much,
Yours,

Andreas Busse
andy@wegy.uucp

P.S.: Sorry for my rather bad English !

-----------------------------------------------------------

OUTPUT OF THE MIPS-COMPILER

	.verstamp	3 0
	.data	
	.align	2
	.align	0
$$5:
	.ascii	"hello world!\X0A\X00"
	.text	
	.align	2
	.file	2 "hello.c"
	.globl	main
	.loc	2 3
 #   1	
 #   2	int main()
 #   3	{
	.ent	main 2
main:
	.option	O1
	subu	$sp, 32
	sw	$31, 28($sp)
	.mask	0x80000000, -4
	.frame	$sp, 32, $31
	.loc	2 3
	.loc	2 4
 #   4	  printf("hello world!\n");
	la	$4, $$5
	.livereg	0x0800000E,0x00000000
	jal	printf
	.loc	2 5
 #   5	}
	move	$2, $0
	.livereg	0x2000FF0E,0x00000FFF
	lw	$31, 28($sp)
	addu	$sp, 32
	j	$31
	.end	main

-------------------------------------------------------------

OUTPUT OF GCC 1.40

	.file	1 "hello.c"
	.data
gcc_compiled.:
	.rdata
$LC0:
	.ascii	"hello world!\n\000"
	.text
	.align	2
	.globl	main
	.ent	main
main:
 #PROLOGUE
	subu	$sp,$sp,16	# temp= 0, regs= 8, args= 0, sfo= -8
	.frame	$fp,0,$31
	sw	$fp,0($sp)
	sw	$31,4($sp)
	.mask	0xc0000000,-12
	.fmask	0x00000000,-12
	addu	$fp,$sp,16	# set up frame pointer
 #END PROLOGUE
	subu	$sp,$sp,16
	la	$4,$LC0
	jal	printf
$L1:
 #EPILOGUE
	subu	$sp,$fp,16	# sp not trusted  here
	lw	$fp,0($sp)
	lw	$31,4($sp)
	addu	$sp,$sp,16
	j	$31
 #END EPILOGUE
	.end	main
Technical Details
Message-ID: <9207251846.AA14639@mail.Germany.EU.net>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wegy.UUCP!andy

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wegy.UUCP!andy
From: andy@wegy.UUCP
Subject: GCC on a MIPS Magnum with RISCos 5.0
Message-ID: <9207251846.AA14639@mail.Germany.EU.net>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 25 Jul 1992 22:46:11 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 132