diff options
author | Alan Modra <amodra@gmail.com> | 2024-10-08 09:48:08 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-10-08 15:12:14 +1030 |
commit | e8859e49472743b974eac2ae2f9682ef3a3209a4 (patch) | |
tree | 527f60d69969a2be84748ed9551d4dbba417d51b | |
parent | 22ad34b314b4597d6fb9a261891726c8d94f2893 (diff) | |
download | gdb-e8859e49472743b974eac2ae2f9682ef3a3209a4.zip gdb-e8859e49472743b974eac2ae2f9682ef3a3209a4.tar.gz gdb-e8859e49472743b974eac2ae2f9682ef3a3209a4.tar.bz2 |
Revert "elf.c and elflink.c fixes for commit 68bbe1183379"
This reverts commit 389fdfbe0d2aca0af1431ddf34704534dacc48c8.
-rw-r--r-- | bfd/elf.c | 18 | ||||
-rw-r--r-- | bfd/elflink.c | 24 |
2 files changed, 16 insertions, 26 deletions
@@ -8734,21 +8734,21 @@ swap_out_syms (bfd *abfd, Elf_Internal_Sym sym; flagword flags = syms[idx]->flags; - if (syms[idx]->name == NULL - || (!name_local_sections - && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)) + if (!name_local_sections + && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM) { /* Local section symbols have no name. */ - sym.st_name = 0; + sym.st_name = (unsigned long) -1; } else { /* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize to get the final offset for st_name. */ - size_t stridx = _bfd_elf_strtab_add (stt, syms[idx]->name, false); - if (stridx == (size_t) -1) + sym.st_name + = (unsigned long) _bfd_elf_strtab_add (stt, syms[idx]->name, + false); + if (sym.st_name == (unsigned long) -1) goto error_return; - sym.st_name = stridx; } bfd_vma value = syms[idx]->value; @@ -8959,7 +8959,9 @@ Unable to handle section index %x in ELF symbol. Using ABS instead."), for (idx = 0; idx < outbound_syms_index; idx++) { struct elf_sym_strtab *elfsym = &symstrtab[idx]; - if (elfsym->sym.st_name != 0) + if (elfsym->sym.st_name == (unsigned long) -1) + elfsym->sym.st_name = 0; + else elfsym->sym.st_name = _bfd_elf_strtab_offset (stt, elfsym->sym.st_name); if (info && info->callbacks->ctf_new_symbol) diff --git a/bfd/elflink.c b/bfd/elflink.c index a498dbb..9eb1122 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -8819,8 +8819,6 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, symp->name = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, ssym->st_name); - if (symp->name == NULL) - goto done; symp++; } @@ -8834,8 +8832,6 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, symp->name = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, ssym->st_name); - if (symp->name == NULL) - goto done; symp++; } @@ -8882,22 +8878,14 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, goto done; for (i = 0; i < count1; i++) - { - symtable1[i].name - = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, - symtable1[i].u.isym->st_name); - if (symtable1[i].name == NULL) - goto done; - } + symtable1[i].name + = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, + symtable1[i].u.isym->st_name); for (i = 0; i < count2; i++) - { - symtable2[i].name - = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, - symtable2[i].u.isym->st_name); - if (symtable2[i].name == NULL) - goto done; - } + symtable2[i].name + = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, + symtable2[i].u.isym->st_name); /* Sort symbol by name. */ qsort (symtable1, count1, sizeof (struct elf_symbol), |