Q: ld scripts for multisegment ELF dynamic executables?

Alan Modra alan@linuxcare.com.au
Sun Feb 25 13:47:00 GMT 2001


On Sun, 25 Feb 2001, Basile STARYNKEVITCH wrote:

>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R   0x4
>   INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1
>       [Requesting program interpreter: /lib/ld-linux.so.2]
>   LOAD           0x000000 0x08048000 0x08048000 0x01d60 0x01d60 R E 0x1000
>   LOAD           0x002a00 0x08049a00 0x08049a00 0x00104 0x002c8 RW  0x1000
>   DYNAMIC        0x002a60 0x08049c20 0x08049c20 0x000a8 0x000a8 RW  0x4
>   NOTE           0x001cc8 0x08049cc8 0x08049cc8 0x00098 0x00098 R   0x4
>   LOAD           0x003000 0x60000000 0x60000000 0x00010 0x00010 R E 0x1000
>   LOAD           0x004000 0x70000000 0x70000000 0x00004 0x00004 RWE 0x1000
> 
>  Section to Segment mapping:
>   Segment Sections...
>    00     
>    01     .interp 
>    02     .interp .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.got .rel.bss .rel.plt .init .plt .text .fini .rodata .data .eh_frame .ctors .dtors .got .bss .dynamic .note 
>    03     .data .eh_frame .ctors .dtors .got .bss .dynamic 
>    04     .dynamic 
>    05     .note 
>    06     TEXTHEAP 
>    07     DATAHEAP 
> 
> this file still core dumps.

One problem I can see with the above, is that .note.ABI-tag (included with
.note due to your ldscript) is now too far away from the start of the
file.  You need this section in the first page of the executable. (*)  Try
adding a .note-ABI-tag output section immediately after .interp
in your SECTIONS command.

(*) At least this used to be the case with linux.  It's quite possible
that this requirement has changed.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.



More information about the Binutils mailing list