1993-06-18 19:45:41 +02:00
|
|
|
|
/* ELF executable support for BFD.
|
1996-01-15 22:06:31 +01:00
|
|
|
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
|
|
|
|
Written by Fred Fish @ Cygnus Support, from information published
|
|
|
|
|
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
|
|
|
|
Programming Support Tools". Sufficient support for gdb.
|
|
|
|
|
|
|
|
|
|
Rewritten by Mark Eichin @ Cygnus Support, from information
|
|
|
|
|
published in "System V Application Binary Interface", chapters 4
|
|
|
|
|
and 5, as well as the various "Processor Supplement" documents
|
|
|
|
|
derived from it. Added support for assembler and other object file
|
|
|
|
|
utilities. Further work done by Ken Raeburn (Cygnus Support), Michael
|
|
|
|
|
Meissner (Open Software Foundation), and Peter Hoogenboom (University
|
|
|
|
|
of Utah) to finish and extend this.
|
|
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-07-13 00:00:57 +02:00
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
|
|
|
|
/* Problems and other issues to resolve.
|
|
|
|
|
|
|
|
|
|
(1) BFD expects there to be some fixed number of "sections" in
|
|
|
|
|
the object file. I.E. there is a "section_count" variable in the
|
|
|
|
|
bfd structure which contains the number of sections. However, ELF
|
|
|
|
|
supports multiple "views" of a file. In particular, with current
|
|
|
|
|
implementations, executable files typically have two tables, a
|
|
|
|
|
program header table and a section header table, both of which
|
|
|
|
|
partition the executable.
|
|
|
|
|
|
|
|
|
|
In ELF-speak, the "linking view" of the file uses the section header
|
|
|
|
|
table to access "sections" within the file, and the "execution view"
|
|
|
|
|
uses the program header table to access "segments" within the file.
|
|
|
|
|
"Segments" typically may contain all the data from one or more
|
|
|
|
|
"sections".
|
|
|
|
|
|
|
|
|
|
Note that the section header table is optional in ELF executables,
|
|
|
|
|
but it is this information that is most useful to gdb. If the
|
|
|
|
|
section header table is missing, then gdb should probably try
|
|
|
|
|
to make do with the program header table. (FIXME)
|
|
|
|
|
|
1993-07-06 22:43:42 +02:00
|
|
|
|
(2) The code in this file is compiled twice, once in 32-bit mode and
|
|
|
|
|
once in 64-bit mode. More of it should be made size-independent
|
|
|
|
|
and moved into elf.c.
|
|
|
|
|
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
(3) ELF section symbols are handled rather sloppily now. This should
|
|
|
|
|
be cleaned up, and ELF section symbols reconciled with BFD section
|
|
|
|
|
symbols.
|
1994-06-16 00:05:40 +02:00
|
|
|
|
|
|
|
|
|
(4) We need a published spec for 64-bit ELF. We've got some stuff here
|
|
|
|
|
that we're using for SPARC V9 64-bit chips, but don't assume that
|
|
|
|
|
it's cast in stone.
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
*/
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "sysdep.h"
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#include "bfdlink.h"
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#include "libbfd.h"
|
* libelf.h: Rename to elf-bfd.h to avoid conflict with
systems that have a system <libelf.h>.
* Makefile.in: Globally replace libelf.h with elf-bfd.h.
* bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c,
elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c,
elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c,
elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c,
elfxx-target.h: Include elf-bfd.h rather than libelf.h.
* elfxx-target.h: Change libelf.h reference to elf-bfd.h.
1995-11-01 00:29:05 +01:00
|
|
|
|
#include "elf-bfd.h"
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Renaming structures, typedefs, macros and functions to be size-specific. */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#define Elf_External_Ehdr NAME(Elf,External_Ehdr)
|
|
|
|
|
#define Elf_External_Sym NAME(Elf,External_Sym)
|
|
|
|
|
#define Elf_External_Shdr NAME(Elf,External_Shdr)
|
|
|
|
|
#define Elf_External_Phdr NAME(Elf,External_Phdr)
|
|
|
|
|
#define Elf_External_Rel NAME(Elf,External_Rel)
|
|
|
|
|
#define Elf_External_Rela NAME(Elf,External_Rela)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define Elf_External_Dyn NAME(Elf,External_Dyn)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
|
|
|
|
#define elf_core_file_failing_command NAME(bfd_elf,core_file_failing_command)
|
|
|
|
|
#define elf_core_file_failing_signal NAME(bfd_elf,core_file_failing_signal)
|
1994-04-21 19:01:12 +02:00
|
|
|
|
#define elf_core_file_matches_executable_p \
|
|
|
|
|
NAME(bfd_elf,core_file_matches_executable_p)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#define elf_object_p NAME(bfd_elf,object_p)
|
|
|
|
|
#define elf_core_file_p NAME(bfd_elf,core_file_p)
|
|
|
|
|
#define elf_get_symtab_upper_bound NAME(bfd_elf,get_symtab_upper_bound)
|
1994-04-21 19:01:12 +02:00
|
|
|
|
#define elf_get_dynamic_symtab_upper_bound \
|
|
|
|
|
NAME(bfd_elf,get_dynamic_symtab_upper_bound)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define elf_swap_reloc_in NAME(bfd_elf,swap_reloc_in)
|
|
|
|
|
#define elf_swap_reloca_in NAME(bfd_elf,swap_reloca_in)
|
|
|
|
|
#define elf_swap_reloc_out NAME(bfd_elf,swap_reloc_out)
|
|
|
|
|
#define elf_swap_reloca_out NAME(bfd_elf,swap_reloca_out)
|
1994-07-05 20:05:03 +02:00
|
|
|
|
#define elf_swap_symbol_in NAME(bfd_elf,swap_symbol_in)
|
|
|
|
|
#define elf_swap_symbol_out NAME(bfd_elf,swap_symbol_out)
|
1995-09-09 00:43:31 +02:00
|
|
|
|
#define elf_swap_phdr_in NAME(bfd_elf,swap_phdr_in)
|
|
|
|
|
#define elf_swap_phdr_out NAME(bfd_elf,swap_phdr_out)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define elf_swap_dyn_in NAME(bfd_elf,swap_dyn_in)
|
|
|
|
|
#define elf_swap_dyn_out NAME(bfd_elf,swap_dyn_out)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#define elf_get_reloc_upper_bound NAME(bfd_elf,get_reloc_upper_bound)
|
|
|
|
|
#define elf_canonicalize_reloc NAME(bfd_elf,canonicalize_reloc)
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
#define elf_slurp_symbol_table NAME(bfd_elf,slurp_symbol_table)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#define elf_get_symtab NAME(bfd_elf,get_symtab)
|
1994-04-21 19:01:12 +02:00
|
|
|
|
#define elf_canonicalize_dynamic_symtab \
|
|
|
|
|
NAME(bfd_elf,canonicalize_dynamic_symtab)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#define elf_make_empty_symbol NAME(bfd_elf,make_empty_symbol)
|
|
|
|
|
#define elf_get_symbol_info NAME(bfd_elf,get_symbol_info)
|
|
|
|
|
#define elf_get_lineno NAME(bfd_elf,get_lineno)
|
|
|
|
|
#define elf_set_arch_mach NAME(bfd_elf,set_arch_mach)
|
|
|
|
|
#define elf_find_nearest_line NAME(bfd_elf,find_nearest_line)
|
|
|
|
|
#define elf_sizeof_headers NAME(bfd_elf,sizeof_headers)
|
|
|
|
|
#define elf_set_section_contents NAME(bfd_elf,set_section_contents)
|
|
|
|
|
#define elf_no_info_to_howto NAME(bfd_elf,no_info_to_howto)
|
|
|
|
|
#define elf_no_info_to_howto_rel NAME(bfd_elf,no_info_to_howto_rel)
|
1993-10-26 21:58:54 +01:00
|
|
|
|
#define elf_find_section NAME(bfd_elf,find_section)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#define elf_bfd_link_add_symbols NAME(bfd_elf,bfd_link_add_symbols)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define elf_add_dynamic_entry NAME(bfd_elf,add_dynamic_entry)
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
#define elf_write_shdrs_and_ehdr NAME(bfd_elf,write_shdrs_and_ehdr)
|
|
|
|
|
#define elf_write_out_phdrs NAME(bfd_elf,write_out_phdrs)
|
Add support for creating shared libraries under i386 ELF and SPARC
ELF. Based on patches by Eric Youngdale <ericy@cais.cais.com>.
* libelf.h (struct elf_link_hash_entry): Remove copy_offset field.
Add got_offset and plt_offset fields.
(ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE): Don't define.
(ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE): Don't define.
(ELF_LINK_HASH_NEEDS_COPY): Define.
(struct elf_backend_data): Add check_relocs field.
(struct bfd_elf_section_data): Change relocs from PTR to
Elf_Internal_Rela *.
(struct elf_obj_tdata): Add local_got_offsets field.
(elf_local_got_offsets): Define accessor macro.
(bfd_elf32_link_create_dynamic_sections): Declare.
(bfd_elf32_link_record_dynamic_symbol): Declare.
(bfd_elf64_link_create_dynamic_sections): Declare.
(bfd_elf64_link_record_dynamic_symbol): Declare.
* elfcode.h (elf_slurp_reloc_table): Don't use the section data
relocs field.
(elf_link_record_dynamic_symbol): Make globally visible. Use
macro to rename to NAME(bfd_elf,link_record_dynamic_symbol).
(elf_link_add_object_symbols): If creating a shared library, put
make all local symbols dynamic. Don't bother with the
DYNAMIC_MULTIPLE flags. Call the check_relocs backend function if
it is defined.
(elf_link_create_dynamic_sections): Make globally visible. Use
macro to rename to NAME(bfd_elf,link_create_dynamic_sections). If
creating a shared library, make sure that _DYNAMIC is added as a
dynamic symbol.
(elf_link_read_relocs): New function.
(NAME(bfd_elf,record_link_assignment)): If creating a shared
library, always create symbols, and always make them dynamic.
(elf_bfd_final_link): Permit creation of shared libraries.
(elf_link_input_bfd): Use elf_link_read_relocs to get the relocs.
* elf.c (_bfd_elf_link_hash_newfunc): Don't initialize
copy_offset. Initialize got_offset and plt_offset.
* elf32-target.h (elf_backend_check_relocs): Define as 0 if not
defined.
(elf32_bed): Initialize check_relocs field.
* elf64-target.h (elf_backend_check_relocs): Define as 0 if not
defined.
(elf64_bed): Initialize check_relocs field.
* elf32-i386.c (elf_howto_table): Change R_386_PLT32 and
R_386_GOTPC to be pc_relative and pcrel_offset.
(elf_i386_pic_plt0_entry): Define.
(elf_i386_pic_plt_entry): Define.
(elf_i386_create_dynamic_sections): Create a .got.plt section, and
define _GLOBAL_OFFSET_TABLE_ at the start of it. If creating a
shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
dynamic symbol. Don't create .rel.bss if creating a shared
library.
(elf_i386_check_relocs): New function.
(elf_i386_adjust_dynamic_symbol): Don't make a PLT entry if the
symbol already has one. When making a PLT entry, set plt_offset.
Don't create a copy reloc when creating a shared library. Don't
set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
(elf_i386_allocate_dynamic_section): Remove.
(elf_i386_size_dynamic_sections): Look through all the sections
rather than assuming we know their names. Remove any empty reloc
or plt sections. Only add a DT_DEBUG entry if not creating a
shared library. Only add a DT_PLTGOT entry if there is a PLT.
Add a DT_TEXTREL entry if required.
(elf_i386_relocate_section): Permit undefined symbols when
creating a shared library. Handle the special relocation types
specially.
(elf_i386_finish_dynamic_symbol): Create a PLT entry if plt_offset
is set. If creating a shared library, produce a PIC PLT entry.
Only mark a PLT symbol as undefined if it was not defined by a
regular object file. Create a GOT entry if got_offset is set.
Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
(elf_i386_finish_dynamic_sections): Change the handling of
DT_RELSZ to simply subtract out the size of .rel.plt. If creating
a shared library, produce PIC PLT code.
(elf_backend_check_relocs): Define.
* elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT10,
R_SPARC_GOT22, and R_SPARC_PC10 to not warn about reloc overflow.
(elf32_sparc_create_dynamic_sections): If creating a shared
library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
dynamic symbol, and set the type to STT_OBJECT. Likewise for
_PROCEDURE_LINKAGE_TABLE_. Don't create .rel.bss if creating a
shared library.
(elf32_sparc_check_relocs): New function.
(elf32_sparc_adjust_dynamic_symbol): Don't make a PLT entry if the
symbol already has one. When making a PLT entry, set plt_offset.
Don't create a copy reloc when creating a shared library. Don't
set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
(elf32_sparc_allocate_dynamic_section): Remove.
(elf32_sparc_size_dynamic_sections): Look through all the sections
rather than assuming we know their names. Only add a DT_DEBUG
entry if not creating a shared library. Add a DT_TEXTREL entry if
required.
(elf32_sparc_relocate_section): Permit undefined symbols when
creating a shared library. Handle the special relocation types
specially.
(elf32_sparc_finish_dynamic_symbol): Create a PLT entry if plt_offset
is set. Only mark a PLT symbol as undefined if it was not defined
by a regular object file. Create a GOT entry if got_offset is
set. Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
(elf32_sparc_finish_dynamic_sections): Store dynobj in a local
variable.
(elf_backend_check_relocs): Define.
1994-07-26 19:18:37 +02:00
|
|
|
|
#define elf_link_create_dynamic_sections \
|
|
|
|
|
NAME(bfd_elf,link_create_dynamic_sections)
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#define elf_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#define elf_bfd_final_link NAME(bfd_elf,bfd_final_link)
|
1996-02-14 22:32:24 +01:00
|
|
|
|
#define elf_create_pointer_linker_section NAME(bfd_elf,create_pointer_linker_section)
|
|
|
|
|
#define elf_finish_pointer_linker_section NAME(bfd_elf,finish_pointer_linker_section)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-06 22:43:42 +02:00
|
|
|
|
#if ARCH_SIZE == 64
|
|
|
|
|
#define ELF_R_INFO(X,Y) ELF64_R_INFO(X,Y)
|
|
|
|
|
#define ELF_R_SYM(X) ELF64_R_SYM(X)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
#define ELFCLASS ELFCLASS64
|
1993-10-26 21:58:54 +01:00
|
|
|
|
#define FILE_ALIGN 8
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define LOG_FILE_ALIGN 3
|
1993-07-06 22:43:42 +02:00
|
|
|
|
#endif
|
|
|
|
|
#if ARCH_SIZE == 32
|
|
|
|
|
#define ELF_R_INFO(X,Y) ELF32_R_INFO(X,Y)
|
|
|
|
|
#define ELF_R_SYM(X) ELF32_R_SYM(X)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
#define ELFCLASS ELFCLASS32
|
1993-10-26 21:58:54 +01:00
|
|
|
|
#define FILE_ALIGN 4
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
#define LOG_FILE_ALIGN 2
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Forward declarations of static functions */
|
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
static void elf_swap_ehdr_in
|
|
|
|
|
PARAMS ((bfd *, const Elf_External_Ehdr *, Elf_Internal_Ehdr *));
|
|
|
|
|
static void elf_swap_ehdr_out
|
|
|
|
|
PARAMS ((bfd *, const Elf_Internal_Ehdr *, Elf_External_Ehdr *));
|
|
|
|
|
static void elf_swap_shdr_in
|
|
|
|
|
PARAMS ((bfd *, const Elf_External_Shdr *, Elf_Internal_Shdr *));
|
|
|
|
|
static void elf_swap_shdr_out
|
|
|
|
|
PARAMS ((bfd *, const Elf_Internal_Shdr *, Elf_External_Shdr *));
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#define elf_stringtab_init _bfd_elf_stringtab_init
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
extern struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
|
|
|
|
|
#define section_from_elf_index bfd_section_from_elf_index
|
|
|
|
|
extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *,
|
|
|
|
|
int));
|
|
|
|
|
|
1994-07-17 03:15:42 +02:00
|
|
|
|
static boolean elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *,
|
1994-03-17 17:47:01 +01:00
|
|
|
|
struct symbol_cache_entry **));
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1996-02-14 22:32:24 +01:00
|
|
|
|
static boolean validate_reloc PARAMS ((bfd *, arelent *));
|
1995-06-08 22:12:25 +02:00
|
|
|
|
static void write_relocs PARAMS ((bfd *, asection *, PTR));
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
|
|
|
|
|
boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
|
1994-04-25 21:36:51 +02:00
|
|
|
|
|
1993-07-06 22:43:42 +02:00
|
|
|
|
#ifdef DEBUG
|
Use a hash table when writing out ELF symbol names.
* elfcode.h (elf_stringtab_init): New static function.
(bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
Change all callers to use elf_stringtab_init or
_bfd_stringtab_add, and get stringtab lengths using
_bfd_stringtab_size.
(elf_fake_sections): Change ignored argument to pointer to
boolean, and set the boolean to true if an error occurs. If an
error has already occurred, don't do anything.
(assign_section_numbers): Just set sh_size, not contents.
(elf_compute_section_file_positions): Pass the address of a
boolean to elf_fake_sections. Pass the address of a
bfd_strtab_hash to swap_out_syms. Write out the .strtab section.
(prep_headers): Change shstrtab to bfd_strtab_hash.
(swap_out_syms): Take a pointer to a bfd_strtab_hash as an
argument. Set it to the symbol names.
(NAME(bfd_elf,write_object_contents)): Write out the section
header names using _bfd_stringtab_emit.
(elf_debug_section): Remove first argument; get the section name
via the bfd_section pointer. Change caller.
(elf_bfd_final_link): Write out the symbol names using
_bfd_stringtab_emit. Likewise for the .dynstr section contents.
Free the symbol names at the end of the function.
(elf_link_input_bfd): Remove the last argument, output_names,
from relocate_section. Save the old symbol contents before
calling elf_link_output_sym, and restore them afterward.
* libelf.h (struct elf_link_hash_table): Change dynstr field to
struct bfd_strtab_hash.
(struct elf_backend_data): Remove last argument, output_names,
from elf_backend_relocate_section field.
(struct strtab): Don't define.
(struct elf_obj_tdata): Change strtab_ptr field to struct
bfd_strtab_hash.
* elf32-hppa.c (elf32_hppa_relocate_section): Remove last
argument, output_names.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-mips.c (mips_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-17 23:03:14 +01:00
|
|
|
|
static void elf_debug_section PARAMS ((int, Elf_Internal_Shdr *));
|
1993-07-06 22:43:42 +02:00
|
|
|
|
static void elf_debug_file PARAMS ((Elf_Internal_Ehdr *));
|
1995-06-08 22:12:25 +02:00
|
|
|
|
static char *elf_symbol_flags PARAMS ((flagword));
|
1993-07-06 22:43:42 +02:00
|
|
|
|
#endif
|
1993-07-19 21:12:59 +02:00
|
|
|
|
|
|
|
|
|
/* Structure swapping routines */
|
|
|
|
|
|
1993-07-06 22:43:42 +02:00
|
|
|
|
/* Should perhaps use put_offset, put_word, etc. For now, the two versions
|
|
|
|
|
can be handled by explicitly specifying 32 bits or "the long type". */
|
1993-06-22 05:21:12 +02:00
|
|
|
|
#if ARCH_SIZE == 64
|
|
|
|
|
#define put_word bfd_h_put_64
|
|
|
|
|
#define get_word bfd_h_get_64
|
|
|
|
|
#endif
|
|
|
|
|
#if ARCH_SIZE == 32
|
|
|
|
|
#define put_word bfd_h_put_32
|
|
|
|
|
#define get_word bfd_h_get_32
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-06-18 19:45:41 +02:00
|
|
|
|
/* Translate an ELF symbol in external format into an ELF symbol in internal
|
|
|
|
|
format. */
|
|
|
|
|
|
1994-07-05 20:05:03 +02:00
|
|
|
|
void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_symbol_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Sym *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Sym *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
|
|
|
|
|
dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
|
|
|
|
|
dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
|
|
|
|
|
dst->st_shndx = bfd_h_get_16 (abfd, (bfd_byte *) src->st_shndx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF symbol in internal format into an ELF symbol in external
|
|
|
|
|
format. */
|
|
|
|
|
|
1994-07-05 20:05:03 +02:00
|
|
|
|
void
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
elf_swap_symbol_out (abfd, src, cdst)
|
1994-03-17 17:47:01 +01:00
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Sym *src;
|
1995-07-13 00:00:57 +02:00
|
|
|
|
PTR cdst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
bfd_h_put_32 (abfd, src->st_name, dst->st_name);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
put_word (abfd, src->st_value, dst->st_value);
|
|
|
|
|
put_word (abfd, src->st_size, dst->st_size);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
bfd_h_put_8 (abfd, src->st_info, dst->st_info);
|
|
|
|
|
bfd_h_put_8 (abfd, src->st_other, dst->st_other);
|
|
|
|
|
bfd_h_put_16 (abfd, src->st_shndx, dst->st_shndx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF file header in external format into an ELF file header in
|
|
|
|
|
internal format. */
|
|
|
|
|
|
|
|
|
|
static void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_ehdr_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Ehdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Ehdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
|
|
|
|
|
dst->e_type = bfd_h_get_16 (abfd, (bfd_byte *) src->e_type);
|
|
|
|
|
dst->e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src->e_machine);
|
|
|
|
|
dst->e_version = bfd_h_get_32 (abfd, (bfd_byte *) src->e_version);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
|
|
|
|
|
dst->e_phoff = get_word (abfd, (bfd_byte *) src->e_phoff);
|
|
|
|
|
dst->e_shoff = get_word (abfd, (bfd_byte *) src->e_shoff);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
dst->e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->e_flags);
|
|
|
|
|
dst->e_ehsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_ehsize);
|
|
|
|
|
dst->e_phentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phentsize);
|
|
|
|
|
dst->e_phnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phnum);
|
|
|
|
|
dst->e_shentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shentsize);
|
|
|
|
|
dst->e_shnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shnum);
|
|
|
|
|
dst->e_shstrndx = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shstrndx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF file header in internal format into an ELF file header in
|
|
|
|
|
external format. */
|
|
|
|
|
|
|
|
|
|
static void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_ehdr_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Ehdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_External_Ehdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
|
|
|
|
|
/* note that all elements of dst are *arrays of unsigned char* already... */
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_type, dst->e_type);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_machine, dst->e_machine);
|
|
|
|
|
bfd_h_put_32 (abfd, src->e_version, dst->e_version);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
put_word (abfd, src->e_entry, dst->e_entry);
|
|
|
|
|
put_word (abfd, src->e_phoff, dst->e_phoff);
|
|
|
|
|
put_word (abfd, src->e_shoff, dst->e_shoff);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
bfd_h_put_32 (abfd, src->e_flags, dst->e_flags);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_ehsize, dst->e_ehsize);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_phentsize, dst->e_phentsize);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_phnum, dst->e_phnum);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_shentsize, dst->e_shentsize);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_shnum, dst->e_shnum);
|
|
|
|
|
bfd_h_put_16 (abfd, src->e_shstrndx, dst->e_shstrndx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF section header table entry in external format into an
|
|
|
|
|
ELF section header table entry in internal format. */
|
|
|
|
|
|
|
|
|
|
static void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_shdr_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Shdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Shdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
|
|
|
|
|
dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
|
|
|
|
|
dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
|
|
|
|
|
dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
|
|
|
|
|
dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
|
|
|
|
|
dst->sh_info = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_info);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
dst->sh_addralign = get_word (abfd, (bfd_byte *) src->sh_addralign);
|
|
|
|
|
dst->sh_entsize = get_word (abfd, (bfd_byte *) src->sh_entsize);
|
1994-10-17 19:27:40 +01:00
|
|
|
|
dst->bfd_section = NULL;
|
|
|
|
|
dst->contents = NULL;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF section header table entry in internal format into an
|
|
|
|
|
ELF section header table entry in external format. */
|
|
|
|
|
|
|
|
|
|
static void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_shdr_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Shdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_External_Shdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
/* note that all elements of dst are *arrays of unsigned char* already... */
|
|
|
|
|
bfd_h_put_32 (abfd, src->sh_name, dst->sh_name);
|
|
|
|
|
bfd_h_put_32 (abfd, src->sh_type, dst->sh_type);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
put_word (abfd, src->sh_flags, dst->sh_flags);
|
|
|
|
|
put_word (abfd, src->sh_addr, dst->sh_addr);
|
|
|
|
|
put_word (abfd, src->sh_offset, dst->sh_offset);
|
|
|
|
|
put_word (abfd, src->sh_size, dst->sh_size);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
bfd_h_put_32 (abfd, src->sh_link, dst->sh_link);
|
|
|
|
|
bfd_h_put_32 (abfd, src->sh_info, dst->sh_info);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
put_word (abfd, src->sh_addralign, dst->sh_addralign);
|
|
|
|
|
put_word (abfd, src->sh_entsize, dst->sh_entsize);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF program header table entry in external format into an
|
|
|
|
|
ELF program header table entry in internal format. */
|
|
|
|
|
|
1995-09-09 00:43:31 +02:00
|
|
|
|
void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_phdr_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Phdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Phdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
|
|
|
|
|
dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
|
1993-06-22 05:21:12 +02:00
|
|
|
|
dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
|
|
|
|
|
dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
|
|
|
|
|
dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
|
|
|
|
|
dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
|
|
|
|
|
dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
|
|
|
|
|
dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
1995-09-09 00:43:31 +02:00
|
|
|
|
void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_phdr_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Phdr *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_External_Phdr *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
|
|
|
|
/* note that all elements of dst are *arrays of unsigned char* already... */
|
|
|
|
|
bfd_h_put_32 (abfd, src->p_type, dst->p_type);
|
1993-06-22 23:38:10 +02:00
|
|
|
|
put_word (abfd, src->p_offset, dst->p_offset);
|
|
|
|
|
put_word (abfd, src->p_vaddr, dst->p_vaddr);
|
|
|
|
|
put_word (abfd, src->p_paddr, dst->p_paddr);
|
|
|
|
|
put_word (abfd, src->p_filesz, dst->p_filesz);
|
|
|
|
|
put_word (abfd, src->p_memsz, dst->p_memsz);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
bfd_h_put_32 (abfd, src->p_flags, dst->p_flags);
|
1993-06-22 23:38:10 +02:00
|
|
|
|
put_word (abfd, src->p_align, dst->p_align);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF reloc from external format to internal format. */
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_reloc_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Rel *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Rel *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-06-22 23:38:10 +02:00
|
|
|
|
dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset);
|
|
|
|
|
dst->r_info = get_word (abfd, (bfd_byte *) src->r_info);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_reloca_in (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_External_Rela *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_Internal_Rela *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-06-22 23:38:10 +02:00
|
|
|
|
dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset);
|
|
|
|
|
dst->r_info = get_word (abfd, (bfd_byte *) src->r_info);
|
|
|
|
|
dst->r_addend = get_word (abfd, (bfd_byte *) src->r_addend);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate an ELF reloc from internal format to external format. */
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_reloc_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Rel *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_External_Rel *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-06-22 23:38:10 +02:00
|
|
|
|
put_word (abfd, src->r_offset, dst->r_offset);
|
|
|
|
|
put_word (abfd, src->r_info, dst->r_info);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_swap_reloca_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Rela *src;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
Elf_External_Rela *dst;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-06-22 23:38:10 +02:00
|
|
|
|
put_word (abfd, src->r_offset, dst->r_offset);
|
|
|
|
|
put_word (abfd, src->r_info, dst->r_info);
|
|
|
|
|
put_word (abfd, src->r_addend, dst->r_addend);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
1993-07-19 21:12:59 +02:00
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
1996-01-12 20:13:49 +01:00
|
|
|
|
elf_swap_dyn_in (abfd, p, dst)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
bfd *abfd;
|
1996-01-12 20:13:49 +01:00
|
|
|
|
const PTR p;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
Elf_Internal_Dyn *dst;
|
|
|
|
|
{
|
1996-01-12 20:13:49 +01:00
|
|
|
|
const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
|
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
dst->d_tag = get_word (abfd, src->d_tag);
|
|
|
|
|
dst->d_un.d_val = get_word (abfd, src->d_un.d_val);
|
|
|
|
|
}
|
1994-03-17 17:47:01 +01:00
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
INLINE void
|
|
|
|
|
elf_swap_dyn_out (abfd, src, dst)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
const Elf_Internal_Dyn *src;
|
|
|
|
|
Elf_External_Dyn *dst;
|
|
|
|
|
{
|
|
|
|
|
put_word (abfd, src->d_tag, dst->d_tag);
|
|
|
|
|
put_word (abfd, src->d_un.d_val, dst->d_un.d_val);
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* ELF .o/exec file reading */
|
|
|
|
|
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Begin processing a given object.
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
First we validate the file by reading in the ELF header and checking
|
|
|
|
|
the magic number. */
|
|
|
|
|
|
|
|
|
|
static INLINE boolean
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_file_p (x_ehdrp)
|
|
|
|
|
Elf_External_Ehdr *x_ehdrp;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-07-19 21:12:59 +02:00
|
|
|
|
return ((x_ehdrp->e_ident[EI_MAG0] == ELFMAG0)
|
|
|
|
|
&& (x_ehdrp->e_ident[EI_MAG1] == ELFMAG1)
|
|
|
|
|
&& (x_ehdrp->e_ident[EI_MAG2] == ELFMAG2)
|
|
|
|
|
&& (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3));
|
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
/* Check to see if the file associated with ABFD matches the target vector
|
|
|
|
|
that ABFD points to.
|
|
|
|
|
|
|
|
|
|
Note that we may be called several times with the same ABFD, but different
|
|
|
|
|
target vectors, most of which will not match. We have to avoid leaving
|
|
|
|
|
any side effects in ABFD, or any data it points to (like tdata), if the
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
file does not match the target vector. */
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
|
1994-06-20 23:55:45 +02:00
|
|
|
|
const bfd_target *
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_object_p (abfd)
|
|
|
|
|
bfd *abfd;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-07-19 21:12:59 +02:00
|
|
|
|
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
|
|
|
|
|
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
|
|
|
|
|
Elf_External_Shdr x_shdr; /* Section header table entry, external form */
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
Elf_Internal_Shdr *i_shdrp = NULL; /* Section header table, internal form */
|
1994-02-26 19:25:23 +01:00
|
|
|
|
unsigned int shindex;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
char *shstrtab; /* Internal copy of section header stringtab */
|
1993-11-18 18:12:47 +01:00
|
|
|
|
struct elf_backend_data *ebd;
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
struct elf_obj_tdata *new_tdata = NULL;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Read in the ELF header in external format. */
|
|
|
|
|
|
|
|
|
|
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
|
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated).
* som.c: Do not blindly set bfd_error_system_call after a
failing bfd_read, bfd_write, or bfd_seek. In a few places
(like som_object_p) override the error status set by bfd_read.
* aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
* coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
* elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
* nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
* som.c: Check return values from several bfd_{seek,read,write}
calls that we just assumed were not failing.
1994-03-26 19:28:29 +01:00
|
|
|
|
{
|
|
|
|
|
if (bfd_get_error () != bfd_error_system_call)
|
|
|
|
|
goto got_wrong_format_error;
|
|
|
|
|
else
|
|
|
|
|
goto got_no_match;
|
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Now check to see if we have a valid ELF file, and one that BFD can
|
|
|
|
|
make use of. The magic number must match, the address size ('class')
|
|
|
|
|
and byte-swapping must match our XVEC entry, and it must have a
|
|
|
|
|
section header table (FIXME: See comments re sections at top of this
|
|
|
|
|
file). */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
if ((elf_file_p (&x_ehdr) == false) ||
|
|
|
|
|
(x_ehdr.e_ident[EI_VERSION] != EV_CURRENT) ||
|
|
|
|
|
(x_ehdr.e_ident[EI_CLASS] != ELFCLASS))
|
|
|
|
|
goto got_wrong_format_error;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
/* Check that file's byte order matches xvec's */
|
1993-07-19 21:12:59 +02:00
|
|
|
|
switch (x_ehdr.e_ident[EI_DATA])
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1993-07-19 21:12:59 +02:00
|
|
|
|
case ELFDATA2MSB: /* Big-endian */
|
1996-01-12 20:13:49 +01:00
|
|
|
|
if (! bfd_header_big_endian (abfd))
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
goto got_wrong_format_error;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
break;
|
|
|
|
|
case ELFDATA2LSB: /* Little-endian */
|
1996-01-12 20:13:49 +01:00
|
|
|
|
if (! bfd_header_little_endian (abfd))
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
goto got_wrong_format_error;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
break;
|
|
|
|
|
case ELFDATANONE: /* No data encoding specified */
|
|
|
|
|
default: /* Unknown data encoding specified */
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
goto got_wrong_format_error;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
the tdata pointer in the bfd. */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
new_tdata = ((struct elf_obj_tdata *)
|
|
|
|
|
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)));
|
|
|
|
|
if (new_tdata == NULL)
|
1995-11-29 23:05:37 +01:00
|
|
|
|
goto got_no_match;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
elf_tdata (abfd) = new_tdata;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Now that we know the byte order, swap in the rest of the header */
|
|
|
|
|
i_ehdrp = elf_elfheader (abfd);
|
|
|
|
|
elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
|
|
|
|
|
#if DEBUG & 1
|
|
|
|
|
elf_debug_file (i_ehdrp);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* If there is no section header table, we're hosed. */
|
|
|
|
|
if (i_ehdrp->e_shoff == 0)
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
goto got_wrong_format_error;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-11-18 18:12:47 +01:00
|
|
|
|
/* As a simple sanity check, verify that the what BFD thinks is the
|
|
|
|
|
size of each section header table entry actually matches the size
|
|
|
|
|
recorded in the file. */
|
|
|
|
|
if (i_ehdrp->e_shentsize != sizeof (x_shdr))
|
|
|
|
|
goto got_wrong_format_error;
|
|
|
|
|
|
|
|
|
|
ebd = get_elf_backend_data (abfd);
|
|
|
|
|
|
|
|
|
|
/* Check that the ELF e_machine field matches what this particular
|
|
|
|
|
BFD format expects. */
|
1995-03-07 08:34:21 +01:00
|
|
|
|
if (ebd->elf_machine_code != i_ehdrp->e_machine
|
|
|
|
|
&& (ebd->elf_machine_alt1 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt1)
|
|
|
|
|
&& (ebd->elf_machine_alt2 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt2))
|
1993-11-18 18:12:47 +01:00
|
|
|
|
{
|
1994-06-20 23:55:45 +02:00
|
|
|
|
const bfd_target * const *target_ptr;
|
1993-11-18 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
if (ebd->elf_machine_code != EM_NONE)
|
|
|
|
|
goto got_wrong_format_error;
|
|
|
|
|
|
|
|
|
|
/* This is the generic ELF target. Let it match any ELF target
|
|
|
|
|
for which we do not have a specific backend. */
|
* opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): Add
"_bfd_" to function names.
* archive.c (_bfd_create_empty_archive_element_shell),
libbfd-in.h: Change callers.
* libbfd.c (bfd_zmalloc): Renamed from zalloc.
* libbfd.c (bfd_add_to_string_table),
trad-core.c (trad_unix_core_file_p),
targets.c (bfd_target_list),
ptrace-core.c (ptrace_unix_core_file_p),
opncls.c (new_bfd), libbfd-in.h,
ieee.c (ieee_make_empty_symbol),
elf32-hppa.c (hppa_elf_stub_branch_reloc),
(hppa_elf_stub_reloc): Change callers.
* libbfd.h: Regenerated.
* archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name.
(_bfd_get_elt_at_filepos),
coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h:
Change callers.
* format.c (bfd_check_format_matches), libbfd-in.h, targets.c,
elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector
and default_vector to bfd_default_vector.
* libbfd.h: Regenerated.
1994-01-25 14:25:26 +01:00
|
|
|
|
for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
|
1993-11-18 18:12:47 +01:00
|
|
|
|
{
|
|
|
|
|
struct elf_backend_data *back;
|
|
|
|
|
|
|
|
|
|
if ((*target_ptr)->flavour != bfd_target_elf_flavour)
|
|
|
|
|
continue;
|
|
|
|
|
back = (struct elf_backend_data *) (*target_ptr)->backend_data;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
if (back->elf_machine_code == i_ehdrp->e_machine
|
|
|
|
|
|| (back->elf_machine_alt1 != 0
|
|
|
|
|
&& back->elf_machine_alt1 == i_ehdrp->e_machine)
|
|
|
|
|
|| (back->elf_machine_alt2 != 0
|
|
|
|
|
&& back->elf_machine_alt2 == i_ehdrp->e_machine))
|
1993-11-18 18:12:47 +01:00
|
|
|
|
{
|
|
|
|
|
/* target_ptr is an ELF backend which matches this
|
|
|
|
|
object file, so reject the generic ELF target. */
|
|
|
|
|
goto got_wrong_format_error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1993-11-09 00:33:56 +01:00
|
|
|
|
if (i_ehdrp->e_type == ET_EXEC)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
abfd->flags |= EXEC_P;
|
1993-11-09 00:33:56 +01:00
|
|
|
|
else if (i_ehdrp->e_type == ET_DYN)
|
|
|
|
|
abfd->flags |= DYNAMIC;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1994-06-05 22:00:42 +02:00
|
|
|
|
if (i_ehdrp->e_phnum > 0)
|
|
|
|
|
abfd->flags |= D_PAGED;
|
|
|
|
|
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
|
|
|
|
|
goto got_no_match;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
|
1993-11-18 18:12:47 +01:00
|
|
|
|
/* Remember the entry point specified in the ELF file header. */
|
|
|
|
|
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
|
|
|
|
|
/* Allocate space for a copy of the section header table in
|
|
|
|
|
internal form, seek to the section header table in the file,
|
1993-11-18 18:12:47 +01:00
|
|
|
|
read it in, and convert it to internal form. */
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
i_shdrp = ((Elf_Internal_Shdr *)
|
|
|
|
|
bfd_alloc (abfd, sizeof (*i_shdrp) * i_ehdrp->e_shnum));
|
|
|
|
|
elf_elfsections (abfd) = ((Elf_Internal_Shdr **)
|
|
|
|
|
bfd_alloc (abfd,
|
|
|
|
|
sizeof (i_shdrp) * i_ehdrp->e_shnum));
|
1994-03-17 17:47:01 +01:00
|
|
|
|
if (!i_shdrp || !elf_elfsections (abfd))
|
1995-11-29 23:05:37 +01:00
|
|
|
|
goto got_no_match;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0)
|
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated).
* som.c: Do not blindly set bfd_error_system_call after a
failing bfd_read, bfd_write, or bfd_seek. In a few places
(like som_object_p) override the error status set by bfd_read.
* aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
* coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
* elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
* nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
* som.c: Check return values from several bfd_{seek,read,write}
calls that we just assumed were not failing.
1994-03-26 19:28:29 +01:00
|
|
|
|
goto got_no_match;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
if (bfd_read ((PTR) & x_shdr, sizeof x_shdr, 1, abfd) != sizeof (x_shdr))
|
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated).
* som.c: Do not blindly set bfd_error_system_call after a
failing bfd_read, bfd_write, or bfd_seek. In a few places
(like som_object_p) override the error status set by bfd_read.
* aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
* coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
* elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
* nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
* som.c: Check return values from several bfd_{seek,read,write}
calls that we just assumed were not failing.
1994-03-26 19:28:29 +01:00
|
|
|
|
goto got_no_match;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
|
1994-03-17 17:47:01 +01:00
|
|
|
|
elf_elfsections (abfd)[shindex] = i_shdrp + shindex;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
1993-07-19 21:12:59 +02:00
|
|
|
|
if (i_ehdrp->e_shstrndx)
|
1993-06-18 19:45:41 +02:00
|
|
|
|
{
|
1994-04-25 21:36:51 +02:00
|
|
|
|
if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx))
|
|
|
|
|
goto got_no_match;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
1995-11-29 23:05:37 +01:00
|
|
|
|
/* Read in the program headers. */
|
|
|
|
|
if (i_ehdrp->e_phnum == 0)
|
|
|
|
|
elf_tdata (abfd)->phdr = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Elf_Internal_Phdr *i_phdr;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
elf_tdata (abfd)->phdr = ((Elf_Internal_Phdr *)
|
|
|
|
|
bfd_alloc (abfd,
|
|
|
|
|
(i_ehdrp->e_phnum
|
|
|
|
|
* sizeof (Elf_Internal_Phdr))));
|
|
|
|
|
if (elf_tdata (abfd)->phdr == NULL)
|
|
|
|
|
goto got_no_match;
|
|
|
|
|
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
|
|
|
|
|
goto got_no_match;
|
|
|
|
|
i_phdr = elf_tdata (abfd)->phdr;
|
|
|
|
|
for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
|
|
|
|
|
{
|
|
|
|
|
Elf_External_Phdr x_phdr;
|
|
|
|
|
|
|
|
|
|
if (bfd_read ((PTR) &x_phdr, sizeof x_phdr, 1, abfd)
|
|
|
|
|
!= sizeof x_phdr)
|
|
|
|
|
goto got_no_match;
|
|
|
|
|
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Read in the string table containing the names of the sections. We
|
|
|
|
|
will need the base pointer to this table later. */
|
|
|
|
|
/* We read this inline now, so that we don't have to go through
|
|
|
|
|
bfd_section_from_shdr with it (since this particular strtab is
|
|
|
|
|
used to find all of the ELF section names.) */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx);
|
1993-07-19 21:12:59 +02:00
|
|
|
|
if (!shstrtab)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
goto got_no_match;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* Once all of the section headers have been read and converted, we
|
|
|
|
|
can start processing them. Note that the first section header is
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
a dummy placeholder entry, so we ignore it. */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
|
|
|
|
|
{
|
1994-04-25 21:36:51 +02:00
|
|
|
|
if (! bfd_section_from_shdr (abfd, shindex))
|
|
|
|
|
goto got_no_match;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Make MIPS ELF use new ELF backend linker. No shared library
support yet.
* elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
(bfd_mips_elf32_swap_gptab_out): New function.
(mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
(mips_elf_final_write_processing): Set sh_info field for .gptab.*
sections.
(mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
(mips_elf_read_ecoff_info): Read and free external symbols last,
not first, for clarity.
(struct mips_elf_link_hash_entry): Define new structure.
(struct mips_elf_link_hash_table): Define new structure.
(mips_elf_link_hash_lookup): Define new macro.
(mips_elf_link_hash_traverse): Define new macro.
(mips_elf_hash_table): Define new macro.
(mips_elf_link_hash_newfunc): New static function.
(mips_elf_link_hash_table_create): New static function.
(mips_elf_add_symbol_hook): New static function.
(struct extsym_info): Define new structure.
(mips_elf_get_extr, mips_elf_set_index): Remove.
(mips_elf_output_extsym): New static function.
(gptab_compare): New static function.
(mips_elf_final_link): Rewrite to use ELF backend linker, and to
merge gptab information in input files.
(mips_elf_relocate_hi16): New static function.
(mips_elf_relocate_section): New static function.
(bfd_elf32_bfd_link_hash_table_create): Define as macro before
including elf32-target.h.
(elf_backend_relocate_section): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf.c (_bfd_elf_link_hash_newfunc): Rename from
elf_link_hash_newfunc and make globally visible. Change caller.
(_bfd_elf_link_hash_table_init): New function, broken out of
_bfd_elf_link_hash_table_create.
(_bfd_elf_link_hash_table_create): Use
_bfd_elf_link_hash_table_init.
* libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
(elf_bad_symtab): Define new accessor macro.
(_bfd_elf_link_hash_newfunc): Declare.
(_bew_elf_link_hash_table_init): Declare.
* elfcode.h (elf_object_p): Call backend object_p hook after
swapping in all the section headers.
(map_program_segments): Correct typo: Internal for External.
(elf_link_add_object_symbols): If elf_bad_symtab is set, read all
the symbols. Skip STB_LOCAL symbols rather than giving an error.
(elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
all symbols, not just locals.
(elf_link_output_extsym): Only skip a symbol not mentioned by a
regular file if it is mentioned by a dynamic object.
(elf_link_input_bfd): If elf_bad_symtab is set, read all the
symbols.
1994-05-24 22:44:50 +02:00
|
|
|
|
/* Let the backend double check the format and override global
|
|
|
|
|
information. */
|
|
|
|
|
if (ebd->elf_backend_object_p)
|
|
|
|
|
{
|
|
|
|
|
if ((*ebd->elf_backend_object_p) (abfd) == false)
|
|
|
|
|
goto got_wrong_format_error;
|
|
|
|
|
}
|
|
|
|
|
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
return (abfd->xvec);
|
|
|
|
|
|
1994-03-17 17:47:01 +01:00
|
|
|
|
got_wrong_format_error:
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-17 19:08:41 +01:00
|
|
|
|
bfd_set_error (bfd_error_wrong_format);
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
goto got_no_match;
|
1994-03-17 17:47:01 +01:00
|
|
|
|
got_no_match:
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
if (new_tdata != NULL
|
|
|
|
|
&& new_tdata->elf_sect_ptr != NULL)
|
|
|
|
|
bfd_release (abfd, new_tdata->elf_sect_ptr);
|
|
|
|
|
if (i_shdrp != NULL)
|
|
|
|
|
bfd_release (abfd, i_shdrp);
|
|
|
|
|
if (new_tdata != NULL)
|
|
|
|
|
bfd_release (abfd, new_tdata);
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
elf_tdata (abfd) = preserved_tdata;
|
|
|
|
|
return (NULL);
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ELF .o/exec file writing */
|
|
|
|
|
|
1996-02-14 22:32:24 +01:00
|
|
|
|
/* Try to convert a non-ELF reloc into an ELF one. */
|
|
|
|
|
|
|
|
|
|
static boolean
|
|
|
|
|
validate_reloc (abfd, areloc)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
arelent *areloc;
|
|
|
|
|
{
|
|
|
|
|
/* Check whether we really have an ELF howto. */
|
|
|
|
|
|
|
|
|
|
if ((*areloc->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec)
|
|
|
|
|
{
|
|
|
|
|
bfd_reloc_code_real_type code;
|
|
|
|
|
reloc_howto_type *howto;
|
|
|
|
|
|
|
|
|
|
/* Alien reloc: Try to determine its type to replace it with an
|
|
|
|
|
equivalent ELF reloc. */
|
|
|
|
|
|
|
|
|
|
if (areloc->howto->pc_relative)
|
|
|
|
|
{
|
|
|
|
|
switch (areloc->howto->bitsize)
|
|
|
|
|
{
|
|
|
|
|
case 8:
|
|
|
|
|
code = BFD_RELOC_8_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
case 12:
|
|
|
|
|
code = BFD_RELOC_12_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
case 16:
|
|
|
|
|
code = BFD_RELOC_16_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
case 24:
|
|
|
|
|
code = BFD_RELOC_24_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
case 32:
|
|
|
|
|
code = BFD_RELOC_32_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
case 64:
|
|
|
|
|
code = BFD_RELOC_64_PCREL;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
howto = bfd_reloc_type_lookup (abfd, code);
|
|
|
|
|
|
|
|
|
|
if (areloc->howto->pcrel_offset != howto->pcrel_offset)
|
|
|
|
|
{
|
|
|
|
|
if (howto->pcrel_offset)
|
|
|
|
|
areloc->addend += areloc->address;
|
|
|
|
|
else
|
|
|
|
|
areloc->addend -= areloc->address; /* addend is unsigned!! */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (areloc->howto->bitsize)
|
|
|
|
|
{
|
|
|
|
|
case 8:
|
|
|
|
|
code = BFD_RELOC_8;
|
|
|
|
|
break;
|
|
|
|
|
case 14:
|
|
|
|
|
code = BFD_RELOC_14;
|
|
|
|
|
break;
|
|
|
|
|
case 16:
|
|
|
|
|
code = BFD_RELOC_16;
|
|
|
|
|
break;
|
|
|
|
|
case 26:
|
|
|
|
|
code = BFD_RELOC_26;
|
|
|
|
|
break;
|
|
|
|
|
case 32:
|
|
|
|
|
code = BFD_RELOC_32;
|
|
|
|
|
break;
|
|
|
|
|
case 64:
|
|
|
|
|
code = BFD_RELOC_64;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
howto = bfd_reloc_type_lookup (abfd, code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (howto)
|
|
|
|
|
areloc->howto = howto;
|
|
|
|
|
else
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
fail:
|
|
|
|
|
(*_bfd_error_handler)
|
|
|
|
|
("%s: unsupported relocation type %s",
|
|
|
|
|
bfd_get_filename (abfd), areloc->howto->name);
|
|
|
|
|
bfd_set_error (bfd_error_bad_value);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out the relocs. */
|
|
|
|
|
|
1995-06-08 22:12:25 +02:00
|
|
|
|
static void
|
|
|
|
|
write_relocs (abfd, sec, data)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *sec;
|
1995-06-08 22:12:25 +02:00
|
|
|
|
PTR data;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
1995-06-08 22:12:25 +02:00
|
|
|
|
boolean *failedp = (boolean *) data;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
Elf_Internal_Shdr *rela_hdr;
|
|
|
|
|
Elf_External_Rela *outbound_relocas;
|
|
|
|
|
Elf_External_Rel *outbound_relocs;
|
* libelf.h: Rename to elf-bfd.h to avoid conflict with
systems that have a system <libelf.h>.
* Makefile.in: Globally replace libelf.h with elf-bfd.h.
* bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c,
elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c,
elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c,
elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c,
elfxx-target.h: Include elf-bfd.h rather than libelf.h.
* elfxx-target.h: Change libelf.h reference to elf-bfd.h.
1995-11-01 00:29:05 +01:00
|
|
|
|
unsigned int idx;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
|
1993-07-26 21:27:56 +02:00
|
|
|
|
asymbol *last_sym = 0;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
int last_sym_idx = 0;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1995-06-08 22:12:25 +02:00
|
|
|
|
/* If we have already failed, don't do anything. */
|
|
|
|
|
if (*failedp)
|
|
|
|
|
return;
|
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
if ((sec->flags & SEC_RELOC) == 0)
|
|
|
|
|
return;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
|
|
|
|
/* The linker backend writes the relocs out itself, and sets the
|
|
|
|
|
reloc_count field to zero to inhibit writing them here. Also,
|
|
|
|
|
sometimes the SEC_RELOC flag gets set even when there aren't any
|
|
|
|
|
relocs. */
|
1993-07-19 21:12:59 +02:00
|
|
|
|
if (sec->reloc_count == 0)
|
|
|
|
|
return;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
rela_hdr = &elf_section_data (sec)->rel_hdr;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
|
1995-06-08 22:12:25 +02:00
|
|
|
|
rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
|
|
|
|
|
if (rela_hdr->contents == NULL)
|
Make all callers of malloc or realloc (including via obstacks)
check the result for NULL. Most set bfd_error to no_memory and
return in that case; a few are harder to fix, and are marked
with "FIXME <return type>".
* elf32-hppa.c (hppa_elf_build_arg_reloc_stub
hppa_elf_build_long_branch_stub): Check bfd_make_empty_symbol return.
* linker.c (_bfd_generic_link_output_symbols
_bfd_generic_link_write_global_symbol): Ditto
* section.c (bfd_make_section_anyway): Ditto.
* tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
(first_phase): Ditto. FIXME void
(tekhex_make_empty_symbol): Check bfd_zalloc.
* sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
(MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.
* stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.
* srec.c: Indent.
(fillup_symbols): Check bfd_alloc. FIXME void
(srec_mkobject srec_get_section_contents
srec_set_section_contents): Check bfd_alloc.
(srec_make_empty_symbol): Check bfd_zalloc.
* som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
(make_unique_section): Check bfd_alloc.
(som_new_section_hook): Check bfd_zalloc.
(bfd_som_attach_aux_hdr): Ditto. FIXME void
* rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.
* osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
(osf_core_core_file_p): Check bfd_alloc.
* oasys.c (oasys_slurp_symbol_table oasys_archive_p
oasys_mkobject oasys_object_p oasys_new_section_hook
oasys_set_section_contents): Check bfd_alloc.
(oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
(oasys_make_empty_symbol): Check bfd_zalloc.
* nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
(nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.
* nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.
* nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.
* nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.
* linker.c (_bfd_link_hash_newfunc
(generic_link_hash_newfunc
(archive_hash_newfunc
(_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
(_bfd_generic_final_link
(_bfd_generic_link_output_symbols
(default_indirect_link_order): Check bfd_alloc.
(bfd_new_link_order): Check bfd_alloc_by_size_t.
* irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.
* ieee.c: Indent.
(read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
(do_one): Check bfd_alloc. Return a boolean.
(ieee_slurp_section_data): Check it.
(init_for_output): Check bfd_alloc. Return a boolean.
(ieee_set_section_contents): Check it.
(do_with_relocs): Check bfd_alloc. Return a boolean.
(ieee_bfd_debug_info_accumulate): Ditto. FIXME void.
(ieee_mkobject): Check bfd_zalloc.
(ieee_make_empty_symbol): Check bfd_zmalloc.
* hpux-core.c (hpux_core_make_empty_symbol): Check
bfd_zalloc.
* hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
bfd_zalloc.
(hppabsd_core_core_file_p): Check bfd_zalloc.
* hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.
* elfcode.h (elf_new_section_hook): Check bfd_alloc.
(bfd_section_from_phdr): Ditto.
(write_relocs): Ditto. FIXME void
(elf_map_symbols assign_section_numbers map_program_segments):
Ditto. Return a boolean.
(swap_out_syms): Ditto. Check elf_map_symbols.
(elf_slurp_symbol_table): Check bfd_zalloc.
(elf_slurp_reloca_table): Check bfd_alloc.
(elf_slurp_reloc_table): Ditto.
(elf_compute_section_file_positions): Check assign_section_numbers.
(assign_file_positions_except_relocs): Return a boolean.
Check map_program_segments.
(elf_compute_section_file_positions): Check it.
* elf32-mips.c (mips_elf_final_link): Check bfd_alloc.
* elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
realloc.
(hppa_elf_stub_reloc): Ditto.
(hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
(hppa_elf_build_long_branch_stub): Ditto.
(elf32_hppa_backend_symbol_table_processing): Ditto.
* ecoff.c (ecoff_set_symbol_info): Check bfd_alloc. Return a boolean.
(ecoff_slurp_symbol_table): Check it.
(ecoff_slurp_armap): Check bfd_alloc.
(ecoff_write_armap): Check bfd_zalloc.
(ecoff_link_hash_newfunc): Check bfd_hash_allocate and
_bfd_link_hash_newfunc.
(ecoff_link_add_externals): Check bfd_alloc.
* ctor.c (bfd_constructor_entry): Check bfd_alloc.
* coffgen.c (coff_real_object_p): Check bfd_alloc.
(coff_renumber_symbols): Check bfd_alloc_by_size_t. Return a boolean.
(coff_write_symbol): Check bfd_alloc. FIXME int
(coff_write_linenumbers): Check bfd_alloc. Return a boolean.
(coff_section_symbol): Check bfd_alloc_by_size_t.
(coff_get_normalized_symtab): Check bfd_alloc.
(coff_bfd_make_debug_symbol): Check bfd_zalloc.
* libcoff-in.h: Change decls of coff_renumber_symbols,
coff_write_linenumbers.
* libcoff.h: Rebuilt.
* coffcode.h (coff_write_object_contents): Check
coff_renumber_symbols, coff_write_linenumbers.
* coffcode.h: Indent.
(coff_add_missing_symbols): Check bfd_alloc_by_size_t. Return a
boolean.
(coff_write_object_contents): Check it.
* coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
* coff-mips.c (mips_relocate_section): Ditto.
* archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
(do_slurp_bsd_armap): Ditto.
(compute_and_write_armap): Check bfd_realloc value.
* aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
return value. Return boolean value.
(NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
(NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
return value.
(add_to_stringtab): Ditto. FIXME void
(aout_link_hash_newfunc): Check bfd_hash_allocate return value.
(aout_link_add_symbols): Check bfd_alloc value.
(translate_symbol_table): Check translate_from_native_sym_flags.
* hp300hpux.c (MY(slurp_symbol_table)): Ditto.
* aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.
* opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.
* opncls.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(_bfd_new_bfd): Check obstack_begin for 0 return.
* ieee.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(ieee_archive_p): Check obstack_begin for 0 return and
obstack_finish for NULL return.
* hash.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(bfd_hash_table_init_n): Check obstack_begin for 0 return and
obstack_finish for NULL return.
(bfd_hash_lookup): Check obstack_alloc for NULL return.
* ecofflink.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
bfd_ecoff_debug_accumulate
bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
(add_file_shuffle add_memory_shuffle): Check obstack_alloc for
NULL return. Return boolean, not void.
(bfd_ecoff_debug_init): Check obstack_begin for 0 return.
(bfd_ecoff_debug_accumulate): Check add_file_shuffle
and add_memory_shuffle return.
(string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
(bfd_ecoff_debug_accumulate): Check bfd_alloc.
(ecoff_add_string): Check add_memory_shuffle return.
* libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
Remove decls.
* libbfd.h: Rebuilt.
1994-02-12 01:45:54 +01:00
|
|
|
|
{
|
1995-06-08 22:12:25 +02:00
|
|
|
|
*failedp = true;
|
|
|
|
|
return;
|
Make all callers of malloc or realloc (including via obstacks)
check the result for NULL. Most set bfd_error to no_memory and
return in that case; a few are harder to fix, and are marked
with "FIXME <return type>".
* elf32-hppa.c (hppa_elf_build_arg_reloc_stub
hppa_elf_build_long_branch_stub): Check bfd_make_empty_symbol return.
* linker.c (_bfd_generic_link_output_symbols
_bfd_generic_link_write_global_symbol): Ditto
* section.c (bfd_make_section_anyway): Ditto.
* tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
(first_phase): Ditto. FIXME void
(tekhex_make_empty_symbol): Check bfd_zalloc.
* sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
(MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.
* stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.
* srec.c: Indent.
(fillup_symbols): Check bfd_alloc. FIXME void
(srec_mkobject srec_get_section_contents
srec_set_section_contents): Check bfd_alloc.
(srec_make_empty_symbol): Check bfd_zalloc.
* som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
(make_unique_section): Check bfd_alloc.
(som_new_section_hook): Check bfd_zalloc.
(bfd_som_attach_aux_hdr): Ditto. FIXME void
* rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.
* osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
(osf_core_core_file_p): Check bfd_alloc.
* oasys.c (oasys_slurp_symbol_table oasys_archive_p
oasys_mkobject oasys_object_p oasys_new_section_hook
oasys_set_section_contents): Check bfd_alloc.
(oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
(oasys_make_empty_symbol): Check bfd_zalloc.
* nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
(nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.
* nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.
* nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.
* nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.
* linker.c (_bfd_link_hash_newfunc
(generic_link_hash_newfunc
(archive_hash_newfunc
(_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
(_bfd_generic_final_link
(_bfd_generic_link_output_symbols
(default_indirect_link_order): Check bfd_alloc.
(bfd_new_link_order): Check bfd_alloc_by_size_t.
* irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.
* ieee.c: Indent.
(read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
(do_one): Check bfd_alloc. Return a boolean.
(ieee_slurp_section_data): Check it.
(init_for_output): Check bfd_alloc. Return a boolean.
(ieee_set_section_contents): Check it.
(do_with_relocs): Check bfd_alloc. Return a boolean.
(ieee_bfd_debug_info_accumulate): Ditto. FIXME void.
(ieee_mkobject): Check bfd_zalloc.
(ieee_make_empty_symbol): Check bfd_zmalloc.
* hpux-core.c (hpux_core_make_empty_symbol): Check
bfd_zalloc.
* hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
bfd_zalloc.
(hppabsd_core_core_file_p): Check bfd_zalloc.
* hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.
* elfcode.h (elf_new_section_hook): Check bfd_alloc.
(bfd_section_from_phdr): Ditto.
(write_relocs): Ditto. FIXME void
(elf_map_symbols assign_section_numbers map_program_segments):
Ditto. Return a boolean.
(swap_out_syms): Ditto. Check elf_map_symbols.
(elf_slurp_symbol_table): Check bfd_zalloc.
(elf_slurp_reloca_table): Check bfd_alloc.
(elf_slurp_reloc_table): Ditto.
(elf_compute_section_file_positions): Check assign_section_numbers.
(assign_file_positions_except_relocs): Return a boolean.
Check map_program_segments.
(elf_compute_section_file_positions): Check it.
* elf32-mips.c (mips_elf_final_link): Check bfd_alloc.
* elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
realloc.
(hppa_elf_stub_reloc): Ditto.
(hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
(hppa_elf_build_long_branch_stub): Ditto.
(elf32_hppa_backend_symbol_table_processing): Ditto.
* ecoff.c (ecoff_set_symbol_info): Check bfd_alloc. Return a boolean.
(ecoff_slurp_symbol_table): Check it.
(ecoff_slurp_armap): Check bfd_alloc.
(ecoff_write_armap): Check bfd_zalloc.
(ecoff_link_hash_newfunc): Check bfd_hash_allocate and
_bfd_link_hash_newfunc.
(ecoff_link_add_externals): Check bfd_alloc.
* ctor.c (bfd_constructor_entry): Check bfd_alloc.
* coffgen.c (coff_real_object_p): Check bfd_alloc.
(coff_renumber_symbols): Check bfd_alloc_by_size_t. Return a boolean.
(coff_write_symbol): Check bfd_alloc. FIXME int
(coff_write_linenumbers): Check bfd_alloc. Return a boolean.
(coff_section_symbol): Check bfd_alloc_by_size_t.
(coff_get_normalized_symtab): Check bfd_alloc.
(coff_bfd_make_debug_symbol): Check bfd_zalloc.
* libcoff-in.h: Change decls of coff_renumber_symbols,
coff_write_linenumbers.
* libcoff.h: Rebuilt.
* coffcode.h (coff_write_object_contents): Check
coff_renumber_symbols, coff_write_linenumbers.
* coffcode.h: Indent.
(coff_add_missing_symbols): Check bfd_alloc_by_size_t. Return a
boolean.
(coff_write_object_contents): Check it.
* coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
* coff-mips.c (mips_relocate_section): Ditto.
* archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
(do_slurp_bsd_armap): Ditto.
(compute_and_write_armap): Check bfd_realloc value.
* aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
return value. Return boolean value.
(NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
(NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
return value.
(add_to_stringtab): Ditto. FIXME void
(aout_link_hash_newfunc): Check bfd_hash_allocate return value.
(aout_link_add_symbols): Check bfd_alloc value.
(translate_symbol_table): Check translate_from_native_sym_flags.
* hp300hpux.c (MY(slurp_symbol_table)): Ditto.
* aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.
* opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.
* opncls.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(_bfd_new_bfd): Check obstack_begin for 0 return.
* ieee.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(ieee_archive_p): Check obstack_begin for 0 return and
obstack_finish for NULL return.
* hash.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(bfd_hash_table_init_n): Check obstack_begin for 0 return and
obstack_finish for NULL return.
(bfd_hash_lookup): Check obstack_alloc for NULL return.
* ecofflink.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
bfd_ecoff_debug_accumulate
bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
(add_file_shuffle add_memory_shuffle): Check obstack_alloc for
NULL return. Return boolean, not void.
(bfd_ecoff_debug_init): Check obstack_begin for 0 return.
(bfd_ecoff_debug_accumulate): Check add_file_shuffle
and add_memory_shuffle return.
(string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
(bfd_ecoff_debug_accumulate): Check bfd_alloc.
(ecoff_add_string): Check add_memory_shuffle return.
* libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
Remove decls.
* libbfd.h: Rebuilt.
1994-02-12 01:45:54 +01:00
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-19 21:12:59 +02:00
|
|
|
|
/* orelocation has the data, reloc_count has the count... */
|
1993-07-26 21:27:56 +02:00
|
|
|
|
if (use_rela_p)
|
|
|
|
|
{
|
|
|
|
|
outbound_relocas = (Elf_External_Rela *) rela_hdr->contents;
|
|
|
|
|
|
|
|
|
|
for (idx = 0; idx < sec->reloc_count; idx++)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
1993-07-26 21:27:56 +02:00
|
|
|
|
Elf_Internal_Rela dst_rela;
|
|
|
|
|
Elf_External_Rela *src_rela;
|
|
|
|
|
arelent *ptr;
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
ptr = sec->orelocation[idx];
|
|
|
|
|
src_rela = outbound_relocas + idx;
|
1994-12-09 18:57:47 +01:00
|
|
|
|
|
|
|
|
|
/* The address of an ELF reloc is section relative for an object
|
|
|
|
|
file, and absolute for an executable file or shared library.
|
|
|
|
|
The address of a BFD reloc is always section relative. */
|
|
|
|
|
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
|
1993-07-26 21:27:56 +02:00
|
|
|
|
dst_rela.r_offset = ptr->address;
|
1994-12-09 18:57:47 +01:00
|
|
|
|
else
|
|
|
|
|
dst_rela.r_offset = ptr->address + sec->vma;
|
1993-07-06 22:43:42 +02:00
|
|
|
|
|
1993-07-26 21:27:56 +02:00
|
|
|
|
sym = *ptr->sym_ptr_ptr;
|
|
|
|
|
if (sym == last_sym)
|
|
|
|
|
n = last_sym_idx;
|
|
|
|
|
else
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
1993-07-26 21:27:56 +02:00
|
|
|
|
last_sym = sym;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
|
|
|
|
|
if (n < 0)
|
|
|
|
|
{
|
|
|
|
|
*failedp = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
last_sym_idx = n;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
1996-02-14 22:32:24 +01:00
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
|
1996-02-14 22:32:24 +01:00
|
|
|
|
&& ! validate_reloc (abfd, ptr))
|
|
|
|
|
{
|
|
|
|
|
*failedp = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-26 21:27:56 +02:00
|
|
|
|
dst_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
|
|
|
|
|
|
|
|
|
|
dst_rela.r_addend = ptr->addend;
|
|
|
|
|
elf_swap_reloca_out (abfd, &dst_rela, src_rela);
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
1993-07-26 21:27:56 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* REL relocations */
|
|
|
|
|
{
|
|
|
|
|
outbound_relocs = (Elf_External_Rel *) rela_hdr->contents;
|
|
|
|
|
|
|
|
|
|
for (idx = 0; idx < sec->reloc_count; idx++)
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
1993-07-26 21:27:56 +02:00
|
|
|
|
Elf_Internal_Rel dst_rel;
|
|
|
|
|
Elf_External_Rel *src_rel;
|
|
|
|
|
arelent *ptr;
|
|
|
|
|
int n;
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
|
|
|
|
|
ptr = sec->orelocation[idx];
|
|
|
|
|
sym = *ptr->sym_ptr_ptr;
|
|
|
|
|
src_rel = outbound_relocs + idx;
|
1994-12-09 18:57:47 +01:00
|
|
|
|
|
|
|
|
|
/* The address of an ELF reloc is section relative for an object
|
|
|
|
|
file, and absolute for an executable file or shared library.
|
|
|
|
|
The address of a BFD reloc is always section relative. */
|
|
|
|
|
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
|
1993-07-26 21:27:56 +02:00
|
|
|
|
dst_rel.r_offset = ptr->address;
|
1994-12-09 18:57:47 +01:00
|
|
|
|
else
|
|
|
|
|
dst_rel.r_offset = ptr->address + sec->vma;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
1993-07-26 21:27:56 +02:00
|
|
|
|
if (sym == last_sym)
|
|
|
|
|
n = last_sym_idx;
|
|
|
|
|
else
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
1993-07-26 21:27:56 +02:00
|
|
|
|
last_sym = sym;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
|
|
|
|
|
if (n < 0)
|
|
|
|
|
{
|
|
|
|
|
*failedp = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
last_sym_idx = n;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
1996-02-14 22:32:24 +01:00
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
|
1996-02-14 22:32:24 +01:00
|
|
|
|
&& ! validate_reloc (abfd, ptr))
|
|
|
|
|
{
|
|
|
|
|
*failedp = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-26 21:27:56 +02:00
|
|
|
|
dst_rel.r_info = ELF_R_INFO (n, ptr->howto->type);
|
|
|
|
|
|
|
|
|
|
elf_swap_reloc_out (abfd, &dst_rel, src_rel);
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
1993-07-26 21:27:56 +02:00
|
|
|
|
}
|
1993-07-19 21:12:59 +02:00
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
/* Write out the program headers. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
elf_write_out_phdrs (abfd, phdr, count)
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
bfd *abfd;
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
const Elf_Internal_Phdr *phdr;
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
int count;
|
|
|
|
|
{
|
|
|
|
|
while (count--)
|
1994-06-05 22:00:42 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Elf_External_Phdr extphdr;
|
|
|
|
|
elf_swap_phdr_out (abfd, phdr, &extphdr);
|
|
|
|
|
if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), 1, abfd)
|
|
|
|
|
!= sizeof (Elf_External_Phdr))
|
|
|
|
|
return -1;
|
|
|
|
|
phdr++;
|
1994-06-05 22:00:42 +02:00
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
return 0;
|
1994-06-05 22:00:42 +02:00
|
|
|
|
}
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
/* Write out the section headers and the ELF file header. */
|
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
elf_write_shdrs_and_ehdr (abfd)
|
1994-06-05 22:00:42 +02:00
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
|
|
|
|
|
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
|
|
|
|
|
Elf_External_Shdr *x_shdrp; /* Section header table, external form */
|
|
|
|
|
Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
|
|
|
|
|
unsigned int count;
|
1994-06-15 21:58:59 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
i_ehdrp = elf_elfheader (abfd);
|
|
|
|
|
i_shdrp = elf_elfsections (abfd);
|
1994-06-15 21:58:59 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* swap the header before spitting it out... */
|
1994-06-05 22:00:42 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#if DEBUG & 1
|
|
|
|
|
elf_debug_file (i_ehdrp);
|
|
|
|
|
#endif
|
|
|
|
|
elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
|
|
|
|
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
|
|
|
|
|
|| (bfd_write ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd)
|
|
|
|
|
!= sizeof (x_ehdr)))
|
|
|
|
|
return false;
|
1994-06-05 22:00:42 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* at this point we've concocted all the ELF sections... */
|
|
|
|
|
x_shdrp = (Elf_External_Shdr *)
|
|
|
|
|
bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
|
|
|
|
|
if (!x_shdrp)
|
1995-11-29 23:05:37 +01:00
|
|
|
|
return false;
|
1994-06-05 22:00:42 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
for (count = 0; count < i_ehdrp->e_shnum; count++)
|
1994-06-05 22:00:42 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#if DEBUG & 2
|
|
|
|
|
elf_debug_section (count, i_shdrp[count]);
|
|
|
|
|
#endif
|
|
|
|
|
elf_swap_shdr_out (abfd, i_shdrp[count], x_shdrp + count);
|
1994-06-05 22:00:42 +02:00
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
|
|
|
|
|
|| (bfd_write ((PTR) x_shdrp, sizeof (*x_shdrp), i_ehdrp->e_shnum, abfd)
|
|
|
|
|
!= sizeof (*x_shdrp) * i_ehdrp->e_shnum))
|
|
|
|
|
return false;
|
1994-06-05 22:00:42 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* need to dump the string table too... */
|
1994-06-05 22:00:42 +02:00
|
|
|
|
|
|
|
|
|
return true;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
long
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
elf_slurp_symbol_table (abfd, symptrs, dynamic)
|
1993-11-18 18:12:47 +01:00
|
|
|
|
bfd *abfd;
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
asymbol **symptrs; /* Buffer for generated bfd symbols */
|
|
|
|
|
boolean dynamic;
|
1993-07-19 21:12:59 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Elf_Internal_Shdr *hdr;
|
|
|
|
|
long symcount; /* Number of external ELF symbols */
|
|
|
|
|
elf_symbol_type *sym; /* Pointer to current bfd symbol */
|
|
|
|
|
elf_symbol_type *symbase; /* Buffer for generated bfd symbols */
|
|
|
|
|
Elf_Internal_Sym i_sym;
|
|
|
|
|
Elf_External_Sym *x_symp = NULL;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Read each raw ELF symbol, converting from external ELF form to
|
|
|
|
|
internal ELF form, and then using the information to create a
|
|
|
|
|
canonical bfd symbol table entry.
|
1993-07-06 22:43:42 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Note that we allocate the initial bfd canonical symbol buffer
|
|
|
|
|
based on a one-to-one mapping of the ELF symbols to canonical
|
|
|
|
|
symbols. We actually use all the ELF symbols, so there will be no
|
|
|
|
|
space left over at the end. When we have all the symbols, we
|
|
|
|
|
build the caller's pointer vector. */
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (dynamic)
|
|
|
|
|
hdr = &elf_tdata (abfd)->dynsymtab_hdr;
|
|
|
|
|
else
|
|
|
|
|
hdr = &elf_tdata (abfd)->symtab_hdr;
|
|
|
|
|
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
|
|
|
|
|
return -1;
|
1993-06-18 19:45:41 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
|
* elfcode.h (elf_build_phdrs): Unused function deleted.
(bfd_shdr_from_section): Ditto.
(write_relocs): Don't change section contents for addend.
(elf_locate_sh): Return type is now always elf_internal_shdr, since the other
types were really aliases for this type anyways. Don't compile this function,
since it is static and doesn't appear to be used in this file.
(sym_is_global): Return non-zero for weak symbols. Abort if sec ptr is null.
(swap_out_syms): Reorder tests so function symbols can be weak.
(elf_slurp_symbol_table): Don't use BSF_EXPORT.
(elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
extracting out some common code. Abort if BFD section symbol has null name.
(elf_slurp_reloc_table): Translate ELF section symbols into BFD section
symbols. Don't read section contents to fill in addend field.
* Merged from OSF:
Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
* libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
specific information for a symbol. Put in elf_sym_num, which
gives the external symbol number in the elf object file, since
local symbols must come before global symbols.
(elf_sym_extra): New macro.
(elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
* elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
symbol number to external number. Store the address of the
Elf_Sym_Extra field for the symbol in the udata field.
(elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add field to count the size of the
array of pointers to section symbols.
(elf_map_symbols): Bump the max index of the section symbols so
that we don't overwrite memory. Store the max index into the
elf_obj_tdata field.
Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
* elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
to the section symbols we created. Remove unused field internal_syms.
(elf_map_symbols): Fill in array of pointers to section symbols. Only create
section symbols for sections that have SEC_ALLOC set, and have non-zero size.
(elf_symbol_from_bfd_symbol): If udata is NULL, and this is a section symbol,
look up the section in the list of section symbols, and set the udata pointer
appropriately. Otherwise, if udata is still NULL, fail an assertion, and use
0, instead of dropping core.
1993-08-21 00:21:49 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (symcount == 0)
|
|
|
|
|
sym = symbase = NULL;
|
|
|
|
|
else
|
1993-09-17 00:24:33 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
long i;
|
1994-10-17 19:27:40 +01:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
|
|
|
|
|
return -1;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
symbase = ((elf_symbol_type *)
|
|
|
|
|
bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type)));
|
|
|
|
|
if (symbase == (elf_symbol_type *) NULL)
|
1995-11-29 23:05:37 +01:00
|
|
|
|
return -1;
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym = symbase;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Temporarily allocate room for the raw ELF symbols. */
|
|
|
|
|
x_symp = ((Elf_External_Sym *)
|
1995-12-01 20:48:10 +01:00
|
|
|
|
bfd_malloc (symcount * sizeof (Elf_External_Sym)));
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (x_symp == NULL && symcount != 0)
|
1995-12-01 20:48:10 +01:00
|
|
|
|
goto error_return;
|
1994-08-12 17:51:09 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (bfd_read ((PTR) x_symp, sizeof (Elf_External_Sym), symcount, abfd)
|
|
|
|
|
!= symcount * sizeof (Elf_External_Sym))
|
|
|
|
|
goto error_return;
|
|
|
|
|
/* Skip first symbol, which is a null dummy. */
|
|
|
|
|
for (i = 1; i < symcount; i++)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
elf_swap_symbol_in (abfd, x_symp + i, &i_sym);
|
|
|
|
|
memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym));
|
|
|
|
|
#ifdef ELF_KEEP_EXTSYM
|
|
|
|
|
memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym));
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
#endif
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.the_bfd = abfd;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.name = bfd_elf_string_from_elf_section (abfd,
|
|
|
|
|
hdr->sh_link,
|
|
|
|
|
i_sym.st_name);
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.value = i_sym.st_value;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (i_sym.st_shndx > 0 && i_sym.st_shndx < SHN_LORESERVE)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.section = section_from_elf_index (abfd,
|
|
|
|
|
i_sym.st_shndx);
|
|
|
|
|
if (sym->symbol.section == NULL)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* This symbol is in a section for which we did not
|
|
|
|
|
create a BFD section. Just use bfd_abs_section,
|
|
|
|
|
although it is wrong. FIXME. */
|
|
|
|
|
sym->symbol.section = bfd_abs_section_ptr;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
else if (i_sym.st_shndx == SHN_ABS)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.section = bfd_abs_section_ptr;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
else if (i_sym.st_shndx == SHN_COMMON)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.section = bfd_com_section_ptr;
|
|
|
|
|
/* Elf puts the alignment into the `value' field, and
|
|
|
|
|
the size into the `size' field. BFD wants to see the
|
|
|
|
|
size in the value field, and doesn't care (at the
|
|
|
|
|
moment) about the alignment. */
|
|
|
|
|
sym->symbol.value = i_sym.st_size;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
else if (i_sym.st_shndx == SHN_UNDEF)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.section = bfd_und_section_ptr;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.section = bfd_abs_section_ptr;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym->symbol.value -= sym->symbol.section->vma;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
switch (ELF_ST_BIND (i_sym.st_info))
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
case STB_LOCAL:
|
|
|
|
|
sym->symbol.flags |= BSF_LOCAL;
|
1994-10-31 01:04:03 +01:00
|
|
|
|
break;
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
case STB_GLOBAL:
|
|
|
|
|
if (i_sym.st_shndx != SHN_UNDEF
|
|
|
|
|
&& i_sym.st_shndx != SHN_COMMON)
|
|
|
|
|
sym->symbol.flags |= BSF_GLOBAL;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
break;
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
case STB_WEAK:
|
|
|
|
|
sym->symbol.flags |= BSF_WEAK;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
switch (ELF_ST_TYPE (i_sym.st_info))
|
Use a hash table when writing out ELF symbol names.
* elfcode.h (elf_stringtab_init): New static function.
(bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
Change all callers to use elf_stringtab_init or
_bfd_stringtab_add, and get stringtab lengths using
_bfd_stringtab_size.
(elf_fake_sections): Change ignored argument to pointer to
boolean, and set the boolean to true if an error occurs. If an
error has already occurred, don't do anything.
(assign_section_numbers): Just set sh_size, not contents.
(elf_compute_section_file_positions): Pass the address of a
boolean to elf_fake_sections. Pass the address of a
bfd_strtab_hash to swap_out_syms. Write out the .strtab section.
(prep_headers): Change shstrtab to bfd_strtab_hash.
(swap_out_syms): Take a pointer to a bfd_strtab_hash as an
argument. Set it to the symbol names.
(NAME(bfd_elf,write_object_contents)): Write out the section
header names using _bfd_stringtab_emit.
(elf_debug_section): Remove first argument; get the section name
via the bfd_section pointer. Change caller.
(elf_bfd_final_link): Write out the symbol names using
_bfd_stringtab_emit. Likewise for the .dynstr section contents.
Free the symbol names at the end of the function.
(elf_link_input_bfd): Remove the last argument, output_names,
from relocate_section. Save the old symbol contents before
calling elf_link_output_sym, and restore them afterward.
* libelf.h (struct elf_link_hash_table): Change dynstr field to
struct bfd_strtab_hash.
(struct elf_backend_data): Remove last argument, output_names,
from elf_backend_relocate_section field.
(struct strtab): Don't define.
(struct elf_obj_tdata): Change strtab_ptr field to struct
bfd_strtab_hash.
* elf32-hppa.c (elf32_hppa_relocate_section): Remove last
argument, output_names.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-mips.c (mips_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-17 23:03:14 +01:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
case STT_SECTION:
|
|
|
|
|
sym->symbol.flags |= BSF_SECTION_SYM | BSF_DEBUGGING;
|
|
|
|
|
break;
|
|
|
|
|
case STT_FILE:
|
|
|
|
|
sym->symbol.flags |= BSF_FILE | BSF_DEBUGGING;
|
|
|
|
|
break;
|
|
|
|
|
case STT_FUNC:
|
|
|
|
|
sym->symbol.flags |= BSF_FUNCTION;
|
|
|
|
|
break;
|
1996-02-14 22:32:24 +01:00
|
|
|
|
case STT_OBJECT:
|
|
|
|
|
sym->symbol.flags |= BSF_OBJECT;
|
|
|
|
|
break;
|
Use a hash table when writing out ELF symbol names.
* elfcode.h (elf_stringtab_init): New static function.
(bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
Change all callers to use elf_stringtab_init or
_bfd_stringtab_add, and get stringtab lengths using
_bfd_stringtab_size.
(elf_fake_sections): Change ignored argument to pointer to
boolean, and set the boolean to true if an error occurs. If an
error has already occurred, don't do anything.
(assign_section_numbers): Just set sh_size, not contents.
(elf_compute_section_file_positions): Pass the address of a
boolean to elf_fake_sections. Pass the address of a
bfd_strtab_hash to swap_out_syms. Write out the .strtab section.
(prep_headers): Change shstrtab to bfd_strtab_hash.
(swap_out_syms): Take a pointer to a bfd_strtab_hash as an
argument. Set it to the symbol names.
(NAME(bfd_elf,write_object_contents)): Write out the section
header names using _bfd_stringtab_emit.
(elf_debug_section): Remove first argument; get the section name
via the bfd_section pointer. Change caller.
(elf_bfd_final_link): Write out the symbol names using
_bfd_stringtab_emit. Likewise for the .dynstr section contents.
Free the symbol names at the end of the function.
(elf_link_input_bfd): Remove the last argument, output_names,
from relocate_section. Save the old symbol contents before
calling elf_link_output_sym, and restore them afterward.
* libelf.h (struct elf_link_hash_table): Change dynstr field to
struct bfd_strtab_hash.
(struct elf_backend_data): Remove last argument, output_names,
from elf_backend_relocate_section field.
(struct strtab): Don't define.
(struct elf_obj_tdata): Change strtab_ptr field to struct
bfd_strtab_hash.
* elf32-hppa.c (elf32_hppa_relocate_section): Remove last
argument, output_names.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-mips.c (mips_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-17 23:03:14 +01:00
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (dynamic)
|
|
|
|
|
sym->symbol.flags |= BSF_DYNAMIC;
|
1994-09-13 00:16:27 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Do some backend-specific processing on this symbol. */
|
|
|
|
|
{
|
|
|
|
|
struct elf_backend_data *ebd = get_elf_backend_data (abfd);
|
|
|
|
|
if (ebd->elf_backend_symbol_processing)
|
|
|
|
|
(*ebd->elf_backend_symbol_processing) (abfd, &sym->symbol);
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym++;
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Do some backend-specific processing on this symbol table. */
|
|
|
|
|
{
|
|
|
|
|
struct elf_backend_data *ebd = get_elf_backend_data (abfd);
|
|
|
|
|
if (ebd->elf_backend_symbol_table_processing)
|
|
|
|
|
(*ebd->elf_backend_symbol_table_processing) (abfd, symbase, symcount);
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* We rely on the zalloc to clear out the final symbol entry. */
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
symcount = sym - symbase;
|
1994-07-05 20:05:03 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Fill in the user's symbol pointer vector if needed. */
|
|
|
|
|
if (symptrs)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
long l = symcount;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
sym = symbase;
|
|
|
|
|
while (l-- > 0)
|
|
|
|
|
{
|
|
|
|
|
*symptrs++ = &sym->symbol;
|
|
|
|
|
sym++;
|
|
|
|
|
}
|
|
|
|
|
*symptrs = 0; /* Final null pointer */
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (x_symp != NULL)
|
|
|
|
|
free (x_symp);
|
|
|
|
|
return symcount;
|
|
|
|
|
error_return:
|
|
|
|
|
if (x_symp != NULL)
|
|
|
|
|
free (x_symp);
|
|
|
|
|
return -1;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Read in and swap the external relocs. */
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
|
|
|
|
static boolean
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
elf_slurp_reloc_table (abfd, asect, symbols)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *asect;
|
|
|
|
|
asymbol **symbols;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
|
|
|
|
|
struct bfd_elf_section_data * const d = elf_section_data (asect);
|
|
|
|
|
PTR allocated = NULL;
|
|
|
|
|
bfd_byte *native_relocs;
|
|
|
|
|
arelent *relents;
|
|
|
|
|
arelent *relent;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
int entsize;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (asect->relocation != NULL
|
|
|
|
|
|| (asect->flags & SEC_RELOC) == 0
|
|
|
|
|
|| asect->reloc_count == 0)
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
return true;
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
BFD_ASSERT (asect->rel_filepos == d->rel_hdr.sh_offset
|
|
|
|
|
&& (asect->reloc_count
|
|
|
|
|
== d->rel_hdr.sh_size / d->rel_hdr.sh_entsize));
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
1995-12-01 20:48:10 +01:00
|
|
|
|
allocated = (PTR) bfd_malloc ((size_t) d->rel_hdr.sh_size);
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (allocated == NULL)
|
1995-12-01 20:48:10 +01:00
|
|
|
|
goto error_return;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0
|
|
|
|
|
|| (bfd_read (allocated, 1, d->rel_hdr.sh_size, abfd)
|
|
|
|
|
!= d->rel_hdr.sh_size))
|
|
|
|
|
goto error_return;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
native_relocs = (bfd_byte *) allocated;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
relents = ((arelent *)
|
|
|
|
|
bfd_alloc (abfd, asect->reloc_count * sizeof (arelent)));
|
|
|
|
|
if (relents == NULL)
|
1995-11-29 23:05:37 +01:00
|
|
|
|
goto error_return;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
entsize = d->rel_hdr.sh_entsize;
|
|
|
|
|
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
|
|
|
|
|
|| entsize == sizeof (Elf_External_Rela));
|
|
|
|
|
|
|
|
|
|
for (i = 0, relent = relents;
|
|
|
|
|
i < asect->reloc_count;
|
|
|
|
|
i++, relent++, native_relocs += entsize)
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
Elf_Internal_Rela rela;
|
|
|
|
|
Elf_Internal_Rel rel;
|
|
|
|
|
|
|
|
|
|
if (entsize == sizeof (Elf_External_Rela))
|
|
|
|
|
elf_swap_reloca_in (abfd, (Elf_External_Rela *) native_relocs, &rela);
|
|
|
|
|
else
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
{
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
elf_swap_reloc_in (abfd, (Elf_External_Rel *) native_relocs, &rel);
|
|
|
|
|
rela.r_offset = rel.r_offset;
|
|
|
|
|
rela.r_info = rel.r_info;
|
|
|
|
|
rela.r_addend = 0;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* The address of an ELF reloc is section relative for an object
|
|
|
|
|
file, and absolute for an executable file or shared library.
|
|
|
|
|
The address of a BFD reloc is always section relative. */
|
|
|
|
|
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
|
|
|
|
|
relent->address = rela.r_offset;
|
|
|
|
|
else
|
|
|
|
|
relent->address = rela.r_offset - asect->vma;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (ELF_R_SYM (rela.r_info) == 0)
|
|
|
|
|
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
asymbol **ps, *s;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
ps = symbols + ELF_R_SYM (rela.r_info) - 1;
|
|
|
|
|
s = *ps;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
/* Canonicalize ELF section symbols. FIXME: Why? */
|
|
|
|
|
if ((s->flags & BSF_SECTION_SYM) == 0)
|
|
|
|
|
relent->sym_ptr_ptr = ps;
|
|
|
|
|
else
|
|
|
|
|
relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
relent->addend = rela.r_addend;
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-19 20:23:40 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (entsize == sizeof (Elf_External_Rela))
|
|
|
|
|
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
|
|
|
|
|
else
|
|
|
|
|
(*ebd->elf_info_to_howto_rel) (abfd, relent, &rel);
|
Make MIPS ELF use new ELF backend linker. No shared library
support yet.
* elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
(bfd_mips_elf32_swap_gptab_out): New function.
(mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
(mips_elf_final_write_processing): Set sh_info field for .gptab.*
sections.
(mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
(mips_elf_read_ecoff_info): Read and free external symbols last,
not first, for clarity.
(struct mips_elf_link_hash_entry): Define new structure.
(struct mips_elf_link_hash_table): Define new structure.
(mips_elf_link_hash_lookup): Define new macro.
(mips_elf_link_hash_traverse): Define new macro.
(mips_elf_hash_table): Define new macro.
(mips_elf_link_hash_newfunc): New static function.
(mips_elf_link_hash_table_create): New static function.
(mips_elf_add_symbol_hook): New static function.
(struct extsym_info): Define new structure.
(mips_elf_get_extr, mips_elf_set_index): Remove.
(mips_elf_output_extsym): New static function.
(gptab_compare): New static function.
(mips_elf_final_link): Rewrite to use ELF backend linker, and to
merge gptab information in input files.
(mips_elf_relocate_hi16): New static function.
(mips_elf_relocate_section): New static function.
(bfd_elf32_bfd_link_hash_table_create): Define as macro before
including elf32-target.h.
(elf_backend_relocate_section): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf.c (_bfd_elf_link_hash_newfunc): Rename from
elf_link_hash_newfunc and make globally visible. Change caller.
(_bfd_elf_link_hash_table_init): New function, broken out of
_bfd_elf_link_hash_table_create.
(_bfd_elf_link_hash_table_create): Use
_bfd_elf_link_hash_table_init.
* libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
(elf_bad_symtab): Define new accessor macro.
(_bfd_elf_link_hash_newfunc): Declare.
(_bew_elf_link_hash_table_init): Declare.
* elfcode.h (elf_object_p): Call backend object_p hook after
swapping in all the section headers.
(map_program_segments): Correct typo: Internal for External.
(elf_link_add_object_symbols): If elf_bad_symtab is set, read all
the symbols. Skip STB_LOCAL symbols rather than giving an error.
(elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
all symbols, not just locals.
(elf_link_output_extsym): Only skip a symbol not mentioned by a
regular file if it is mentioned by a dynamic object.
(elf_link_input_bfd): If elf_bad_symtab is set, read all the
symbols.
1994-05-24 22:44:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
asect->relocation = relents;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (allocated != NULL)
|
|
|
|
|
free (allocated);
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
return true;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
error_return:
|
|
|
|
|
if (allocated != NULL)
|
|
|
|
|
free (allocated);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
Make MIPS ELF use new ELF backend linker. No shared library
support yet.
* elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
(bfd_mips_elf32_swap_gptab_out): New function.
(mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
(mips_elf_final_write_processing): Set sh_info field for .gptab.*
sections.
(mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
(mips_elf_read_ecoff_info): Read and free external symbols last,
not first, for clarity.
(struct mips_elf_link_hash_entry): Define new structure.
(struct mips_elf_link_hash_table): Define new structure.
(mips_elf_link_hash_lookup): Define new macro.
(mips_elf_link_hash_traverse): Define new macro.
(mips_elf_hash_table): Define new macro.
(mips_elf_link_hash_newfunc): New static function.
(mips_elf_link_hash_table_create): New static function.
(mips_elf_add_symbol_hook): New static function.
(struct extsym_info): Define new structure.
(mips_elf_get_extr, mips_elf_set_index): Remove.
(mips_elf_output_extsym): New static function.
(gptab_compare): New static function.
(mips_elf_final_link): Rewrite to use ELF backend linker, and to
merge gptab information in input files.
(mips_elf_relocate_hi16): New static function.
(mips_elf_relocate_section): New static function.
(bfd_elf32_bfd_link_hash_table_create): Define as macro before
including elf32-target.h.
(elf_backend_relocate_section): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf.c (_bfd_elf_link_hash_newfunc): Rename from
elf_link_hash_newfunc and make globally visible. Change caller.
(_bfd_elf_link_hash_table_init): New function, broken out of
_bfd_elf_link_hash_table_create.
(_bfd_elf_link_hash_table_create): Use
_bfd_elf_link_hash_table_init.
* libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
(elf_bad_symtab): Define new accessor macro.
(_bfd_elf_link_hash_newfunc): Declare.
(_bew_elf_link_hash_table_init): Declare.
* elfcode.h (elf_object_p): Call backend object_p hook after
swapping in all the section headers.
(map_program_segments): Correct typo: Internal for External.
(elf_link_add_object_symbols): If elf_bad_symtab is set, read all
the symbols. Skip STB_LOCAL symbols rather than giving an error.
(elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
all symbols, not just locals.
(elf_link_output_extsym): Only skip a symbol not mentioned by a
regular file if it is mentioned by a dynamic object.
(elf_link_input_bfd): If elf_bad_symtab is set, read all the
symbols.
1994-05-24 22:44:50 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
static void
|
|
|
|
|
elf_debug_section (num, hdr)
|
|
|
|
|
int num;
|
|
|
|
|
Elf_Internal_Shdr *hdr;
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "\nSection#%d '%s' 0x%.8lx\n", num,
|
|
|
|
|
hdr->bfd_section != NULL ? hdr->bfd_section->name : "",
|
|
|
|
|
(long) hdr);
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"sh_name = %ld\tsh_type = %ld\tsh_flags = %ld\n",
|
|
|
|
|
(long) hdr->sh_name,
|
|
|
|
|
(long) hdr->sh_type,
|
|
|
|
|
(long) hdr->sh_flags);
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"sh_addr = %ld\tsh_offset = %ld\tsh_size = %ld\n",
|
|
|
|
|
(long) hdr->sh_addr,
|
|
|
|
|
(long) hdr->sh_offset,
|
|
|
|
|
(long) hdr->sh_size);
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"sh_link = %ld\tsh_info = %ld\tsh_addralign = %ld\n",
|
|
|
|
|
(long) hdr->sh_link,
|
|
|
|
|
(long) hdr->sh_info,
|
|
|
|
|
(long) hdr->sh_addralign);
|
|
|
|
|
fprintf (stderr, "sh_entsize = %ld\n",
|
|
|
|
|
(long) hdr->sh_entsize);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
static void
|
|
|
|
|
elf_debug_file (ehdrp)
|
|
|
|
|
Elf_Internal_Ehdr *ehdrp;
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "e_entry = 0x%.8lx\n", (long) ehdrp->e_entry);
|
|
|
|
|
fprintf (stderr, "e_phoff = %ld\n", (long) ehdrp->e_phoff);
|
|
|
|
|
fprintf (stderr, "e_phnum = %ld\n", (long) ehdrp->e_phnum);
|
|
|
|
|
fprintf (stderr, "e_phentsize = %ld\n", (long) ehdrp->e_phentsize);
|
|
|
|
|
fprintf (stderr, "e_shoff = %ld\n", (long) ehdrp->e_shoff);
|
|
|
|
|
fprintf (stderr, "e_shnum = %ld\n", (long) ehdrp->e_shnum);
|
|
|
|
|
fprintf (stderr, "e_shentsize = %ld\n", (long) ehdrp->e_shentsize);
|
|
|
|
|
}
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
static char *
|
|
|
|
|
elf_symbol_flags (flags)
|
|
|
|
|
flagword flags;
|
|
|
|
|
{
|
|
|
|
|
static char buffer[1024];
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
buffer[0] = '\0';
|
|
|
|
|
if (flags & BSF_LOCAL)
|
|
|
|
|
strcat (buffer, " local");
|
1994-06-23 23:36:03 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_GLOBAL)
|
|
|
|
|
strcat (buffer, " global");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_DEBUGGING)
|
|
|
|
|
strcat (buffer, " debug");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_FUNCTION)
|
|
|
|
|
strcat (buffer, " function");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_KEEP)
|
|
|
|
|
strcat (buffer, " keep");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_KEEP_G)
|
|
|
|
|
strcat (buffer, " keep_g");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_WEAK)
|
|
|
|
|
strcat (buffer, " weak");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_SECTION_SYM)
|
|
|
|
|
strcat (buffer, " section-sym");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_OLD_COMMON)
|
|
|
|
|
strcat (buffer, " old-common");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_NOT_AT_END)
|
|
|
|
|
strcat (buffer, " not-at-end");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_CONSTRUCTOR)
|
|
|
|
|
strcat (buffer, " constructor");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_WARNING)
|
|
|
|
|
strcat (buffer, " warning");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_INDIRECT)
|
|
|
|
|
strcat (buffer, " indirect");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & BSF_FILE)
|
|
|
|
|
strcat (buffer, " file");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & DYNAMIC)
|
|
|
|
|
strcat (buffer, " dynamic");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
if (flags & ~(BSF_LOCAL
|
|
|
|
|
| BSF_GLOBAL
|
|
|
|
|
| BSF_DEBUGGING
|
|
|
|
|
| BSF_FUNCTION
|
|
|
|
|
| BSF_KEEP
|
|
|
|
|
| BSF_KEEP_G
|
|
|
|
|
| BSF_WEAK
|
|
|
|
|
| BSF_SECTION_SYM
|
|
|
|
|
| BSF_OLD_COMMON
|
|
|
|
|
| BSF_NOT_AT_END
|
|
|
|
|
| BSF_CONSTRUCTOR
|
|
|
|
|
| BSF_WARNING
|
|
|
|
|
| BSF_INDIRECT
|
|
|
|
|
| BSF_FILE
|
|
|
|
|
| BSF_DYNAMIC))
|
|
|
|
|
strcat (buffer, " unknown-bits");
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
return buffer;
|
* 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.
1994-05-09 18:58:36 +02:00
|
|
|
|
}
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "elfcore.h"
|
|
|
|
|
#include "elflink.h"
|
|
|
|
|
|
|
|
|
|
/* Size-dependent data and functions. */
|
|
|
|
|
const struct elf_size_info NAME(_bfd_elf,size_info) = {
|
|
|
|
|
sizeof (Elf_External_Ehdr),
|
|
|
|
|
sizeof (Elf_External_Phdr),
|
|
|
|
|
sizeof (Elf_External_Shdr),
|
|
|
|
|
sizeof (Elf_External_Rel),
|
|
|
|
|
sizeof (Elf_External_Rela),
|
|
|
|
|
sizeof (Elf_External_Sym),
|
|
|
|
|
sizeof (Elf_External_Dyn),
|
|
|
|
|
sizeof (Elf_External_Note),
|
|
|
|
|
|
|
|
|
|
ARCH_SIZE, FILE_ALIGN,
|
|
|
|
|
ELFCLASS, EV_CURRENT,
|
64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
* Makefile.in: Rebuild dependencies.
(BFD64_BACKENDS): Add elf64-mips.o.
(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
* confingure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
broken out of mips_elf_section_from_shdr.
(mips_elf32_section_from_shdr): Rename from
mips_elf_section_from_shdr. Call new function.
(elf_backend_section_from_shdr): Update name of renamed function.
* elf-bfd.h (struct elf_size_info): Change second parameter of
write_out_phdrs to be const. Likewise for second parameter of
swap_symbol_out.
(struct bfd_elf_section_data): Add rel_hdr2 field.
(bfd_elf32_swap_symbol_in): Change second parameter to be const.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf32_swap_reloc_in): Likewise.
(bfd_elf32_swap_reloc_out): Likewise.
(bfd_elf32_swap_reloca_in): Likewise.
(bfd_elf32_swap_reloca_out): Likewise.
(bfd_elf32_swap_phdr_in): Likewise.
(bfd_elf32_swap_phdr_out): Likewise.
(bfd_elf32_swap_dyn_in): Likewise.
(bfd_elf32_swap_dyn_out): Likewise.
(bfd_elf32_slurp_symbol_table): Declare.
(bfd_elf32_write_shdrs_and_ehdr): Declare.
(bfd_elf32_write_out_phdrs): Declare.
(bfd_elf64_swap_symbol_in): Change second parameter to be const.
(bfd_elf64_swap_symbol_out): Likewise.
(bfd_elf64_swap_reloc_in): Likewise.
(bfd_elf64_swap_reloc_out): Likewise.
(bfd_elf64_swap_reloca_in): Likewise.
(bfd_elf64_swap_reloca_out): Likewise.
(bfd_elf64_swap_phdr_in): Likewise.
(bfd_elf64_swap_phdr_out): Likewise.
(bfd_elf64_swap_dyn_in): Likewise.
(bfd_elf64_swap_dyn_out): Likewise.
(bfd_elf64_slurp_symbol_table): Declare.
(bfd_elf64_write_shdrs_and_ehdr): Declare.
(bfd_elf64_write_out_phdrs): Declare.
(_bfd_mips_elf_section_from_shdr): Declare.
* elf.c (bfd_section_from_shdr): Remove assertion requiring
SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
section for the section, add the new one to rel_hdr2. Increment
reloc_count rather than setting it.
* elfcode.h (elf_slurp_symbol_table): Define name as macro.
Remove static declaration.
(elf_write_shdrs_and_ehdr): Define name as macro.
(elf_write_out_phdrs): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
(elf_swap_symbol_in): Change second parameter to be const.
(elf_swap_symbol_out): Likewise.
(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_write_out_phdrs): Rename from write_out_phdrs. Change second
parameter to be const. Make non-static.
(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
Make non-static.
(elf_slurp_symbol_table): Make non-static.
(NAME(_bfd_elf,size_info)): Update names of renamed functions.
* elfxx-target.h (elf_info_to_howto): Define if not defined.
(elf_backend_size_info): Likewise.
(elfNN_bed): Use elf_backend_size_info.
* targets.c (bfd_elf64_bigmips_vec): Declare.
(bfd_elf64_littlemips_vec): Declare.
(bfd_target_vector): Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 22:33:00 +02:00
|
|
|
|
elf_write_out_phdrs,
|
|
|
|
|
elf_write_shdrs_and_ehdr,
|
1995-07-13 00:00:57 +02:00
|
|
|
|
write_relocs,
|
|
|
|
|
elf_swap_symbol_out,
|
|
|
|
|
elf_slurp_reloc_table,
|
|
|
|
|
elf_slurp_symbol_table,
|
1996-01-12 20:13:49 +01:00
|
|
|
|
elf_swap_dyn_in
|
Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions. Added a
pointer to that structure to the target back end data. More work can be done
here.
Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf. Updated most call sites, sometimes defined some macros.
Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior. More work can probably be
done here too.
Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c. Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h. Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.
Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 04:22:00 +02:00
|
|
|
|
};
|