This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld -Ttext 0x80000 causes ld.so segfault on ppc-unknown-linux-gnu
- To: ian at zembu dot com (Ian Lance Taylor)
- Subject: Re: ld -Ttext 0x80000 causes ld.so segfault on ppc-unknown-linux-gnu
- From: Anton Ertl <anton at a0 dot complang dot tuwien dot ac dot at>
- Date: Sun, 9 Jul 2000 19:40:25 +0200 (MET DST)
- Cc: alan at linuxcare dot com dot au, anton at mips dot complang dot tuwien dot ac dot at, binutils at sourceware dot cygnus dot com
- Reply-To: anton at mips dot complang dot tuwien dot ac dot at
Ian Lance Taylor wrote:
> -Ttext is documented to set the start of the .text section. It's not
> very useful for ELF. For ELF, we might want to invent a new option,
> which somehow sets the address of the entire text segment.
I don't know ELF enough to know what the difference between sections
and segments is, but the documentation for ld-2.9.1, as well as 000705
says that -Ttext sets the start address of the text segment.
Also, with ld-2.9.5 on ppc-unknown-linux-gnu -Ttext seems to influnce
the start address of the following sections: .text .init .fini .rodata
.sdata2, and, probably indirectly, .data etc:
[samhain:/bigben/home/anton/tmp:1004] gcc -O -Xlinker -Ttext -Xlinker 0x80000 xx
x.c
[samhain:/bigben/home/anton/tmp:1005] objdump -h
a.out: file format elf32-powerpc
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000001e0 00080000 00080000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .interp 0000000d 10000114 10000114 00020114 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .note.ABI-tag 00000020 10000130 10000130 00020130 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .hash 00000034 10000150 10000150 00020150 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .dynsym 00000080 10000184 10000184 00020184 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .dynstr 0000007d 10000204 10000204 00020204 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .gnu.version 00000010 10000282 10000282 00020282 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .gnu.version_r 00000020 10000294 10000294 00020294 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .rela.plt 0000003c 100002b4 100002b4 000202b4 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .init 00000028 000801e0 000801e0 000101e0 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
10 .fini 00000020 00080208 00080208 00010208 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .rodata 00000024 00080228 00080228 00010228 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
12 .sdata2 00000000 0008024c 0008024c 0001024c 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
13 .data 00000020 00090250 00090250 00010250 2**2
CONTENTS, ALLOC, LOAD, DATA
14 .eh_frame 00000004 00090270 00090270 00010270 2**2
CONTENTS, ALLOC, LOAD, DATA
15 .dynamic 000000a0 00090274 00090274 00010274 2**2
CONTENTS, ALLOC, LOAD, DATA
16 .ctors 00000008 00090314 00090314 00010314 2**2
CONTENTS, ALLOC, LOAD, DATA
17 .dtors 00000008 0009031c 0009031c 0001031c 2**2
CONTENTS, ALLOC, LOAD, DATA
18 .got 00000010 00090324 00090324 00010324 2**2
CONTENTS, ALLOC, LOAD, DATA
19 .sdata 00000000 00090334 00090334 00010334 2**2
CONTENTS, ALLOC, LOAD, DATA
20 .sbss 00000000 00090334 00090334 00010334 2**0
ALLOC
21 .plt 00000084 00090334 00090334 00010334 2**2
ALLOC, CODE
22 .bss 00000030 000903c0 000903c0 0001033c 2**2
ALLOC
23 .stab 00000744 00000000 00000000 000202f0 2**2
CONTENTS, READONLY, DEBUGGING
24 .stabstr 00001342 00000000 00000000 00020a34 2**0
CONTENTS, READONLY, DEBUGGING
25 .comment 0000013e 000903f0 000903f0 00021d76 2**0
CONTENTS, READONLY
My expectation wrt -Ttext is that the resulting binary works, and that
the executable code is behind, but not too far from the address given.
I.e., it should work like the ld script I created by setting
TEXT_START_ADDR in ld/emulparams/elf32ppc*.sh and running make.
- anton