* 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.
This commit is contained in:
parent
c1124600ad
commit
6ec3bb6a75
|
@ -1,3 +1,86 @@
|
||||||
|
Mon May 9 11:53:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* Makefile.in (stmp-bfd.h): Avoid useless make error message in a
|
||||||
|
different way; touch takes a numeric argument on some systems.
|
||||||
|
|
||||||
|
Fri May 6 13:34:14 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||||
|
|
||||||
|
* nlmcode.h (nlm_swap_auxiliary_headers_in): Rework custom header
|
||||||
|
handling for latest suggested format.
|
||||||
|
(nlm_swap_auxiliary_headers_out): Likewise.
|
||||||
|
(nlm_compute_section_file_positions): Likewise.
|
||||||
|
|
||||||
|
Fri May 6 11:11:50 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com)
|
||||||
|
|
||||||
|
* config.bfd: handle erricsson config (for OSE).
|
||||||
|
|
||||||
|
Thu May 5 15:40:47 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||||
|
|
||||||
|
Patches from Ralph Campbell:
|
||||||
|
* mipsbsd.c (mips_fix_jmp_addr): New function.
|
||||||
|
(mips_fix_hi16_s): Use bfd_is_com_section.
|
||||||
|
(mips_howto_table_ext): Call mips_fix_jmp_addr for MIPS_RELOC_JMP.
|
||||||
|
|
||||||
Fri May 6 11:48:55 1994 Steve Chamberlain (sac@cygnus.com)
|
Fri May 6 11:48:55 1994 Steve Chamberlain (sac@cygnus.com)
|
||||||
|
|
||||||
* config/go32.mh: XX support.
|
* config/go32.mh: XX support.
|
||||||
|
@ -20,6 +103,7 @@ Thu May 5 15:40:47 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||||
(mips_fix_hi16_s): Use bfd_is_com_section.
|
(mips_fix_hi16_s): Use bfd_is_com_section.
|
||||||
(mips_howto_table_ext): Call mips_fix_jmp_addr for MIPS_RELOC_JMP.
|
(mips_howto_table_ext): Call mips_fix_jmp_addr for MIPS_RELOC_JMP.
|
||||||
|
|
||||||
|
>>>>>>> 1.1152
|
||||||
Wed May 4 11:09:53 1994 Ian Lance Taylor (ian@cygnus.com)
|
Wed May 4 11:09:53 1994 Ian Lance Taylor (ian@cygnus.com)
|
||||||
|
|
||||||
Changed m68k-aout to set flags to 0; m68k-sunos still uses 1.
|
Changed m68k-aout to set flags to 0; m68k-sunos still uses 1.
|
||||||
|
@ -3771,4 +3855,6 @@ See file ChangeLog.1
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: indented-text
|
mode: indented-text
|
||||||
left-margin: 8
|
left-margin: 8
|
||||||
fill-column: 7
|
fill-column: 74
|
||||||
|
version-control: never
|
||||||
|
End:
|
||||||
|
|
|
@ -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_relax_section bfd_generic_relax_section
|
||||||
#define bfd_elf32_bfd_make_debug_symbol \
|
#define bfd_elf32_bfd_make_debug_symbol \
|
||||||
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
|
((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
|
#ifndef bfd_elf32_bfd_copy_private_section_data
|
||||||
#define 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
|
_bfd_nodynamic_canonicalize_dynamic_reloc
|
||||||
#endif
|
#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
|
#ifndef elf_info_to_howto_rel
|
||||||
#define elf_info_to_howto_rel 0
|
#define elf_info_to_howto_rel 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,6 +84,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#define ELF_MAXPAGESIZE 1
|
#define ELF_MAXPAGESIZE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef elf_backend_collect
|
||||||
|
#define elf_backend_collect false
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef elf_backend_sym_is_global
|
#ifndef elf_backend_sym_is_global
|
||||||
#define elf_backend_sym_is_global 0
|
#define elf_backend_sym_is_global 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,6 +112,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#ifndef elf_backend_section_from_bfd_section
|
#ifndef elf_backend_section_from_bfd_section
|
||||||
#define elf_backend_section_from_bfd_section 0
|
#define elf_backend_section_from_bfd_section 0
|
||||||
#endif
|
#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
|
#ifndef elf_backend_begin_write_processing
|
||||||
#define elf_backend_begin_write_processing 0
|
#define elf_backend_begin_write_processing 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -121,6 +139,7 @@ static CONST struct elf_backend_data elf32_bed =
|
||||||
ELF_ARCH, /* arch */
|
ELF_ARCH, /* arch */
|
||||||
ELF_MACHINE_CODE, /* elf_machine_code */
|
ELF_MACHINE_CODE, /* elf_machine_code */
|
||||||
ELF_MAXPAGESIZE, /* maxpagesize */
|
ELF_MAXPAGESIZE, /* maxpagesize */
|
||||||
|
elf_backend_collect,
|
||||||
elf_info_to_howto,
|
elf_info_to_howto,
|
||||||
elf_info_to_howto_rel,
|
elf_info_to_howto_rel,
|
||||||
elf_backend_sym_is_global,
|
elf_backend_sym_is_global,
|
||||||
|
@ -131,6 +150,8 @@ static CONST struct elf_backend_data elf32_bed =
|
||||||
elf_backend_section_from_shdr,
|
elf_backend_section_from_shdr,
|
||||||
elf_backend_fake_sections,
|
elf_backend_fake_sections,
|
||||||
elf_backend_section_from_bfd_section,
|
elf_backend_section_from_bfd_section,
|
||||||
|
elf_backend_add_symbol_hook,
|
||||||
|
elf_backend_relocate_section,
|
||||||
elf_backend_begin_write_processing,
|
elf_backend_begin_write_processing,
|
||||||
elf_backend_final_write_processing,
|
elf_backend_final_write_processing,
|
||||||
elf_backend_ecoff_debug_swap
|
elf_backend_ecoff_debug_swap
|
||||||
|
|
|
@ -39,16 +39,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#define bfd_elf64_bfd_relax_section bfd_generic_relax_section
|
#define bfd_elf64_bfd_relax_section bfd_generic_relax_section
|
||||||
#define bfd_elf64_bfd_make_debug_symbol \
|
#define bfd_elf64_bfd_make_debug_symbol \
|
||||||
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
|
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
|
||||||
#ifndef bfd_elf64_bfd_link_hash_table_create
|
|
||||||
#define bfd_elf64_bfd_link_hash_table_create \
|
|
||||||
_bfd_generic_link_hash_table_create
|
|
||||||
#endif
|
|
||||||
#ifndef bfd_elf64_bfd_link_add_symbols
|
|
||||||
#define bfd_elf64_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
|
||||||
#endif
|
|
||||||
#ifndef bfd_elf64_bfd_final_link
|
|
||||||
#define bfd_elf64_bfd_final_link _bfd_generic_final_link
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef bfd_elf64_bfd_copy_private_section_data
|
#ifndef bfd_elf64_bfd_copy_private_section_data
|
||||||
#define bfd_elf64_bfd_copy_private_section_data \
|
#define bfd_elf64_bfd_copy_private_section_data \
|
||||||
|
@ -71,6 +61,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
_bfd_nodynamic_canonicalize_dynamic_reloc
|
_bfd_nodynamic_canonicalize_dynamic_reloc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef elf_backend_relocate_section
|
||||||
|
#ifndef bfd_elf64_bfd_link_hash_table_create
|
||||||
|
#define bfd_elf64_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_elf64_bfd_link_hash_table_create
|
||||||
|
#define bfd_elf64_bfd_link_hash_table_create \
|
||||||
|
_bfd_generic_link_hash_table_create
|
||||||
|
#endif
|
||||||
|
#ifndef bfd_elf64_bfd_link_add_symbols
|
||||||
|
#define bfd_elf64_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
|
#endif
|
||||||
|
#ifndef bfd_elf64_bfd_final_link
|
||||||
|
#define bfd_elf64_bfd_final_link _bfd_generic_final_link
|
||||||
|
#endif
|
||||||
|
#endif /* ! defined (elf_backend_relocate_section) */
|
||||||
|
|
||||||
#ifndef elf_info_to_howto_rel
|
#ifndef elf_info_to_howto_rel
|
||||||
#define elf_info_to_howto_rel 0
|
#define elf_info_to_howto_rel 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,6 +87,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#define ELF_MAXPAGESIZE 1
|
#define ELF_MAXPAGESIZE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef elf_backend_collect
|
||||||
|
#define elf_backend_collect false
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef elf_backend_sym_is_global
|
#ifndef elf_backend_sym_is_global
|
||||||
#define elf_backend_sym_is_global 0
|
#define elf_backend_sym_is_global 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,6 +115,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#ifndef elf_backend_section_from_bfd_section
|
#ifndef elf_backend_section_from_bfd_section
|
||||||
#define elf_backend_section_from_bfd_section 0
|
#define elf_backend_section_from_bfd_section 0
|
||||||
#endif
|
#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
|
#ifndef elf_backend_begin_write_processing
|
||||||
#define elf_backend_begin_write_processing 0
|
#define elf_backend_begin_write_processing 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,6 +142,7 @@ static CONST struct elf_backend_data elf64_bed =
|
||||||
ELF_ARCH, /* arch */
|
ELF_ARCH, /* arch */
|
||||||
ELF_MACHINE_CODE, /* elf_machine_code */
|
ELF_MACHINE_CODE, /* elf_machine_code */
|
||||||
ELF_MAXPAGESIZE, /* maxpagesize */
|
ELF_MAXPAGESIZE, /* maxpagesize */
|
||||||
|
elf_backend_collect,
|
||||||
elf_info_to_howto,
|
elf_info_to_howto,
|
||||||
elf_info_to_howto_rel,
|
elf_info_to_howto_rel,
|
||||||
elf_backend_sym_is_global,
|
elf_backend_sym_is_global,
|
||||||
|
@ -134,6 +153,8 @@ static CONST struct elf_backend_data elf64_bed =
|
||||||
elf_backend_section_from_shdr,
|
elf_backend_section_from_shdr,
|
||||||
elf_backend_fake_sections,
|
elf_backend_fake_sections,
|
||||||
elf_backend_section_from_bfd_section,
|
elf_backend_section_from_bfd_section,
|
||||||
|
elf_backend_add_symbol_hook,
|
||||||
|
elf_backend_relocate_section,
|
||||||
elf_backend_begin_write_processing,
|
elf_backend_begin_write_processing,
|
||||||
elf_backend_final_write_processing,
|
elf_backend_final_write_processing,
|
||||||
elf_backend_ecoff_debug_swap
|
elf_backend_ecoff_debug_swap
|
||||||
|
|
1806
bfd/elfcode.h
1806
bfd/elfcode.h
File diff suppressed because it is too large
Load Diff
118
bfd/libelf.h
118
bfd/libelf.h
|
@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "elf/common.h"
|
#include "elf/common.h"
|
||||||
#include "elf/internal.h"
|
#include "elf/internal.h"
|
||||||
#include "elf/external.h"
|
#include "elf/external.h"
|
||||||
|
#include "bfdlink.h"
|
||||||
|
|
||||||
/* If size isn't specified as 64 or 32, NAME macro should fail. */
|
/* If size isn't specified as 64 or 32, NAME macro should fail. */
|
||||||
#ifndef NAME
|
#ifndef NAME
|
||||||
|
@ -84,6 +85,12 @@ struct elf_backend_data
|
||||||
/* The maximum page size for this backend. */
|
/* The maximum page size for this backend. */
|
||||||
bfd_vma maxpagesize;
|
bfd_vma maxpagesize;
|
||||||
|
|
||||||
|
/* This is true if the linker should act like collect and gather
|
||||||
|
global constructors and destructors by name. This is true for
|
||||||
|
MIPS ELF because the Irix 5 tools can not handle the .init
|
||||||
|
section. */
|
||||||
|
boolean collect;
|
||||||
|
|
||||||
/* A function to translate an ELF RELA relocation to a BFD arelent
|
/* A function to translate an ELF RELA relocation to a BFD arelent
|
||||||
structure. */
|
structure. */
|
||||||
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
|
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
|
||||||
|
@ -149,6 +156,53 @@ struct elf_backend_data
|
||||||
boolean (*elf_backend_section_from_bfd_section)
|
boolean (*elf_backend_section_from_bfd_section)
|
||||||
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
|
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
|
||||||
|
|
||||||
|
/* If this field is not NULL, it is called by the add_symbols phase
|
||||||
|
of a link just before adding a symbol to the global linker hash
|
||||||
|
table. It may modify any of the fields as it wishes. If *NAME
|
||||||
|
is set to NULL, the symbol will be skipped rather than being
|
||||||
|
added to the hash table. This function is responsible for
|
||||||
|
handling all processor dependent symbol bindings and section
|
||||||
|
indices, and must set at least *FLAGS and *SEC for each processor
|
||||||
|
dependent case; failure to do so will cause a link error. */
|
||||||
|
boolean (*elf_add_symbol_hook)
|
||||||
|
PARAMS ((bfd *abfd, struct bfd_link_info *info,
|
||||||
|
const Elf_Internal_Sym *, const char **name,
|
||||||
|
flagword *flags, asection **sec, bfd_vma *value));
|
||||||
|
|
||||||
|
/* The RELOCATE_SECTION function is called by the ELF backend linker
|
||||||
|
to handle the relocations for a section.
|
||||||
|
|
||||||
|
The relocs are always passed as Rela structures; if the section
|
||||||
|
actually uses Rel structures, the r_addend field will always be
|
||||||
|
zero.
|
||||||
|
|
||||||
|
This function is responsible for adjust the section contents as
|
||||||
|
necessary, and (if using Rela relocs and generating a
|
||||||
|
relocateable output file) adjusting the reloc addend as
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
This function does not have to worry about setting the reloc
|
||||||
|
address or the reloc symbol index.
|
||||||
|
|
||||||
|
LOCAL_SYMS is a pointer to the swapped in local symbols.
|
||||||
|
|
||||||
|
LOCAL_SECTIONS is an array giving the section in the input file
|
||||||
|
corresponding to the st_shndx field of each local symbol.
|
||||||
|
|
||||||
|
The global hash table entry for the global symbols can be found
|
||||||
|
via elf_sym_hashes (input_bfd).
|
||||||
|
|
||||||
|
When generating relocateable output, this function must handle
|
||||||
|
STB_LOCAL/STT_SECTION symbols specially. The output symbol is
|
||||||
|
going to be the section symbol corresponding to the output
|
||||||
|
section, which means that the addend must be adjusted
|
||||||
|
accordingly. */
|
||||||
|
boolean (*elf_backend_relocate_section)
|
||||||
|
PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
|
||||||
|
bfd *input_bfd, asection *input_section, bfd_byte *contents,
|
||||||
|
Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
|
||||||
|
asection **local_sections));
|
||||||
|
|
||||||
/* A function to do any beginning processing needed for the ELF file
|
/* A function to do any beginning processing needed for the ELF file
|
||||||
before building the ELF headers and computing file positions. */
|
before building the ELF headers and computing file positions. */
|
||||||
void (*elf_backend_begin_write_processing) PARAMS ((bfd *));
|
void (*elf_backend_begin_write_processing) PARAMS ((bfd *));
|
||||||
|
@ -173,6 +227,7 @@ struct bfd_elf_section_data {
|
||||||
Elf_Internal_Shdr this_hdr;
|
Elf_Internal_Shdr this_hdr;
|
||||||
Elf_Internal_Shdr rel_hdr;
|
Elf_Internal_Shdr rel_hdr;
|
||||||
int this_idx, rel_idx;
|
int this_idx, rel_idx;
|
||||||
|
struct elf_link_hash_entry **rel_hashes;
|
||||||
};
|
};
|
||||||
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
||||||
#define shdr_name(abfd,shdr) (elf_shstrtab (abfd)->tab + (shdr)->sh_name)
|
#define shdr_name(abfd,shdr) (elf_shstrtab (abfd)->tab + (shdr)->sh_name)
|
||||||
|
@ -198,8 +253,6 @@ struct elf_obj_tdata
|
||||||
struct strtab *strtab_ptr;
|
struct strtab *strtab_ptr;
|
||||||
int num_locals;
|
int num_locals;
|
||||||
int num_globals;
|
int num_globals;
|
||||||
Elf_Internal_Sym *internal_syms;
|
|
||||||
elf_symbol_type *symbols; /* elf_symbol_type */
|
|
||||||
Elf_Sym_Extra *sym_extra;
|
Elf_Sym_Extra *sym_extra;
|
||||||
asymbol **section_syms; /* STT_SECTION symbols for each section */
|
asymbol **section_syms; /* STT_SECTION symbols for each section */
|
||||||
int num_section_syms; /* number of section_syms allocated */
|
int num_section_syms; /* number of section_syms allocated */
|
||||||
|
@ -214,6 +267,11 @@ struct elf_obj_tdata
|
||||||
void *prpsinfo; /* The raw /proc prpsinfo structure */
|
void *prpsinfo; /* The raw /proc prpsinfo structure */
|
||||||
bfd_vma gp; /* The gp value (MIPS only, for now) */
|
bfd_vma gp; /* The gp value (MIPS only, for now) */
|
||||||
int gp_size; /* The gp size (MIPS only, for now) */
|
int gp_size; /* The gp size (MIPS only, for now) */
|
||||||
|
|
||||||
|
/* A mapping from external symbols to entries in the linker hash
|
||||||
|
table, used when linking. This is indexed by the symbol index
|
||||||
|
minus the sh_info field of the symbol table header. */
|
||||||
|
struct elf_link_hash_entry **sym_hashes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
|
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
|
||||||
|
@ -229,11 +287,52 @@ struct elf_obj_tdata
|
||||||
#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
|
#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
|
||||||
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
|
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
|
||||||
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
|
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
|
||||||
#define obj_symbols(bfd) (elf_tdata(bfd) -> symbols)
|
|
||||||
#define obj_internal_syms(bfd) (elf_tdata(bfd) -> internal_syms)
|
|
||||||
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
|
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
|
||||||
#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
|
#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
|
||||||
|
#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
|
||||||
|
|
||||||
|
/* ELF linker hash table entries. */
|
||||||
|
|
||||||
|
struct elf_link_hash_entry
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_entry root;
|
||||||
|
/* Symbol index in output file. This is initialized to -1. It is
|
||||||
|
set to -2 if the symbol is used by a reloc. */
|
||||||
|
long indx;
|
||||||
|
/* Symbol size. */
|
||||||
|
bfd_size_type size;
|
||||||
|
/* Symbol alignment (common symbols only). */
|
||||||
|
unsigned short align;
|
||||||
|
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
|
||||||
|
char type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ELF linker hash table. */
|
||||||
|
|
||||||
|
struct elf_link_hash_table
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_table root;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Look up an entry in an ELF linker hash table. */
|
||||||
|
|
||||||
|
#define elf_link_hash_lookup(table, string, create, copy, follow) \
|
||||||
|
((struct elf_link_hash_entry *) \
|
||||||
|
bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
||||||
|
(copy), (follow)))
|
||||||
|
|
||||||
|
/* Traverse an ELF linker hash table. */
|
||||||
|
|
||||||
|
#define elf_link_hash_traverse(table, func, info) \
|
||||||
|
(bfd_link_hash_traverse \
|
||||||
|
(&(table)->root, \
|
||||||
|
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||||
|
(info)))
|
||||||
|
|
||||||
|
/* Get the ELF linker hash table from a link_info structure. */
|
||||||
|
|
||||||
|
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
|
||||||
|
|
||||||
extern char * elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned));
|
extern char * elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned));
|
||||||
extern char * elf_get_str_section PARAMS ((bfd *, unsigned));
|
extern char * elf_get_str_section PARAMS ((bfd *, unsigned));
|
||||||
|
|
||||||
|
@ -253,6 +352,9 @@ extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
|
||||||
extern boolean bfd_elf_mkobject PARAMS ((bfd *));
|
extern boolean bfd_elf_mkobject PARAMS ((bfd *));
|
||||||
extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
|
extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
|
||||||
|
|
||||||
|
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
|
||||||
|
PARAMS ((bfd *));
|
||||||
|
|
||||||
extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *));
|
extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *));
|
||||||
extern boolean bfd_elf64_write_object_contents PARAMS ((bfd *));
|
extern boolean bfd_elf64_write_object_contents PARAMS ((bfd *));
|
||||||
|
|
||||||
|
@ -289,6 +391,10 @@ extern boolean bfd_elf32_find_nearest_line PARAMS ((bfd *, asection *,
|
||||||
extern int bfd_elf32_sizeof_headers PARAMS ((bfd *, boolean));
|
extern int bfd_elf32_sizeof_headers PARAMS ((bfd *, boolean));
|
||||||
extern void bfd_elf32__write_relocs PARAMS ((bfd *, asection *, PTR));
|
extern void bfd_elf32__write_relocs PARAMS ((bfd *, asection *, PTR));
|
||||||
extern boolean bfd_elf32_new_section_hook PARAMS ((bfd *, asection *));
|
extern boolean bfd_elf32_new_section_hook PARAMS ((bfd *, asection *));
|
||||||
|
extern boolean bfd_elf32_bfd_link_add_symbols
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
extern boolean bfd_elf32_bfd_final_link
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
|
||||||
/* If the target doesn't have reloc handling written yet: */
|
/* If the target doesn't have reloc handling written yet: */
|
||||||
extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *,
|
extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *,
|
||||||
|
@ -327,6 +433,10 @@ extern boolean bfd_elf64_find_nearest_line PARAMS ((bfd *, asection *,
|
||||||
extern int bfd_elf64_sizeof_headers PARAMS ((bfd *, boolean));
|
extern int bfd_elf64_sizeof_headers PARAMS ((bfd *, boolean));
|
||||||
extern void bfd_elf64__write_relocs PARAMS ((bfd *, asection *, PTR));
|
extern void bfd_elf64__write_relocs PARAMS ((bfd *, asection *, PTR));
|
||||||
extern boolean bfd_elf64_new_section_hook PARAMS ((bfd *, asection *));
|
extern boolean bfd_elf64_new_section_hook PARAMS ((bfd *, asection *));
|
||||||
|
extern boolean bfd_elf64_bfd_link_add_symbols
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
extern boolean bfd_elf64_bfd_final_link
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
|
||||||
/* If the target doesn't have reloc handling written yet: */
|
/* If the target doesn't have reloc handling written yet: */
|
||||||
extern void bfd_elf64_no_info_to_howto PARAMS ((bfd *, arelent *,
|
extern void bfd_elf64_no_info_to_howto PARAMS ((bfd *, arelent *,
|
||||||
|
|
Loading…
Reference in New Issue