Subject: cross Mips64-linux binutils problem

From: [email-masked] (Jimi X)
Date: Wed, 24 May 2000 16:34:35 -0400 (EDT)

I hope this isn't a repeat but the archive has been down for a few days:
  http://www.linux.sgi.com/mips/archive/

I'm using binutils-19990825 patched with binutils-19991011.diff

They were obtained from:
  ftp://ftp.linux.sgi.com/pub/linux/mips/crossdev/src/mips64/

Are these the latest? If so please read on..

I have built them for cross-compiling on AIX.
Here is the configure invocation:
  ./configure --host=powerpc-ibm-aix4.3.2.0 --target=mips64-unknown-linux-gnu

All built and installed fine, however the linker halts using the .o's
because on an unknoen relocation.

The following assembler:
.text
	.align 4
.ent  _start , 0
	.globl    _start
_start:  
	dla	$sp, kernelInfoLocal
	ld	$sp, 0($sp) 
	daddu	$sp, $sp, 0x6000
	dla	$25, crtInit  
	j	$25 
 #  NOTREACHED
	j	ra 	 
.end   _start

on irix:
  $ as -version
  MIPSpro Compilers: Version 7.2.1

  $ as -64 -non_shared -mips3 crt0s.s -o crt0s.o

on aix:
  $ mips64-unknown-linux-gnu-objdump -r crt0s.o

  crt0s.o:     file format elf64-bigmips
...
successfully dumps the relocation information.

if I compiler the same file in aix:
  $ mips64-unknown-linux-gnu-as -64 -mips3 -non_shared crt0s.s -o crt0s.o
  $ mips64-unknown-linux-gnu-objdump -r crt0s.o

  crt0s.o:     file format elf64-bigmips

  mips64-unknown-linux-gnu-objdump: crt0s.o: File in wrong format
RELOCATION RECORDS FOR [.text]:

-Jimi X

---

From: Ulf Carlsson <[email-masked]>
Date: Wed, 24 May 2000 16:52:02 -0700 (PDT)

> I'm using binutils-19990825 patched with binutils-19991011.diff

I have used that patch together with the binutils CVS from 19991011 and that
worked for me.  At least for building 32-bit kernel.

> Are these the latest? If so please read on..

You could try my superpatch that I have on oss.sgi.com.  It's a newer than
Ralf's patch that you have:

	ftp://oss.sgi.com/pub/linux/mips/src/binutils/binutils-000424.diff.gz

It's against the official binutils CVS for the same day.

> RELOCATION RECORDS FOR [.text]:

The relocation format for mips64 is very different, and they aren't handled
correctly in this version of binutils.  I think my later patch fixes this. By
the way, compiling 64-bit PIC code using gas is not recommended (yet).

Ulf

---

From: [email-masked] (Jimi X)
Date: Thu, 25 May 2000 10:59:36 -0400 (EDT)

>>>>> "UC" == Ulf Carlsson <[email-masked]> writes:

 >> I'm using binutils-19990825 patched with binutils-19991011.diff
 UC> I have used that patch together with the binutils CVS from
 UC> 19991011 and that worked for me.  At least for building 32-bit
 UC> kernel.

Well, I'm only interested in 64-bit static only. I'm not ready for
shared yet either.

 >> Are these the latest? If so please read on..

 UC> You could try my superpatch that I have on oss.sgi.com.  It's a
 UC> newer than Ralf's patch that you have:

 UC>
 UC> 	ftp://oss.sgi.com/pub/linux/mips/src/binutils/binutils-000424.diff.gz

thanks I will try and let you know.

BTW: what are your people using to build the mip64 linux kernel changes 
that went in a few months ago?

-Jimi X

---

From: [email-masked] (Jimi X)
Date: Fri, 26 May 2000 10:02:11 -0400 (EDT)

I forward ported your patch to binutils-000524 since I could not get
my hands on 000524. 

  $ /../mips-000524/gas/as-new -64 -mips3 -non_shared  crt0s.s -o crt0s.o
  crt0s.s: Assembler messages:
  crt0s.s:7: Internal error, aborting at /../binutils-000524/gas/config/tc-mips.c line 4364 in macro
  Please report this bug.

The line may not match because of the different base snapshot but it
certainly comes from line 1427 of the patch.

If I add a -G 0 (which is how I normaly build anyway) then the assembler
does not complain.

However, my relocations seem messed up! objdump fails reading them,
IRIX elfdump seems confused though readelf seems to handle it fine.

Here is the source again:

.text
	.align 4
.ent  _start , 0
	.globl _start
_start:  
	dla	$sp, kernelInfoLocal
	ld	$sp, 0($sp) 
	daddu	$sp, $sp, 0x6000

	dla	$25, crtInit  
	j	$25 
 #  NOTREACHED
	j	$31 	 
.end   _start

An interesing item (but may be a red herring) is that IRIX as(1) places
R_MIPS_LO16 relocations int the .rel.text section, and gas(1) places
them (an all relocations) in .rela.text

I'm assuming that if objdump can't read my .o's then the gld(1)
probably can't either. Does that make sense?

Any ideas?

-Jimi X