This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: elf64-ppc.c vs prelink problems
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 9 Jun 2003 22:48:50 +0930
- Subject: Re: elf64-ppc.c vs prelink problems
- References: <20030531221843.GN24872@sunsite.ms.mff.cuni.cz>
On Sun, Jun 01, 2003 at 12:18:43AM +0200, Jakub Jelinek wrote:
> b) ld seems to have problems with sh_offset values of emtpy .ctors/.dtors
> on ppc64 (certainly I have not seen it on any other architecture
> yet and already in several libs including ld64.so.1 on ppc64):
> [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
> [ 1] .hash HASH 00000000000000e8 0000e8 0000c0 04 A 2 0 8
> [ 2] .dynsym DYNSYM 00000000000001a8 0001a8 0002b8 18 A 3 12 8
> [ 3] .dynstr STRTAB 0000000000000460 000460 000040 00 A 0 0 1
> [ 4] .rela.dyn RELA 00000000000004a0 0004a0 000060 18 A 2 0 8
> [ 5] .rela.plt RELA 0000000000000500 000500 000030 18 A 2 f 8
> [ 6] .text PROGBITS 0000000000000530 000530 0000d8 00 AX 0 0 4
> [ 7] .data PROGBITS 0000000000010608 000608 000000 00 WA 0 0 1
> [ 8] .branch_lt PROGBITS 0000000000010608 000608 000000 00 WA 0 0 8
> [ 9] .opd PROGBITS 0000000000010608 000608 000030 00 WA 0 0 8
> [10] .dynamic DYNAMIC 0000000000010638 000638 000140 10 WA 3 0 8
> [11] .ctors PROGBITS 0000000000010778 000780 000000 00 W 0 0 1
> [12] .dtors PROGBITS 0000000000010778 000780 000000 00 W 0 0 1
> [13] .got PROGBITS 0000000000010778 000778 000008 08 WA 0 0 8
> [14] .sbss PROGBITS 0000000000010780 000780 000000 00 W 0 0 1
> [15] .plt NOBITS 0000000000010780 000780 000048 18 WA 0 0 8
> [16] .bss NOBITS 00000000000107c8 000780 000000 00 WA 0 0 1
> [17] .comment PROGBITS 0000000000000000 000780 000033 00 0 0 1
> [18] .shstrtab STRTAB 0000000000000000 0007b3 000091 00 0 0 1
> [19] .symtab SYMTAB 0000000000000000 000d88 000348 18 20 18 8
> [20] .strtab STRTAB 0000000000000000 0010d0 000052 00 0 0 1
> See that sh_offset values aren't monotonically increasing, which is something
> prelink doesn't like.
I've finally found time to look at this...
The problem is caused by a combination of factors.
a) ppc64 linker scripts PROVIDE some symbols inside .ctors and .dtors,
why, I'm not sure. It seems likely that we really don't need them.
This results in .ctors and .dtors always being present.
b) .ctors and .dtors with no input sections will not be marked ALLOC.
c) Code in elf.c:assign_file_positions_except_relocs assigns ALLOC
sections first, then non-ALLOC sections, resulting in the sh_offset
values we see.
Of these factors, we definitely don't want to change (c). (a) and (b)
could both be fixed, I suppose.
--
Alan Modra
IBM OzLabs - Linux Technology Centre