aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-07-30 21:34:44 +0000
committerRichard Henderson <rth@redhat.com>1999-07-30 21:34:44 +0000
commit587ff49e9a50b61e86ea78ba3271f3ca24c1b0e8 (patch)
treec5de899ca7fe15148721af69c6bae1b9f03810ea /bfd/elflink.h
parentd512aa072eb56b1fb1a5f1649b8c52a140901916 (diff)
downloadgdb-587ff49e9a50b61e86ea78ba3271f3ca24c1b0e8.zip
gdb-587ff49e9a50b61e86ea78ba3271f3ca24c1b0e8.tar.gz
gdb-587ff49e9a50b61e86ea78ba3271f3ca24c1b0e8.tar.bz2
Jakub Jelinek <jj@ultra.linux.cz>
* elf-bfd.h (struct elf_backend_data): Add print_symbol_all and output_arch_syms backend methods. * elfxx-target.h: Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create, sparc64_elf_add_symbol_hook, sparc64_elf_output_arch_syms, sparc64_elf_get_symbol_type, sparc64_elf_symbol_processing): New functions. (sparc64_elf_size_dynamic_sections): Leave space for STT_REGISTER symbols in .dynsym, add their names into .dynstr. Put those symbols into dynlocal. (sparc64_elf_finish_dynamic_sections): Fix up DT_SPARC_REGISTER pointers to STT_REGISTER symbols in dynsym section. (sparc64_elf_print_symbol_all): New function. * elf.c (bfd_elf_print_symbol): Allow special backend symbol printing using the print_symbol_all hook.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h44
1 files changed, 33 insertions, 11 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 6fb9bba..cfb4909 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -2116,6 +2116,10 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
entry->input_indx = input_indx;
eht->dynsymcount++;
+ /* Whatever binding the symbol had before, it's now local. */
+ entry->isym.st_info
+ = ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info));
+
/* The dynindx will be set at the end of size_dynamic_sections. */
return true;
@@ -4253,16 +4257,22 @@ elf_bfd_final_link (abfd, info)
the original st_name with the dynstr_index. */
sym.st_name = e->isym.st_name;
- /* Whatever binding the symbol had before, it's now local. */
- sym.st_info = ELF_ST_INFO (STB_LOCAL,
- ELF_ST_TYPE (e->isym.st_info));
-
- s = bfd_section_from_elf_index (e->input_bfd, e->isym.st_shndx);
-
- sym.st_shndx = elf_section_data (s->output_section)->this_idx;
- sym.st_value = (s->output_section->vma
- + s->output_offset
- + e->isym.st_value);
+ if (e->isym.st_shndx == 0 || e->isym.st_shndx >= SHN_LORESERVE)
+ {
+ sym.st_shndx = e->isym.st_shndx;
+ sym.st_value = e->isym.st_value;
+ }
+ else
+ {
+ s = bfd_section_from_elf_index (e->input_bfd,
+ e->isym.st_shndx);
+
+ sym.st_shndx =
+ elf_section_data (s->output_section)->this_idx;
+ sym.st_value = (s->output_section->vma
+ + s->output_offset
+ + e->isym.st_value);
+ }
if (last_local < e->dynindx)
last_local = e->dynindx;
@@ -4272,7 +4282,7 @@ elf_bfd_final_link (abfd, info)
}
elf_section_data (finfo.dynsym_sec->output_section)
- ->this_hdr.sh_info = last_local;
+ ->this_hdr.sh_info = last_local + 1;
}
/* We get the global symbols from the hash table. */
@@ -4284,6 +4294,18 @@ elf_bfd_final_link (abfd, info)
if (eoinfo.failed)
return false;
+ /* If backend needs to output some symbols not present in the hash
+ table, do it now. */
+ if (bed->elf_backend_output_arch_syms)
+ {
+ if (! (*bed->elf_backend_output_arch_syms)
+ (abfd, info, (PTR) &finfo,
+ (boolean (*) PARAMS ((PTR, const char *,
+ Elf_Internal_Sym *, asection *)))
+ elf_link_output_sym))
+ return false;
+ }
+
/* Flush all symbols to the file. */
if (! elf_link_flush_output_syms (&finfo))
return false;