diff options
author | Dmitry Klochkov <dmitry.klochkov@bell-sw.com> | 2025-09-09 12:06:25 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2025-09-09 12:06:25 +0200 |
commit | 7be4186c22f89a87fff048c28910f5d26a0f61ce (patch) | |
tree | 47e27879ae413474052b56a1edb3e397254a0c0e /gdb | |
parent | f87a66db645caf8cc0e6fc87b0c28c78a38af59b (diff) | |
download | binutils-7be4186c22f89a87fff048c28910f5d26a0f61ce.zip binutils-7be4186c22f89a87fff048c28910f5d26a0f61ce.tar.gz binutils-7be4186c22f89a87fff048c28910f5d26a0f61ce.tar.bz2 |
nm: fix treating an ifunc symbol as a stab if '--ifunc-chars=--' is given
If an ifunc symbol is processed in print_symbol(), a 'type' field of a
'syminfo' structure is set to any character specified by a user with an
'--ifunc-chars' option. But afterwards the 'type' field is used to
check whether a symbol is a stab in print_symbol_info_{bsd,sysv}()
functions in order to print additional stab related data. If the 'type'
field equals '-', a symbol is treated as a stab. If '--ifunc-chars=--'
is given, all ifunc symbols will be treated as stab symbols and
uninitialized stab related fields of the 'syminfo' structure will be
printed which can lead to segmentation fault.
To fix this, check if a symbol is a stab before override the 'type'
field. Also, add a test case for this fix.
PR binutils/32556
* nm.c (extended_symbol_info): Add is_stab.
(print_symbol): Check if a symbol is a stab.
(print_symbol_info_bsd): Use info->is_stab.
(print_symbol_info_sysv): Use info->is_stab.
* testsuite/binutils-all/nm.exp: Test nm --ifunc-chars=--.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32556
Fixes: e6f6aa8d184 ("Add option to nm to change the characters displayed for ifunc symbols")
Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com>
Diffstat (limited to 'gdb')
0 files changed, 0 insertions, 0 deletions