diff options
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 32a2d6d..ae5ff50 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12268,6 +12268,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (info->strip != strip_all || emit_relocs) { + bfd_boolean name_local_sections; + const char *name; + file_ptr off = elf_next_file_pos (abfd); _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); @@ -12290,10 +12293,15 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* Output a symbol for each section. We output these even if we are discarding local symbols, since they are used for relocs. These - symbols have no names. We store the index of each one in the - index field of the section, so that we can find it again when + symbols usually have no names. We store the index of each one in + the index field of the section, so that we can find it again when outputting relocs. */ + name_local_sections + = (bed->elf_backend_name_local_section_symbols + && bed->elf_backend_name_local_section_symbols (abfd)); + + name = NULL; elfsym.st_size = 0; elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); elfsym.st_other = 0; @@ -12308,7 +12316,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_shndx = i; if (!bfd_link_relocatable (info)) elfsym.st_value = o->vma; - if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, o, + if (name_local_sections) + name = o->name; + if (elf_link_output_symstrtab (&flinfo, name, &elfsym, o, NULL) != 1) goto error_return; } |