ld: 'not enough room for program headers'
Antti Vahalummukka
ana@panda.kouvola.ksaok.fi
Mon Jun 30 16:26:00 GMT 1997
Hello all.
I assume that I am not the first to ask this question. But first some
facts:
[tm-ppc]$ uname -a
Linux ana 2.0.25 #2 Tue Nov 12 00:07:08 EET 1996 i586
[tm-ppc]$ powerpc-elf-ld -v
GNU ld version 2.8.1 (with BFD 2.8.1)
[tm-ppc]$ powerpc-elf-as -v
GNU assembler version 2.8.1 (powerpc-elf), using BFD version 2.8.1
file koe.s:
---------------------
.globl _start
_start:
addi r0,r0,0
ba hui
hui:
ba _start
-------------------------
[tm-ppc]$ powerpc-elf-as -mregnames -m403 koe.s -o koe.elf
Assembly works fine, nice...
But, what causes the gnu ld to act like this: (three examples follow,
note that only the address of text segment changes)
1)
[tm-ppc]$ powerpc-elf-ld -Ttext 0xffff8000 -o x.elf koe.elf
powerpc-elf-ld: x.elf: Not enough room for program headers (allocated 2, need 3)
powerpc-elf-ld: final link failed: Bad value
[tm-ppc]$
2)
[tm-ppc]$ powerpc-elf-ld -Ttext 0x0fff8000 -o x.elf koe.elf
koe.elf(.text+0x4): relocation truncated to fit: R_PPC_ADDR24 text
koe.elf(.text+0x8): relocation truncated to fit: R_PPC_ADDR24 text
[tm-ppc]$
3)
[tm-ppc]$ powerpc-elf-ld -Ttext 0x00ff8000 -o x.elf koe.elf
[tm-ppc]$
In example 3. ld works, but I really need to locate at 0xffff8000, not to
0x00ff8000.
How can I relocate to 0xffff8000? PowerPC reset vector is at 0xffffffc,
and would like to keep the ROM at 0xffff8000 ... 0xffffffff.
Also, what is the .got section on the following disassembly?
[tm-ppc]$ powerpc-elf-objdump --disassemble-all x.elf
x.elf: file format elf32-powerpc
Disassembly of section .text:
00ff8000 <_start>:
ff8000: 38 00 00 00 li r0,0
ff8004: 48 ff 80 0a ba ff8008 <hui>
00ff8008 <hui>:
ff8008: 48 ff 80 02 ba ff8000 <_start>
Disassembly of section .sdata2:
Disassembly of section .data:
Disassembly of section .got:
01038010 <.got>:
1038010: 4e 80 00 21 blrl
...
Disassembly of section .sdata:
[tm-ppc]$
Regards,
Ana
More information about the crossgcc
mailing list