[Bug tools/32864] "eu-readelf: bad dynamic symbol" error on ELF without DT_VERSYM

2025-04-09 Thread cbytensky at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32864

--- Comment #1 from Constantine Bytensky  ---
Created attachment 16014
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16014&action=edit
Sample quick-and-dirty patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug tools/32864] New: "eu-readelf: bad dynamic symbol" error on ELF without DT_VERSYM

2025-04-09 Thread cbytensky at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32864

Bug ID: 32864
   Summary: "eu-readelf: bad dynamic symbol" error on ELF without
DT_VERSYM
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: cbytensky at gmail dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 16013
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16013&action=edit
sample program without DT_VERSYM

Overview:

eu-readelf prints error message "eu-readelf: bad dynamic symbol" on trying to
get symbol version info from ELF that doesn't have DT_VERSYM.

Steps to Reproduce:

1) Run sample program from bug attachment "hello_libc":

# eu-readelf -D --dyn-syms hello_libc

Actual Results:

0:   0 NOTYPE  LOCAL  DEFAULTUNDEF eu-readelf: bad
dynamic symbol

1:   0 FUNCGLOBAL DEFAULTUNDEF putseu-readelf:
bad dynamic symbol

Expected Results:

Same, but without "eu-readelf: bad dynamic symbol" message:

0:   0 NOTYPE  LOCAL  DEFAULTUNDEF 
1:   0 FUNCGLOBAL DEFAULTUNDEF puts

Build Date & Hardware: 

Linux localhost.localdomain 6.12.16-gentoo #2 SMP Fri Mar 14 14:18:41 IST 2025
x86_64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz GenuineIntel GNU/Linux

Additional Information:

In attachment there is quick-and-dirty patch that fixes this bug for me. I
believe that "elf_getdata_rawchunk" function returns non-NULL result on NULL
"offset" parameter and so if "offs[i_versym]" is "0" (there is no DT_VERSYM in
PT_DYNAMIC) function returns non-NULL result.

-- 
You are receiving this mail because:
You are on the CC list for the bug.