aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-10-01 14:08:08 +0930
committerAlan Modra <amodra@gmail.com>2024-10-03 12:31:45 +0930
commit68bbe118337939aa0b52e007a7415c8a157579a1 (patch)
tree71b25a79d7662c93097e0e1dddf34de5f69fcf28 /ld
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-68bbe118337939aa0b52e007a7415c8a157579a1.tar.gz
binutils-gdb-68bbe118337939aa0b52e007a7415c8a157579a1.tar.bz2
binutils-gdb-68bbe118337939aa0b52e007a7415c8a157579a1.zip
Don't return "(null)" from bfd_elf_sym_name
A NULL return from bfd_elf_string_from_elf_section indicates an error. That shouldn't be masked by bfd_elf_sym_name but rather passed up to callers such as group_signature. If we want to print "(null)" then that should be done at a higher level. That's what this patch does, except that I chose to print "<null>" instead, like readelf. If we see "(null)" we're probably passing a NULL to printf. I haven't changed aoutx.h or pdp11.c print_symbol functions because they already handle NULL names by omitting the name. I also haven't changed mach-o.c, mmo.c, som.c, srec.c, tekhex.c, vms-alpha.c and wasm-module.c print_symbol function because it looks like they will never have NULL symbol names. bfd/ * elf.c (bfd_elf_sym_name): Don't turn a NULL name into a pointer to "(null)". (bfd_elf_print_symbol): Print "<null>" for NULL symbol names. * coffgen.c (coff_print_symbol): Likewise. * ecoff.c (_bfd_ecoff_print_symbol): Likewise. * pef.c (bfd_pef_print_symbol): Likewise. * syms.c (bfd_symbol_info): Return "<null>" in symbol_info.name if symbol name is NULL. ld/ * ldlang.c (ld_is_local_symbol): Don't check for "(null)" symbol name.
Diffstat (limited to 'ld')
-rw-r--r--ld/ldlang.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 7f9e3d2b119..343c4de53f4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4895,9 +4895,6 @@ ld_is_local_symbol (asymbol * sym)
if (name == NULL || *name == 0)
return false;
- if (strcmp (name, "(null)") == 0)
- return false;
-
/* Skip .Lxxx and such like. */
if (bfd_is_local_label (link_info.output_bfd, sym))
return false;