diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-05-09 16:58:36 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-05-09 16:58:36 +0000 |
commit | 6ec3bb6a753eff70b112218201f42b8bb83ab271 (patch) | |
tree | f3baf684ccc6dddf766409797e44fc7b274b2f35 /bfd/elf32-target.h | |
parent | c1124600ada9a3900c296d01f6ab365f5de4e852 (diff) | |
download | gdb-6ec3bb6a753eff70b112218201f42b8bb83ab271.zip gdb-6ec3bb6a753eff70b112218201f42b8bb83ab271.tar.gz gdb-6ec3bb6a753eff70b112218201f42b8bb83ab271.tar.bz2 |
* elfcode.h: Include bfdlink.h. Added several new functions to do
linking.
(ELF_R_TYPE): Define.
(bfd_add_to_strtab): Return unsigned long. Change check for
realloc failure.
(elf_fake_sections): Check return value of bfd_add_to_strtab.
(elf_compute_section_file_positions): Add link_info argument.
Call elf_backend_begin_write_processing hook and prep_headers
here. Only call swap_out_syms if link_info is NULL. Set up
.shstrtab section here. Pass dosyms argument to
assign_file_positions_except_relocs. Set output_has_begun flag.
(assign_file_positions_for_symtab_and_strtabs): Add dosyms
argument, and use it to control setting .symtab and .strtab file
positions.
(assign_file_positions_except_relocs): Add dosyms argument, and
pass it on.
(prep_headers): Check return value of bfd_add_to_strtab.
(swap_out_syms): Likewise. Also, don't set up .shstrtab here.
(NAME(bfd_elf,write_object_contents)): Some calls moved into
elf_compute_section_file_positions.
(elf_set_section_contents): Likewise.
(elf_slurp_symbol_table): SHN_LORESERV corrected to SHN_LORESERVE.
* libelf.h: Include bfdlink.h.
(struct elf_backend_data): Add fields collect,
elf_add_symbol_hook, elf_backend_relocate_section.
(struct bfd_elf_section_data): Add field rel_hashes.
(struct elf_obj_tdata): Remove fields internal_syms and symbols.
Add field sym_hashes.
(obj_symbols, obj_internal_syms): Remove definitions.
(elf_sym_hashes): Define.
(struct elf_link_hash_entry): Define.
(struct elf_link_hash_table): Define.
(elf_link_hash_lookup): Define.
(elf_link_hash_traverse): Define.
(elf_hash_table): Define.
(_bfd_elf_link_hash_table_create): Declare.
(bfd_elf32_bfd_link_add_symbols): Declare.
(bfd_elf32_bfd_final_link): Declare.
(bfd_elf64_bfd_link_add_symbols): Declare.
(bfd_elf64_bfd_final_link): Declare.
* elf.c: Include bfdlink.h.
(elf_link_hash_newfunc): New function.
(_bfd_elf_link_hash_table_create): New function.
* elf32-target.h (elf_backend_relocate_section): If not defined,
define as 0 and use generic linker. Otherwise, use ELF backend
linker.
(elf_backend_collect): If not defined, define as false.
(elf_backend_add_symbol_hook): If not defined, define as 0.
(elf32_bed): Initialize new fields.
* elf64-target.h: Same changes as elf32-target.h.
* elf32-i386.c: Include bfdlink.h.
(elf_i386_relocate_section): New function.
(elf_backend_relocate_section): Define.
* elf32-sparc.c: Include bfdlink.h.
(elf_info_to_howto): Change type of dst from Elf32_Internal_Rela
to Elf_Internal_Rela (they're the same type anyhow).
(elf_sparc_relocate_section): New function.
(elf_backend_relocate_section): Define.
* elf32-mips.c (elf_backend_collect): Define.
Diffstat (limited to 'bfd/elf32-target.h')
-rw-r--r-- | bfd/elf32-target.h | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/bfd/elf32-target.h b/bfd/elf32-target.h index d661ced..c49ede4 100644 --- a/bfd/elf32-target.h +++ b/bfd/elf32-target.h @@ -36,16 +36,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define bfd_elf32_bfd_relax_section bfd_generic_relax_section #define bfd_elf32_bfd_make_debug_symbol \ ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) -#ifndef bfd_elf32_bfd_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_create \ - _bfd_generic_link_hash_table_create -#endif -#ifndef bfd_elf32_bfd_link_add_symbols -#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols -#endif -#ifndef bfd_elf32_bfd_final_link -#define bfd_elf32_bfd_final_link _bfd_generic_final_link -#endif #ifndef bfd_elf32_bfd_copy_private_section_data #define bfd_elf32_bfd_copy_private_section_data \ @@ -68,6 +58,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _bfd_nodynamic_canonicalize_dynamic_reloc #endif +#ifdef elf_backend_relocate_section +#ifndef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create +#endif +#else /* ! defined (elf_backend_relocate_section) */ +/* If no backend relocate_section routine, use the generic linker. */ +#ifndef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + _bfd_generic_link_hash_table_create +#endif +#ifndef bfd_elf32_bfd_link_add_symbols +#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols +#endif +#ifndef bfd_elf32_bfd_final_link +#define bfd_elf32_bfd_final_link _bfd_generic_final_link +#endif +#endif /* ! defined (elf_backend_relocate_section) */ + #ifndef elf_info_to_howto_rel #define elf_info_to_howto_rel 0 #endif @@ -76,6 +84,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define ELF_MAXPAGESIZE 1 #endif +#ifndef elf_backend_collect +#define elf_backend_collect false +#endif + #ifndef elf_backend_sym_is_global #define elf_backend_sym_is_global 0 #endif @@ -100,6 +112,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef elf_backend_section_from_bfd_section #define elf_backend_section_from_bfd_section 0 #endif +#ifndef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook 0 +#endif +#ifndef elf_backend_relocate_section +#define elf_backend_relocate_section 0 +#endif #ifndef elf_backend_begin_write_processing #define elf_backend_begin_write_processing 0 #endif @@ -121,6 +139,7 @@ static CONST struct elf_backend_data elf32_bed = ELF_ARCH, /* arch */ ELF_MACHINE_CODE, /* elf_machine_code */ ELF_MAXPAGESIZE, /* maxpagesize */ + elf_backend_collect, elf_info_to_howto, elf_info_to_howto_rel, elf_backend_sym_is_global, @@ -131,6 +150,8 @@ static CONST struct elf_backend_data elf32_bed = elf_backend_section_from_shdr, elf_backend_fake_sections, elf_backend_section_from_bfd_section, + elf_backend_add_symbol_hook, + elf_backend_relocate_section, elf_backend_begin_write_processing, elf_backend_final_write_processing, elf_backend_ecoff_debug_swap |