This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
o32 links ...
- To: Mark Mitchell <mark@codesourcery.com>, binutils@sourceware.cygnus.com
- Subject: o32 links ...
- From: Ralf Baechle <ralf@uni-koblenz.de>
- Date: Wed, 4 Aug 1999 20:36:34 +0200
I just tried to link ``main(){}'' under Linux and it somehow runs in an
endless loop:
Program received signal SIGINT, Interrupt.
0x4018c0 in __frame_state_for (pc_target=0x7fffff77, state_in=0x2acc1c08)
(gdb) info registers
zero at v0 v1 a0 a1 a2 a3
R0 00000000 0fb82ea0 00000000 00000000 00000000 00000000 00000000 00000000
t0 t1 t2 t3 t4 t5 t6 t7
R8 ffffffff 00000000 10000000 f7ffffff 08000000 04849145 7ffffa10 7ffffa0c
s0 s1 s2 s3 s4 s5 s6 s7
R16 0fb8b380 004006e0 7ffff9c0 7fffff77 2acc1c08 7fffff77 00000000 7fffe9a0
t8 jp k0 k1 gp sp fp ra
R24 7ffffa10 004018bc 7ffffe4c 00000000 100082f0 7ffffd20 7ffff700 004018c8
pc cause badvaddr lo hi fsr fir
004018c0 00000400 8df8b938 cccccccd 00000000 00000000 00002310
401898: afbf01f0 sw $ra,496($sp)
40189c: afbc01ec sw $gp,492($sp)
4018a0: afb201e0 sw $s2,480($sp)
4018a4: afb101dc sw $s1,476($sp)
4018a8: afb001d8 sw $s0,472($sp)
4018ac: 00a0a021 move $s4,$a1
4018b0: 8f998070 lw $t9,-32656($gp)
4018b4: 00000000 nop
4018b8: 27390e40 addiu $t9,$t9,3648
4018bc: 00000000 nop
^^^^^^^
This is where $25 points to.
4018c0: 0320f809 jalr $t9
4018c4: 00000000 nop
4018c8: 8fbc0010 lw $gp,16($sp)
4018cc: 00409021 move $s2,$v0
4018d0: 1240000c beqz $s2,401904 <__frame_state_for+0x8c>
4018d4: 02402021 move $a0,$s2
4018d8: 27a50018 addiu $a1,$sp,24
4018dc: 8f998070 lw $t9,-32656($gp)
4018e0: 00000000 nop
Here disassembly & relocations from libgcc.a, function __frame_state_for:
eb0: 8f990000 lw $t9,0($gp)
eb0: R_MIPS_GOT16 .text
eb4: 00000000 nop
eb8: 27390440 addiu $t9,$t9,1088
eb8: R_MIPS_LO16 .text
ebc: 00000000 nop
ec0: 0320f809 jalr $t9
The values inserted for the GOT16 / LO16 relocations in the final link
don't make any sense at all to me and are completly different from the
2.8.1 linker output.
The function is __frame_state_for() from egcs 1.0.3a frame.c as it's
trying to call the static function find_fde.
Is there some facility which allows dumping of the got's contents in a
reasonably informative format?
Hmm... The linker used to default to IRIX5-style shared libs which is
what Linux uses right now, just if this makes a difference.
This is today's CVS binutils + your elflink.h patch.
Ralf