This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Hints on investigating 'invalid ELF header' on ia64-hp-openvms
- From: "h.becker" <becker dot ismaning at freenet dot de>
- To: binutils at sourceware dot org
- Date: Thu, 30 Jul 2015 13:45:50 +0200
- Subject: Re: Hints on investigating 'invalid ELF header' on ia64-hp-openvms
- Authentication-results: sourceware.org; auth=none
- References: <55B89426 dot 9090105 at adalabs dot com> <55B8EED3 dot 6050606 at freenet dot de> <55BA0199 dot 7020506 at adalabs dot com>
On 07/30/2015 12:51 PM, David SAUVAGE - AdaLabs Ltd wrote:
> [1] $ readelf -a simple.o
> ELF Header:
> Magic: 7f 45 4c 46 02 01 01 0d 02 00 00 00 00 00 00 00
> Class: ELF64
> Data: 2's complement, little endian
> Version: 1 (current)
> OS/ABI: VMS - OpenVMS
> ABI Version: 2
> Type: REL (Relocatable file)
> Machine: Intel IA-64
> Version: 0x1
> Entry point address: 0x0
> Start of program headers: 0 (bytes into file)
> Start of section headers: 496 (bytes into file)
> Flags: 0x1000010, 64-bit
> Size of this header: 72 (bytes)
> Size of program headers: 0 (bytes)
> Number of program headers: 0
> Size of section headers: 64 (bytes)
> Number of section headers: 13
> Section header string table index: 10
I would have expected the size of the ELF header to be 64 bytes. But I
doubt that this causes the shown linker error message.
As you probably observed, the linker printed "'ehdr$b_ei_mag0' has
invalid value %X00": it gets a zero byte where it expects a magic value
of 0x7f. From your readelf output the magic value is correct (and
analyze/object thinks so, too). So I suspect there are (zero) bytes
after the end of the module.
>
> [2] $ analyze/object simple.o
>
> [...] skipped
>
> This is an OpenVMS IA64 (Elf format) object file
>
> Elf Header Information, at file address 0.
>
> Class: ELF-64
> Data: Little-endian byte order
> Elf Header Version: 1.
> OS ABI: OpenVMS
> OS ABI Version: 2.
> Type: Object
> Machine Architecture: IA_64
> Elf File Version: 1.
> VMS Completion Code: SUCCESS
>
> [...] skipped
To get all the details of the elf header you may want to add a /header
to the command. But I doubt that analyze will recognize that there is no
valid ELF header after the first object module.