Subject: Re: cross Mips64-linux binutils problem

From: Ulf Carlsson <[email-masked]>
Date: Thu, 1 Jun 2000 01:04:40 -0700 (PDT)

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

You can check out the CVS repository on sourceware.cygnus.com from 000424.  I
think I told you how to do it.  I haven't been working with my binutils
patches much this month, but I will probably verify them again soon.

> crt0s.s:7: Internal error, aborting at /../binutils-000524/gas/config/tc-mips.c line 4364 in macro

I've actually explicitly put an arort() there.  If you look at line line 4364
there's a comment that explains why the abort() is there.  It can be fixed,
but someone still has to do it.  For now, just use -G 0.

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

I don't know what you're doing wrong.  I could objdump it just fine.  I
haven't tested with IRIX.

$ ../binutils/objdump -dr jimi-testcase.o 

test.o:     file format elf64-littlemips

Disassembly of section .text:

0000000000000000 <_start>:
   0:   3c1d0000        lui     $sp,0x0
                        0: R_MIPS_HIGHEST       kernelInfoLocal
   4:   67bd0000        daddiu  $sp,$sp,0
                        4: R_MIPS_HIGHER        kernelInfoLocal
   8:   001dec38        dsll    $sp,$sp,0x10
   c:   67bd0000        daddiu  $sp,$sp,0
                        c: R_MIPS_HI16  kernelInfoLocal
  10:   001dec38        dsll    $sp,$sp,0x10
  14:   67bd0000        daddiu  $sp,$sp,0
                        14: R_MIPS_LO16 kernelInfoLocal
  18:   dfbd0000        ld      $sp,0($sp)
  1c:   67bd6000        daddiu  $sp,$sp,24576
  20:   3c190000        lui     $t9,0x0
                        20: R_MIPS_HIGHEST      crtInit
  24:   67390000        daddiu  $t9,$t9,0
                        24: R_MIPS_HIGHER       crtInit
  28:   0019cc38        dsll    $t9,$t9,0x10
  2c:   67390000        daddiu  $t9,$t9,0
                        2c: R_MIPS_HI16 crtInit
  30:   0019cc38        dsll    $t9,$t9,0x10
  34:   67390000        daddiu  $t9,$t9,0
                        34: R_MIPS_LO16 crtInit
  38:   03200008        jr      $t9
  3c:   00000000        nop
  40:   03e00008        jr      $ra
        ...

I can't see anything that's obviously wrong with the assembler output either
so it should be fine.

> 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

We can use both RELA and REL relocations in the 64-bit ABI.  IRIX as tends to
switch from one to another.

Ulf

---

From: [email-masked] (Jimi X)
Date: Thu, 1 Jun 2000 10:21:50 -0400 (EDT)

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

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

 UC> I don't know what you're doing wrong.  I could objdump it just
 UC> fine.  I haven't tested with IRIX.

How did you run the assembler? I'm using "as-new -64 -mips3 -G0", is
there more?

 UC> $ ../binutils/objdump -dr jimi-testcase.o

 UC> test.o: file format elf64-littlemips

hmmm.. Are you defaulting to elf64-littlemips? I had tried to do this
using '-EL' option but it doesn't seem to make the switch and I still
have problems.

I'll get a hold of the same snapshot you are using and add the patch
and see if it works any better.

-Jimi X

---

From: [email-masked] (Jimi X)
Date: Thu, 1 Jun 2000 11:05:28 -0400 (EDT)

>>>>> "RB" == Ralf Baechle <[email-masked]> writes:

 RB> On Thu, Jun 01, 2000 at 10:21:50AM -0400, Jimi X wrote:
 >>
 >> How did you run the assembler? I'm using "as-new -64 -mips3 -G0",
 >> is there more?

 RB> Are you trying to assemble pic code?  I think that's still very
 RB> broken in binutils even with all of Ulf's fixes.

No I'm not trying to use PIC code.
I made a braino on the assembler line, I'm using:
	as-new -64 -mips3 -G0 -non_shared
I've tries just about every combination.

-Jimi X

BTW: For those of you who do not have my test source, here it is:

.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