diff options
author | Alan Modra <amodra@gmail.com> | 2024-10-08 10:05:39 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-10-08 15:12:19 +1030 |
commit | 124deb310116982fbd921ab1dc83fa75a8252391 (patch) | |
tree | 8a21c057e3103c2d33e1741b483af9df64292024 /bfd/elfnn-riscv.c | |
parent | cc516199d64768b32bc4f8572ade82b4865eccfa (diff) | |
download | gdb-124deb310116982fbd921ab1dc83fa75a8252391.zip gdb-124deb310116982fbd921ab1dc83fa75a8252391.tar.gz gdb-124deb310116982fbd921ab1dc83fa75a8252391.tar.bz2 |
Revised "Don't return (null) from bfd_elf_sym_name"
Commit 68bbe1183379 results in a lot of follow up work, much of which
likely is still to be done. (And yes, since this is all for corrupted
or fuzzed object files, a whole lot of work doesn't much benefit
anyone. It was a bad idea to put NULL in asymbol->name.) So I'm
changing the approach to instead put a unique empty string for symbols
with a corrupted st_name. An empty string won't require much work to
ensure nm, objcopy, objdump etc. won't crash, since these tools
already must work with unnamed local symbols.
The unique empty string is called bfd_symbol_error_name. This patch
uses that name string for corrupted symbols in the ELF and COFF
backends. Such symbols are displayed by nm and objdump as the
translated string "<corrupt>", which is what the COFF backend used to
put directly into corrupted symbols.
ie. it's the way I should have written the original patch, plus a few
tides and cleanups I retained from the reverted patches.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r-- | bfd/elfnn-riscv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 90ecc27..c8bf45f 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -5612,7 +5612,7 @@ riscv_elf_is_target_special_symbol (bfd *abfd, asymbol *sym) { /* PR27584, local and empty symbols. Since they are usually generated for pcrel relocations. */ - return (!strcmp (sym->name, "") + return (!sym->name[0] || _bfd_elf_is_local_label_name (abfd, sym->name) /* PR27916, mapping symbols. */ || riscv_elf_is_mapping_symbols (sym->name)); |