Commit Graph

14 Commits

Author SHA1 Message Date
Mark Mitchell 103186c62b * elf-bfd.h (_bfd_mips_elf_section_from_shdr): Constify.
(_bfd_mips_elf_create_dynamic_sections): New function.
	(_bfd_mips_elf_add_symbol_hook): Likewise.
	(_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
	(_bfd_mips_elf_finish_dynamic_sections): Likewise.
	(_bfd_mips_elf_gc_mark_hook): Likewise.
	(_bfd_mips_elf_gc_sweep_hook): Likewise.
	(_bfd_mips_elf_always_size_sections): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_elf_check_relocs): Likewise.
	(_bfd_mips_elf_link_hash_table_create): Likewise.
	(_bfd_mips_elf_print_private_data): Likewise.
	(_bfd_mips_elf_link_output_symbol_hook): Likewise.
	(_bfd_mips_elf_final_link): Likewise.
	(_bfd_mips_elf_additional_program_headers): Likewise.
	(_bfd_mips_elf_modify_segment_map): Likewise.
	(_bfd_mips_elf_relocate_section): Likewise.
	* elf32-mips.c (mips_elf32_object_p): Move contents into
	_bfd_mips_elf_object_p.
	(mips_elf_additional_program_headers): Rename to
	_bfd_mips_elf_additional_program_headers.
	(mips_elf_modify_segment_map): Rename to
	_bfd_mips_elf_modify_segment_map.
	(elf_mips_abi_name): Change prototype.
	(mips_elf32_section_from_shdr): Merge into
	_bfd_mips_elf_section_from_shdr.
	(mips_elf32_section_processing): Merge into
	_bfd_mips_elf_section_processing.
	(mips_elf_final_link): Rename to _bfd_mips_elf_final_link.  Invoke
	the right back-end ELF linker.
	(mips_elf_relocate_section): Rename to
	_bfd_mips_elf_relocate_section.  Clean up.  Adjust for 64-bit code.
	(mips_elf_link_output_symbol_hook): Rename to
	_bfd_mips_elf_link_output_symbol_hook.
	(mips_elf_create_dynamic_section): Rename to
	_bfd_mips_elf_create_dynamic_section.
	(mips_elf_check_relocs): Rename to _bfd_mips_elf_check_relocs.
	Adjust for 64-bit code.  Use mips_elf_got_section.
	(mips_elf_adjust_dynamic_symbol): Rename to
	_bfd_mips_elf_adjust_dynamic_symbol.  Use
	mips_elf_allocate_dynamic_relocations.
	(mips_elf_finish_dynamic_symbol): Rename to
	_bfd_mips_elf_finish_dynamic_symbol.  Use mips_elf_got_section.
	Adjust for 64-bit code.
	(mips_elf_finish_dynamic_sections): Rename to
	_bfd_mips_elf_finish_dynamic_sections.  Adjust for 64-bit code.
	(mips_elf_always_size_sections): Rename to
	_bfd_mips_elf_always_size_sections.
	(mips_elf_add_symbol_hook): Rename to
	_bfd_mips_elf_add_symbol_hook.
	(mips_elf_next_lo16_addend): Constify.
	(mips_elf_calculate_relocation): Likewise.
	(mips_elf_obtain_contents): Likewise.
	(mips_elf_perform_relocation): Likewise.
	(mips_elf_create_dynamic_relocation): Likewise.
	(mips_elf_allocate_dynamic_relocations): New function.
	(MIPS_ELF_REL_DYN_SECTION_NAME): New macro.
	(MIPS_ELF_REL_SIZE): Likewise.
	(MIPS_ELF_DYN_SIZE): Likewise.
	(MIPS_ELF_GOT_SIZE): Likewise.
	(MIPS_ELF_SYM_SIZE): Likewise.
	(MIPS_ELF_LOG_FILE_ALIGN): Likewise.
	(MIPS_ELF_GET_WORD): Likewise.
	(MIPS_ELF_PUT_WORD): Likewise.
	(MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise.
	(STUB_LW): Conditionalize for 64-bit value.
	(elf_mips_howto_table): Add R_MIPS_HIGHER and R_MIPS_HIGHEST
	entries.
	(_bfd_mips_elf_merge_private_bfd_data): Merge e_ident[EI_CLASS].
	Check it for inconsistency.
	(_bfd_mips_elf_print_private_bfd_data): Print ABI=64 for 64-bit
	ABI.
	(_bfd_mips_elf_fake_sections): Remove duplicate handling of
	.msym.
	(mips_elf_global_got_index): Use MIPS_ELF_GOT_SIZE.
	(mips_elf_got_offset_from_index): Use misp_elf_got_section.
	(mips_elf_create_local_got_entry): Use MIPS_ELF_GOT_SIZE.
	(mips_elf_local_got_index): Likewise.
	(mips_elf_got_page): Likewise.
	(mips_elf_got_info): Likewise.
	(mips_elf_create_dynamic_relocation): Handle 32-bit/64-bit split.
	(ELF_DYNAMIC_INTERPRETER): Handle 64-bit code.
	(mips_elf_create_dynamic_sections): Use MIPS_ELF_LOG_FILE_ALIGN,
	instead of constant `2'.
	(mips_elf_create_got_section): Tidy.  Use MIPS_ELF_GOT_SIZE.
	(mips_elf_create_msym_section): Use MIPS_ELF_LOG_FILE_ALIGN.
	(mips_elf_size_dynamic_sections): Use
	MIPS_ELF_REL_DYN_SECTION_NAME, MIPS_ELF_GOT_SIZE,
	MIPS_ELF_ADD_DYNAMIC_ENTRY.  Remove #if 0'd code.
	Adjust all releveant entries in elf backend table.
	* elf64-mips.c (mips_elf64_section_from_shdr): Remove.
	(mips_elf64_section_processing): Likewise.
	Adjust elf backend entries to use _bfd_mips_elf variants now
	publicly available.
1999-07-07 19:23:22 +00:00
Mark Mitchell 5e38c3b856 * dwarf2.c (parse_comp_unit): Add ABBREV_LENGTH parameter.
(_bfd_dwarf2_find_nearest_line): Add ADDR_SIZE parameter.
	* elf.c (_bfd_elf_find_nearest_line): Pass it.
	* elf32-arm.h (elf32_arm_find_nearest_line): Likewise.
	* elf32-mips.c (ABI_64_P): New macro.
	(IRIX_COMPAT): We are IRIX6-compatible if ABI_64_P.
	(_bfd_mips_elf_find_nearest_line): Adjust call to
	_bfd_dwarf2_find_nearest_line.
	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
	* libbfd.h: Regenerated.
1999-07-02 21:03:56 +00:00
Mark Mitchell 23bc299bd8 * elf-bfd.h (bfd_elf_section_data): Add rel_count and rel_count2
fields.
	(_bfd_elf_init_reloc_shdr): New function.
	* elf.c (_bfd_elf_new_section_hook): Use bfd_zalloc, rather than
	bfd_alloc followed by memset.
	(_bfd_elf_init_reloc_shdr): New function, split out from ...
	(elf_fake_sections): Here.
	(assign_section_numbers): Assign section numbers for the second
	relocation section, if required.
	* elflink.h (elf_link_output_relocs): New function.
	(elf_link_size_reloc_section): Likewise.
	(elf_bfd_final_link): Use elf_link_size_reloc_section.
	(elf_link_input_bfd): Use elf_link_output_relocs.
	* elf32-mips.c (_bfd_mips_elf_fake_sections): Use
	_bfd_elf_init_reloc_shdr to initialize rel_hdr2.
1999-07-01 23:20:08 +00:00
Mark Mitchell 7403cb6305 * elf32-mips.c (mips_elf_got_info): Move declaration before
prototypes.  Change global_gotsym to be a pointer to a hash entry,
	rather than a number index.
	(mips_elf_link_hash_entry): Move declaration before prototypes.
	(mips_elf_irix6_finish_dynamic_symbol): New function.
	(mips_elf_sign_extend): Likewise.
	(mips_elf_high): Likewise.
	(mips_elf_higher): Likewise.
	(mips_elf_highest): Likewise.
	(mips_elf_global_got_index): Likewise.
	(mips_elf_local_got_index): Likewise.
	(mips_elf_got_offset_from_index): Likeiwse.
	(mips_elf_record_global_got_symbol): Likewise.
	(mips_elf_got_page): Likewise.
	(mips_elf_next_lo16_addend): Likewise.
	(mips_elf_calculate_relocation): Likewise.
	(mips_elf_obtain_contents): Likewise.
	(mips_elf_perform_relocation): Likewise.
	(mips_elf_assign_gp): Likewise.
	(mips_elf_sort_hash_table_f): Likewise.
	(mips_elf_sort_hash_table): Likewise.
	(mips_elf_got_section): Likewise.
	(mips_elf_got_info): Likewise.
	(mips_elf_create_local_got_entry): Likewise.
	(mips_elf_got16_entry): Likewise.
	(mips_elf_create_dynamic_relocation): Likewise.
	(elf_mips_howto_table): Add description of R_MIPS_SCN_DISP.
	(mips_elf_final_gp): Use mips_elf_assign_gp.
	(_bfd_mips_elf_symbol_processing): Don't move SHN_COMMON symbols
	into SHN_SCOMMON automatically on IRIX6.
	(mips_elf_add_symbol_hook): Likewise.
	(mips_elf_relocate_section): Rewrite, using
	mips_elf_calculate_relocation and mips_elf_perform_relocation.
	(mips_elf_create_dynamic_section): Use MIPS_ELF_STUB_SECTION_NAME.
	Don't deal with .rld_map on IRIX6.
	(mips_elf_create_got_section): Adjust use of global_gotsym.  Set
	section flags appropriately for .got.
	(mips_elf_check_relocs): Handle IRIX6 relocations making use of
	the got.  Call mips_elf_record_global_got_symbol and allocate
	local got space appropriately.
	(mips_elf_size_dynamic_sections): Use bfd_byte *, not unsigned
	char *.  Rework calculation of GOT size.  Sort dynamic symbol
	table entries so entries that do not require GOT entries appear at
	the beginning.  Don't use DT_MIPS_HIPAGENO on IRIX6.  Remove dead
	code dealing with DT_INIT and DT_FINI.  Remove fiddling with
	global_gotsym.
	(mips_elf_finish_dynamic_symbol): Adjust creation of global GOT
	entries.
	(mips_elf_finish_dynamic_symbol): Use
	mips_elf_irix6_finish_dynamic_symbol.
	(mips_elf_finish_dynamic_sections): Correct off-by-one error
	setting DT_MIPS_UNREFEXTNO.  Adjust setting of DT_MIPS_GOTSYM for
	change to global_gotsym.  Set DT_MIPS_OPTIONS on IRIX6.
1999-06-30 20:13:43 +00:00
Ian Lance Taylor 0dda5f7af8 * elf32-mips.c (mips_elf_final_link): Don't set CPIC when doing a
relocateable link.  From Ralf Baechle <ralf@uni-koblenz.de>.
1999-06-30 18:16:46 +00:00
Mark Mitchell 303f629d61 * elf32-mips.c (MIPS_ELF_SRDATA_SECTION_NAME): New macro.
(MIPS_ELF_OPTIONS_SECTION_NAME): Likewise.
	(MIPS_ELF_STUB_SECTION_NAME): Likewise.
	(_bfd_mips_elf_section_from_shdr): Use them.
	(_bfd_mips_elf_fake_sections): Likewise.  Add .srdata to the list
	of GP-relative sections.
	(_bfd_mips_elf_set_section_contents): Use them.
	(_bfd_mips_elf_section_processing): Share code between .sdata and
	.lit4/.lit8 sections.  Set appropriate flags for .srdata.
	(mips_elf_additional_program_headers): Add handling for
	PT_MIPS_OPTIONS segment on IRIX6.
	(mips_elf_modify_segment_map): Likeiwse.
	(mips_elf_final_link): Set EF_MIPS_CPIC when required by the ABI.
	Include the options sections on IRIX6.  Don't look for GP-relative
	sections by name; use SHF_MIPS_GPREL instead.
	(ELF_DYNAMIC_INTERPRETER): Adjust to use /usr/lib32/libc.so.1 for
	the N32 ABI.
	(mips_elf_create_dynamic_sections): Don't muck about with section
	alignments and such on IRIX6.
	(mips_elf_adjust_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
	(mips_elf_size_dynamic_sections): Likewise. Adjust to handle the
	fact that ELF_DYNAMIC_INTERPRETER is no longer a constant.  Use
	bfd_zalloc rather than bfd_alloc and memset.
	(mips_elf_finish_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
	Don't assert the existence of .rld_map on IRIX6.
	(mips_elf_finish_dynamic_sections): Use MIPS_ELF_STUB_SECTION_NAME.
1999-06-27 21:23:34 +00:00
Mark Mitchell 9886bd4365 * elf32-mips.c (mips_elf_adjust_dynindx): Remove.
(mips_elf_size_dynamic_sections): Use _bfd_elf_link_adjust_dynindx
	instead.
1999-06-27 16:11:13 +00:00
Mark Mitchell c6142e5d05 * elf32-mips.c (mips_elf_swap_msym_in): New function.
(mips_elf_swap_msym_out): New function.
	(mips_elf_create_msym_section): Likewise.
	(MIPS_ELF_MSYM_SECTION_NAME): New macro.
	(_bfd_mips_elf_final_write_processing): Set sh_link for .msym.
	(_bfd_mips_elf_section_from_shdr): Reject an SHT_MIPS_MSYM
	section not named .msym.
	(_bfd_mips_elf_fake_sections): Use MIPS_ELF_MSYM_SECTION_NAME, not
	.msym directly.  Set appropriate attributes for the .msym
	section.
	(mips_elf_link_hash_entry): Add min_dyn_reloc_index field.
	(mips_elf_link_hash_newfunc): Clear it.
	(mips_elf_create_dynamic_sections): Create the .msym section
	on IRIX6.
	(mips_elf_size_dynamic_sections):  Allocate space for the
	.msym section.  Add a DT_MIPS_MSYM entry.
	(mips_elf_finish_dynamic_symbol): Write out a .msym entry for
	the symbol.
	(mips_elf_finish_dynamic_sections): Assign a value for
	DT_MIPS_MSYM.  Add .msym entries for the section symbols as well.
1999-06-27 11:05:15 +00:00
Mark Mitchell a94a7c1c32 * elf32-mips.c (irix_compat_t): New enumeration.
(ABI_N32_P): New macro.
	(IRIX_COMPAT): Likewise.
	(SGI_COMPAT): Implement in terms of IRIX_COMPAT.
	(mips_elf_relocate_section): Fix typo.
1999-06-26 21:17:49 +00:00
Ian Lance Taylor cc3bfcee61 * elf32-mips.c (mips_elf32_section_processing): Permit a
SHT_MIPS_REGINFO section to have a size of 0.
1999-06-12 13:08:29 +00:00
Mark Mitchell 7f7e7b689c * elf32-mips.c (_bfd_mips_elf_print_private_data): Recognize
the N32 ABI.
1999-06-06 22:31:46 +00:00
Mark Mitchell d2905643ff * elf32-mips.c (elf_mips_howto_table): Add R_MIPS_JALR.
* elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
	(mips_elf64_howto_table_rela): Likewise.
1999-06-02 18:17:59 +00:00
Mark Mitchell 3f830999e3 * reloc.c (BFD_RELOC_MIPS_SUB): New relocation.
(BFD_RELOC_MIPS_GOT_PAGE): Likewise.
	(BFD_RELOC_MIPS_GOT_OFST): Likewise.
	(BFD_RELOC_MIPS_GOT_DISP): Likewise.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.
	* elf32-mips.c (mips_info_to_howto_rela): New function.
	(USE_REL): Adjust for new conventions.
	(MINUS_ONE): New macro.
	(elf_mips_howto_table): Add R_MIPS_SUB.
	(mips_r): Add entries for MIPS_SUB, MIPS_GOT_PAGE, MIPS_GOT_OFST,
	and MIPS_GOT_DISP.
	(mips_elf_final_write_processing): Set sh_link, not sh_info, for a
	.MIPS.content section.
	(_bfd_mips_elf_fake_sections): Treat all sections that begin
	with .MIPS.content as .MIPS.content sections.  Set
	SHF_MNIPS_NOSTRIP for such section.
	(elf_info_to_howto): Define to mips_info_to_howto_rela.
	* elf64-mips.c (mips_r):  Add entries for MIPS_SUB, MIPS_GOT_PAGE,
	MIPS_GOT_OFST, and MIPS_GOT_DISP.
1999-06-02 10:20:16 +00:00
Richard Henderson 252b5132c7 19990502 sourceware import 1999-05-03 07:29:11 +00:00