Open
Description
From FreeBSD bug 285547 a regression test started failing after we switched to LLVM's binutils replacements.
The test creates an ELF core file with more than 65535 segments (test source code). llvm-readelf reports 65535 program headers.
GNU readelf:
$ /usr/local/bin/readelf -h ./coredump_phnum_help.core
ELF Header:
Magic: 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - FreeBSD
ABI Version: 0
Type: CORE (Core file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x0
Start of program headers: 64 (bytes into file)
Start of section headers: 3726864 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 65535 (66550)
Size of section headers: 64 (bytes)
Number of section headers: 1
Section header string table index: 0
llvm-readelf:
$ readelf -h ./coredump_phnum_help.core
ELF Header:
Magic: 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - FreeBSD
ABI Version: 0
Type: CORE (Core file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x0
Start of program headers: 64 (bytes into file)
Start of section headers: 3726864 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 65535
Size of section headers: 64 (bytes)
Number of section headers: 1
Section header string table index: 0
Support added to FreeBSD's copy of ELF Tool Chain: freebsd/freebsd-src@714935b