Venerable Toolchain Gods:
Environment: gcc-3.2.2 + binutils 2.14
Simple program on the IOP. After linking, the addresses in the symbol table for everything in the .data section are wrong (they appear to be off by a factor of two-- double relocations?).
Needless to say, this makes debugging hard[er] and gdb gets way lost (imagine innocently using "p *some_ptr" when its address is wrong).
I've attached the program, output of nm and objdump.
Any ideas?
regards-
tjd
[code][broadq@mcv-1-1-1 netdisk]$ ps2-objdump -h -r -s -x foo
foo: file format elf32-littlemips
foo
architecture: mips:3000, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
Program Header:
0x70000080 off 0x00000074 vaddr 0x00000000 paddr 0x00000000 align 2**2
filesz 0x0000001b memsz 0x0000001b flags r--
LOAD off 0x00000090 vaddr 0x00000000 paddr 0x00000000 align 2**2
filesz 0x00000028 memsz 0x00000028 flags rwx
private flags = 0: [no abi set] [mips1] [not 32bitmode]
Sections:
Idx Name Size VMA LMA File off Algn
0 .iopmod 0000001b 00000000 00000000 00000074 2**2
CONTENTS, READONLY
1 .text 00000024 00000000 00000000 00000090 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 00000004 00000024 00000024 000000b4 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000000 00000028 00000028 000000b8 2**0
ALLOC
4 .pdr 00000020 00000030 00000030 000000b8 2**2
CONTENTS, RELOC, READONLY
5 .mdebug.eabi32 00000000 00000050 00000050 000000d8 2**0
CONTENTS, READONLY
6 .debug_info 00000059 00000050 00000050 000000d8 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
7 .debug_line 00000032 000000a9 000000a9 00000131 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
8 .debug_frame 00000038 000000dc 000000dc 00000164 2**2
CONTENTS, RELOC, READONLY, DEBUGGING
9 .debug_pubnames 00000025 00000114 00000114 0000019c 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
10 .debug_aranges 00000020 00000139 00000139 000001c1 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
11 .debug_str 0000004d 00000159 00000159 000001e1 2**0
CONTENTS, READONLY, DEBUGGING
12 .comment 00000012 000001a6 000001a6 0000022e 2**0
CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d .iopmod 00000000
00000000 l d .text 00000000
00000048 l d .data 00000000
00000050 l d .bss 00000000
00000060 l d .pdr 00000000
00000000 l d *ABS* 00000000
000000a0 l d .mdebug.eabi32 00000000
000000a0 l d .debug_info 00000000
00000000 l d *ABS* 00000000
00000152 l d .debug_line 00000000
00000000 l d *ABS* 00000000
000001b8 l d .debug_frame 00000000
00000000 l d *ABS* 00000000
00000228 l d .debug_pubnames 00000000
00000000 l d *ABS* 00000000
00000272 l d .debug_aranges 00000000
00000000 l d *ABS* 00000000
000002b2 l d .debug_str 00000000
0000034c l d .comment 00000000
00000000 l d *ABS* 00000000
00000000 l d *ABS* 00000000
00000000 l d *ABS* 00000000
00000000 l df *ABS* 00000000 foo.c
00000048 g O .data 00000004 tjd
00000028 g *ABS* 00000000 _fdata
00000028 g *ABS* 00000000 _etext
00008030 g *ABS* 00000000 _gp
00000030 g *ABS* 00000000 _bss_start
00000000 g *ABS* 00000000 _ftext
00000000 g F .text 00000024 _start
00000008 g *ABS* 00000000 _data_size
00000000 g *ABS* 00000000 _bss_size
00000030 g *ABS* 00000000 _edata
00000030 g *ABS* 00000000 _end
00000028 g *ABS* 00000000 _text_size
00000030 g *ABS* 00000000 _fbss
RELOCATION RECORDS FOR [.pdr]:
OFFSET TYPE VALUE
00000030 R_MIPS_32 _start
RELOCATION RECORDS FOR [.debug_info]:
OFFSET TYPE VALUE
00000056 R_MIPS_32 *ABS*
0000005c R_MIPS_32 .debug_line
00000060 R_MIPS_32 .text
00000064 R_MIPS_32 .text
00000068 R_MIPS_32 .debug_str
0000006c R_MIPS_32 .debug_str
00000070 R_MIPS_32 .debug_str
00000077 R_MIPS_32 .debug_str
00000081 R_MIPS_32 .text
00000085 R_MIPS_32 .text
00000089 R_MIPS_32 .debug_frame
000000a4 R_MIPS_32 tjd
RELOCATION RECORDS FOR [.debug_line]:
OFFSET TYPE VALUE
000000cf R_MIPS_32 .text
RELOCATION RECORDS FOR [.debug_frame]:
OFFSET TYPE VALUE
000000f0 R_MIPS_32 .debug_frame
000000f4 R_MIPS_32 .text
RELOCATION RECORDS FOR [.debug_pubnames]:
OFFSET TYPE VALUE
0000011a R_MIPS_32 .debug_info
RELOCATION RECORDS FOR [.debug_aranges]:
OFFSET TYPE VALUE
0000013f R_MIPS_32 .debug_info
00000149 R_MIPS_32 .text
Contents of section .iopmod:
0000 ffffffff 00000000 30800000 28000000 ........0...(...
0010 08000000 00000000 000000 ...........
Contents of section .text:
0000 f0ffbd27 0000beaf 21f0a003 21100000 ...'....!...!...
0010 21e8c003 0000be8f 1000bd27 0800e003 !..........'....
0020 00000000 ....
Contents of section .data:
0024 ea000000 ....
Contents of section .pdr:
0030 00000000 00000040 f0ffffff 00000000 .......@........
0040 00000000 10000000 1e000000 1f000000 ................
Contents of section .mdebug.eabi32:
Contents of section .debug_info:
0050 55000000 02000000 00000401 a9000000 U...............
0060 24000000 00000000 59010000 5f010000 $.......Y..._...
0070 90010000 0102019f 01000001 073f0000 .............?..
0080 00000000 00240000 00ec0000 00016e03 .....$........n.
0090 696e7400 04050474 6a640001 033f0000 int....tjd...?..
00a0 00010503 24000000 00 ....$....
Contents of section .debug_line:
00a9 2e000000 02001900 00000101 fb0e0a00 ................
00b9 01010101 00000001 00666f6f 2e630000 .........foo.c..
00c9 00000000 05020000 000015b8 48021400 ............H...
00d9 0101 ..
Contents of section .debug_frame:
00dc 0c000000 ffffffff 01000104 400c1d00 ............@...
00ec 24000000 dc000000 00000000 24000000 $...........$...
00fc 04040000 000e1004 04000000 111e7c04 ..............|.
010c 04000000 0c1e1000 ........
Contents of section .debug_pubnames:
0114 21000000 02005000 00005900 00002500 !.....P...Y...%.
0124 00005f73 74617274 00460000 00746a64 .._start.F...tjd
0134 00000000 00 .....
Contents of section .debug_aranges:
0139 1c000000 02005000 00000400 00000000 ......P.........
0149 00000000 24000000 00000000 00000000 ....$...........
Contents of section .debug_str:
0159 666f6f2e 63002f68 6f6d652f 62726f61 foo.c./home/broa
0169 64712f62 75696c64 732f3038 2d32362d dq/builds/08-26-
0179 32303034 2f707332 2d627569 6c642f6e 2004/ps2-build/n
0189 65746469 736b0047 4e552043 20332e32 etdisk.GNU C 3.2
0199 2e32202d 67005f73 74617274 00 .2 -g._start.
Contents of section .comment:
01a6 00474343 3a202847 4e552920 332e322e .GCC: (GNU) 3.2.
01b6 3200 2.
[broadq@mcv-1-1-1 netdisk]$ ps2-nm foo
00000000 A _bss_size
00000030 A _bss_start
00000008 A _data_size
00000030 A _edata
00000030 A _end
00000028 A _etext
00000030 A _fbss
00000028 A _fdata
00000000 A _ftext
00008030 A _gp
00000000 T _start
00000028 A _text_size
00000048 D tjd
[broadq@mcv-1-1-1 netdisk]$ cat foo.c
int tjd = 234;
int
_start()
{
return 0;
}
[broadq@mcv-1-1-1 netdisk]$[/code]