Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-readelf fails to report > 65535 segments #132216

Open
emaste opened this issue Mar 20, 2025 · 0 comments
Open

llvm-readelf fails to report > 65535 segments #132216

emaste opened this issue Mar 20, 2025 · 0 comments

Comments

@emaste
Copy link
Member

emaste commented Mar 20, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants