1999-05-03 15:29:11 +08:00
|
|
|
/* SPARC-specific support for 32-bit ELF
|
2003-01-23 19:51:35 +08:00
|
|
|
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
2005-01-11 17:32:53 +08:00
|
|
|
2003, 2004, 2005 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-02-18 02:24:40 +08:00
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-02-18 02:24:40 +08:00
|
|
|
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.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-02-18 02:24:40 +08:00
|
|
|
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.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-02-18 02:24:40 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-04 23:53:43 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "sysdep.h"
|
|
|
|
#include "bfdlink.h"
|
|
|
|
#include "libbfd.h"
|
|
|
|
#include "elf-bfd.h"
|
|
|
|
#include "elf/sparc.h"
|
2000-05-26 14:41:33 +08:00
|
|
|
#include "opcode/sparc.h"
|
2005-04-20 05:26:30 +08:00
|
|
|
#include "elfxx-sparc.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-04-20 05:26:30 +08:00
|
|
|
/* Support for core dump NOTE sections. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
static bfd_boolean
|
2005-04-20 05:26:30 +08:00
|
|
|
elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-04-20 05:26:30 +08:00
|
|
|
switch (note->descsz)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-04-20 05:26:30 +08:00
|
|
|
default:
|
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-04-20 05:26:30 +08:00
|
|
|
case 260: /* Solaris prpsinfo_t. */
|
|
|
|
elf_tdata (abfd)->core_program
|
|
|
|
= _bfd_elfcore_strndup (abfd, note->descdata + 84, 16);
|
|
|
|
elf_tdata (abfd)->core_command
|
|
|
|
= _bfd_elfcore_strndup (abfd, note->descdata + 100, 80);
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-04-20 05:26:30 +08:00
|
|
|
case 336: /* Solaris psinfo_t. */
|
|
|
|
elf_tdata (abfd)->core_program
|
|
|
|
= _bfd_elfcore_strndup (abfd, note->descdata + 88, 16);
|
|
|
|
elf_tdata (abfd)->core_command
|
|
|
|
= _bfd_elfcore_strndup (abfd, note->descdata + 104, 80);
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Functions for dealing with the e_flags field.
|
|
|
|
|
|
|
|
We don't define set_private_flags or copy_private_bfd_data because
|
|
|
|
the only currently defined values are based on the bfd mach number,
|
|
|
|
so we use the latter instead and defer setting e_flags until the
|
|
|
|
file is written out. */
|
|
|
|
|
|
|
|
/* Merge backend specific data from an object file to the output
|
|
|
|
object file when linking. */
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
static bfd_boolean
|
2005-04-20 05:26:30 +08:00
|
|
|
elf32_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2002-11-30 16:39:46 +08:00
|
|
|
bfd_boolean error;
|
2004-07-30 18:08:00 +08:00
|
|
|
unsigned long ibfd_mach;
|
1999-07-12 18:30:21 +08:00
|
|
|
/* FIXME: This should not be static. */
|
|
|
|
static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|
|
|
|
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
|
2002-11-30 16:39:46 +08:00
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
error = FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2004-07-30 18:08:00 +08:00
|
|
|
ibfd_mach = bfd_get_mach (ibfd);
|
|
|
|
if (bfd_mach_sparc_64bit_p (ibfd_mach))
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2002-11-30 16:39:46 +08:00
|
|
|
error = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
(*_bfd_error_handler)
|
bfd/
* bfd.c (_bfd_default_error_handler): Handle %A and %B.
(bfd_archive_filename, bfd_get_section_ident): Delete.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call
bfd_archive_filename.
* elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler
to warn about symbols in discarded sections. Use _bfd_error_handler.
* aout-adobe.c (aout_adobe_callback): See below.
* aout-cris.c (swap_ext_reloc_in): ..
* coff-arm.c (find_thumb_glue, find_arm_glue,
coff_arm_relocate_section, bfd_arm_process_before_allocation,
coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags,
coff_arm_copy_private_bfd_data): ..
* coff-i860.c (i860_reloc_processing): ..
* coff-mcore.c (mcore_coff_unsupported_reloc,
coff_mcore_relocate_section): ..
* coff-ppc.c (coff_ppc_relocate_section): ..
* coff-rs6000.c (xcoff_create_csect_from_smclas
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_swap_insns, sh_relocate_section): ..
* coff-tic54x.c (tic54x_reloc_processing): ..
* coff-tic80.c (coff_tic80_relocate_section): ..
* coff64-rs6000.c (xcoff64_create_csect_from_smclas): ..
* coffcode.h (styp_to_sec_flags, coff_slurp_line_table,
coff_slurp_symbol_table, coff_classify_symbol,
coff_slurp_reloc_table): ..
* coffgen.c (_bfd_coff_read_string_table): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd,
_bfd_coff_generic_relocate_section): ..
* cpu-arm.c (bfd_arm_merge_machines): ..
* cpu-sh.c (sh_merge_bfd_arch): ..
* elf-hppa.h (elf_hppa_relocate_section): ..
* elf.c (bfd_elf_string_from_elf_section, setup_group,
_bfd_elf_setup_group_pointers, bfd_section_from_shdr,
assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol,
copy_private_bfd_data, _bfd_elf_validate_reloc): ..
* elf32-arm.h (find_thumb_glue, find_arm_glue,
bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub,
elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate,
elf32_arm_relocate_section, elf32_arm_set_private_flags,
elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): ..
* elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs,
cris_elf_merge_private_bfd_data
* elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): ..
* elf32-gen.c (elf32_generic_link_add_symbols): ..
* elf32-hppa.c (hppa_add_stub, hppa_build_one_stub,
elf32_hppa_check_relocs, get_local_syms, final_link_relocate,
elf32_hppa_relocate_section): ..
* elf32-i370.c (i370_elf_merge_private_bfd_data,
i370_elf_check_relocs, i370_elf_relocate_section): ..
* elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs,
elf_i386_relocate_section): ..
* elf32-m32r.c (m32r_elf_relocate_section,
m32r_elf_merge_private_bfd_data): ..
* elf32-m68hc1x.c (m68hc12_add_stub,
_bfd_m68hc11_elf_merge_private_bfd_data): ..
* elf32-m68k.c (elf_m68k_relocate_section): ..
* elf32-mcore.c (mcore_elf_unsupported_reloc,
mcore_elf_relocate_section): ..
* elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc,
ppc_elf_check_relocs, ppc_elf_relocate_section,
ppc_elf_begin_write_processing): ..
* elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn,
elf_s390_relocate_section): ..
* elf32-sh-symbian.c (sh_symbian_import_as,
sh_symbian_process_embedded_commands,
sh_symbian_relocate_section): ..
* elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes,
sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs,
sh_elf_merge_private_data): ..
* elf32-sparc.c (elf32_sparc_check_relocs,
elf32_sparc_relocate_section,
elf32_sparc_merge_private_bfd_data): ..
* elf32-v850.c (v850_elf_check_relocs,
v850_elf_merge_private_bfd_data): ..
* elf32-xtensa.c (elf_xtensa_check_relocs,
elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): ..
* elf64-alpha.c (elf64_alpha_relax_with_lituse,
elf64_alpha_relax_got_load, elf64_alpha_size_got_sections,
elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): ..
* elf64-gen.c (elf64_generic_link_add_symbols): ..
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub,
ppc64_elf_check_relocs, ppc64_elf_edit_opd,
ppc64_elf_relocate_section): ..
* elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn,
elf_s390_relocate_section): ..
* elf64-sh64.c (sh_elf64_relocate_section): ..
* elf64-sparc.c (sparc64_elf_check_relocs,
sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section,
sparc64_elf_merge_private_bfd_data): ..
* elf64-x86-64.c (elf64_x86_64_check_relocs,
elf64_x86_64_relocate_section): ..
* elflink.c (_bfd_elf_add_default_symbol,
_bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section,
_bfd_elf_link_output_relocs, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_output_extsym,
elf_get_linked_section_vma, elf_fixup_link_order,
bfd_elf_final_link, bfd_elf_gc_record_vtinherit,
bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): ..
* elfxx-ia64.c (elfNN_ia64_relax_section,
elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): ..
* elfxx-mips.c (mips_elf_perform_relocation,
_bfd_mips_elf_check_relocs,
_bfd_mips_elf_merge_private_bfd_data): ..
* ieee.c (ieee_slurp_external_symbols): ..
* ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): ..
* libbfd.c (_bfd_generic_verify_endian_match): ..
* linker.c (_bfd_generic_link_add_one_symbol,
_bfd_generic_section_already_linked): ..
* pdp11.c (translate_to_native_sym_flags): ..
* pe-mips.c (coff_pe_mips_relocate_section): ..
* peicode.h (pe_ILF_build_a_bfd): ..
* srec.c (srec_bad_byte): ..
* stabs.c (_bfd_link_section_stabs): ..
* xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): ..
Replace all uses of bfd_archive_filename and bfd_get_section_ident
with corresponding %B and %A in _bfd_error_handler format string.
Replace occurrences of "fprintf (stderr," with _bfd_error_handler
calls to use %A and %B. Fix "against symbol .. from section" and
similar error messages. Combine multiple _bfd_error_handler calls
where they were separated due to bfd_archive_filename deficiencies.
* bfd-in2.h: Regenerate.
include/
* bfdlink.h (struct bfd_link_callbacks): Remove "error_handler".
(LD_DEFINITION_IN_DISCARDED_SECTION): Delete.
ld/
* ldmain.c (link_callbacks): Remove "error_handler".
* ldmisc.c: Include elf-bfd.h.
(vfinfo): Sort comment. Handle %A. Use %A instead of
bfd_get_section_indent.
(error_handler): Delete.
* ldmisc.h (error_handler): Delete declaration.
2004-08-13 11:16:01 +08:00
|
|
|
(_("%B: compiled for a 64 bit system and target is 32 bit"), ibfd);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2000-02-28 11:50:32 +08:00
|
|
|
else if ((ibfd->flags & DYNAMIC) == 0)
|
|
|
|
{
|
2004-07-30 18:08:00 +08:00
|
|
|
if (bfd_get_mach (obfd) < ibfd_mach)
|
|
|
|
bfd_set_arch_mach (obfd, bfd_arch_sparc, ibfd_mach);
|
2000-02-28 11:50:32 +08:00
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
|
|
|
|
!= previous_ibfd_e_flags)
|
1999-07-12 18:30:21 +08:00
|
|
|
&& previous_ibfd_e_flags != (unsigned long) -1)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
(*_bfd_error_handler)
|
bfd/
* bfd.c (_bfd_default_error_handler): Handle %A and %B.
(bfd_archive_filename, bfd_get_section_ident): Delete.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call
bfd_archive_filename.
* elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler
to warn about symbols in discarded sections. Use _bfd_error_handler.
* aout-adobe.c (aout_adobe_callback): See below.
* aout-cris.c (swap_ext_reloc_in): ..
* coff-arm.c (find_thumb_glue, find_arm_glue,
coff_arm_relocate_section, bfd_arm_process_before_allocation,
coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags,
coff_arm_copy_private_bfd_data): ..
* coff-i860.c (i860_reloc_processing): ..
* coff-mcore.c (mcore_coff_unsupported_reloc,
coff_mcore_relocate_section): ..
* coff-ppc.c (coff_ppc_relocate_section): ..
* coff-rs6000.c (xcoff_create_csect_from_smclas
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_swap_insns, sh_relocate_section): ..
* coff-tic54x.c (tic54x_reloc_processing): ..
* coff-tic80.c (coff_tic80_relocate_section): ..
* coff64-rs6000.c (xcoff64_create_csect_from_smclas): ..
* coffcode.h (styp_to_sec_flags, coff_slurp_line_table,
coff_slurp_symbol_table, coff_classify_symbol,
coff_slurp_reloc_table): ..
* coffgen.c (_bfd_coff_read_string_table): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd,
_bfd_coff_generic_relocate_section): ..
* cpu-arm.c (bfd_arm_merge_machines): ..
* cpu-sh.c (sh_merge_bfd_arch): ..
* elf-hppa.h (elf_hppa_relocate_section): ..
* elf.c (bfd_elf_string_from_elf_section, setup_group,
_bfd_elf_setup_group_pointers, bfd_section_from_shdr,
assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol,
copy_private_bfd_data, _bfd_elf_validate_reloc): ..
* elf32-arm.h (find_thumb_glue, find_arm_glue,
bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub,
elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate,
elf32_arm_relocate_section, elf32_arm_set_private_flags,
elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): ..
* elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs,
cris_elf_merge_private_bfd_data
* elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): ..
* elf32-gen.c (elf32_generic_link_add_symbols): ..
* elf32-hppa.c (hppa_add_stub, hppa_build_one_stub,
elf32_hppa_check_relocs, get_local_syms, final_link_relocate,
elf32_hppa_relocate_section): ..
* elf32-i370.c (i370_elf_merge_private_bfd_data,
i370_elf_check_relocs, i370_elf_relocate_section): ..
* elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs,
elf_i386_relocate_section): ..
* elf32-m32r.c (m32r_elf_relocate_section,
m32r_elf_merge_private_bfd_data): ..
* elf32-m68hc1x.c (m68hc12_add_stub,
_bfd_m68hc11_elf_merge_private_bfd_data): ..
* elf32-m68k.c (elf_m68k_relocate_section): ..
* elf32-mcore.c (mcore_elf_unsupported_reloc,
mcore_elf_relocate_section): ..
* elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc,
ppc_elf_check_relocs, ppc_elf_relocate_section,
ppc_elf_begin_write_processing): ..
* elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn,
elf_s390_relocate_section): ..
* elf32-sh-symbian.c (sh_symbian_import_as,
sh_symbian_process_embedded_commands,
sh_symbian_relocate_section): ..
* elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes,
sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs,
sh_elf_merge_private_data): ..
* elf32-sparc.c (elf32_sparc_check_relocs,
elf32_sparc_relocate_section,
elf32_sparc_merge_private_bfd_data): ..
* elf32-v850.c (v850_elf_check_relocs,
v850_elf_merge_private_bfd_data): ..
* elf32-xtensa.c (elf_xtensa_check_relocs,
elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): ..
* elf64-alpha.c (elf64_alpha_relax_with_lituse,
elf64_alpha_relax_got_load, elf64_alpha_size_got_sections,
elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): ..
* elf64-gen.c (elf64_generic_link_add_symbols): ..
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub,
ppc64_elf_check_relocs, ppc64_elf_edit_opd,
ppc64_elf_relocate_section): ..
* elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn,
elf_s390_relocate_section): ..
* elf64-sh64.c (sh_elf64_relocate_section): ..
* elf64-sparc.c (sparc64_elf_check_relocs,
sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section,
sparc64_elf_merge_private_bfd_data): ..
* elf64-x86-64.c (elf64_x86_64_check_relocs,
elf64_x86_64_relocate_section): ..
* elflink.c (_bfd_elf_add_default_symbol,
_bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section,
_bfd_elf_link_output_relocs, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_output_extsym,
elf_get_linked_section_vma, elf_fixup_link_order,
bfd_elf_final_link, bfd_elf_gc_record_vtinherit,
bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): ..
* elfxx-ia64.c (elfNN_ia64_relax_section,
elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): ..
* elfxx-mips.c (mips_elf_perform_relocation,
_bfd_mips_elf_check_relocs,
_bfd_mips_elf_merge_private_bfd_data): ..
* ieee.c (ieee_slurp_external_symbols): ..
* ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): ..
* libbfd.c (_bfd_generic_verify_endian_match): ..
* linker.c (_bfd_generic_link_add_one_symbol,
_bfd_generic_section_already_linked): ..
* pdp11.c (translate_to_native_sym_flags): ..
* pe-mips.c (coff_pe_mips_relocate_section): ..
* peicode.h (pe_ILF_build_a_bfd): ..
* srec.c (srec_bad_byte): ..
* stabs.c (_bfd_link_section_stabs): ..
* xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): ..
Replace all uses of bfd_archive_filename and bfd_get_section_ident
with corresponding %B and %A in _bfd_error_handler format string.
Replace occurrences of "fprintf (stderr," with _bfd_error_handler
calls to use %A and %B. Fix "against symbol .. from section" and
similar error messages. Combine multiple _bfd_error_handler calls
where they were separated due to bfd_archive_filename deficiencies.
* bfd-in2.h: Regenerate.
include/
* bfdlink.h (struct bfd_link_callbacks): Remove "error_handler".
(LD_DEFINITION_IN_DISCARDED_SECTION): Delete.
ld/
* ldmain.c (link_callbacks): Remove "error_handler".
* ldmisc.c: Include elf-bfd.h.
(vfinfo): Sort comment. Handle %A. Use %A instead of
bfd_get_section_indent.
(error_handler): Delete.
* ldmisc.h (error_handler): Delete declaration.
2004-08-13 11:16:01 +08:00
|
|
|
(_("%B: linking little endian files with big endian files"), ibfd);
|
2002-11-30 16:39:46 +08:00
|
|
|
error = TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_bad_value);
|
2002-11-30 16:39:46 +08:00
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The final processing done just before writing out the object file.
|
|
|
|
We need to set the e_machine field appropriately. */
|
|
|
|
|
|
|
|
static void
|
2005-04-20 05:26:30 +08:00
|
|
|
elf32_sparc_final_write_processing (bfd *abfd,
|
|
|
|
bfd_boolean linker ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
switch (bfd_get_mach (abfd))
|
|
|
|
{
|
|
|
|
case bfd_mach_sparc :
|
2004-09-23 08:51:33 +08:00
|
|
|
case bfd_mach_sparc_sparclet :
|
|
|
|
case bfd_mach_sparc_sparclite :
|
1999-05-03 15:29:11 +08:00
|
|
|
break; /* nothing to do */
|
|
|
|
case bfd_mach_sparc_v8plus :
|
|
|
|
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
|
|
|
|
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
|
|
|
|
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS;
|
|
|
|
break;
|
|
|
|
case bfd_mach_sparc_v8plusa :
|
|
|
|
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
|
|
|
|
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
|
|
|
|
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1;
|
|
|
|
break;
|
2000-10-20 18:38:47 +08:00
|
|
|
case bfd_mach_sparc_v8plusb :
|
|
|
|
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
|
|
|
|
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
|
|
|
|
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1
|
|
|
|
| EF_SPARC_SUN_US3;
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
case bfd_mach_sparc_sparclite_le :
|
|
|
|
elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
abort ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-08-23 23:14:18 +08:00
|
|
|
|
|
|
|
static enum elf_reloc_type_class
|
2005-04-20 05:26:30 +08:00
|
|
|
elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
|
2001-08-23 23:14:18 +08:00
|
|
|
{
|
2001-09-24 09:38:31 +08:00
|
|
|
switch ((int) ELF32_R_TYPE (rela->r_info))
|
2001-08-23 23:14:18 +08:00
|
|
|
{
|
|
|
|
case R_SPARC_RELATIVE:
|
|
|
|
return reloc_class_relative;
|
|
|
|
case R_SPARC_JMP_SLOT:
|
|
|
|
return reloc_class_plt;
|
|
|
|
case R_SPARC_COPY:
|
|
|
|
return reloc_class_copy;
|
|
|
|
default:
|
|
|
|
return reloc_class_normal;
|
|
|
|
}
|
|
|
|
}
|
2004-04-22 22:45:32 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define TARGET_BIG_SYM bfd_elf32_sparc_vec
|
|
|
|
#define TARGET_BIG_NAME "elf32-sparc"
|
|
|
|
#define ELF_ARCH bfd_arch_sparc
|
|
|
|
#define ELF_MACHINE_CODE EM_SPARC
|
|
|
|
#define ELF_MACHINE_ALT1 EM_SPARC32PLUS
|
|
|
|
#define ELF_MAXPAGESIZE 0x10000
|
|
|
|
|
2005-04-20 05:26:30 +08:00
|
|
|
#define bfd_elf32_bfd_merge_private_bfd_data \
|
|
|
|
elf32_sparc_merge_private_bfd_data
|
|
|
|
#define elf_backend_final_write_processing \
|
|
|
|
elf32_sparc_final_write_processing
|
|
|
|
#define elf_backend_grok_psinfo elf32_sparc_grok_psinfo
|
|
|
|
#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
|
|
|
|
|
|
|
|
#define elf_info_to_howto _bfd_sparc_elf_info_to_howto
|
|
|
|
#define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup
|
bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
(elf32_sparc_rev32_howto): New variable.
(sparc_reloc_map): Add TLS relocs.
(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
Handle REV32.
(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
New functions.
(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
struct elf32_sparc_link_hash_table):
New structures.
(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
elf32_sparc_hash_table): Define.
(link_hash_newfunc, elf32_sparc_link_hash_table_create,
create_got_section, elf32_sparc_create_dynamic_sections,
elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
functions.
(elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
reference counting.
(elf32_sparc_gc_sweep_hook): Likewise.
(elf32_sparc_adjust_dynamic_symbol): Likewise.
(elf32_sparc_size_dynamic_sections): Likewise.
(elf32_sparc_relocate_section): Likewise.
(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
New functions.
(elf32_sparc_object_p): Allocate backend private object data.
(bfd_elf32_bfd_link_hash_table_create,
elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
elf_backend_can_refcount): Define.
(elf_backend_create_dynamic_sections): Define to
elf32_sparc_create_dynamic_sections.
* reloc.c: Add SPARC TLS relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
(sparc_reloc_map): Likewise.
gas/
* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
(tc_gen_reloc): Handle TLS relocs.
(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
relocs.
* config/obj-elf.c (obj_elf_section_word): Handle tls.
(obj_elf_type): Handle tls_object.
include/
* elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252.
ld/testsuite/
* ld-sparc/sparc.exp: New.
* ld-sparc/tlsg32.s: New test.
* ld-sparc/tlsg32.sd: Likewise.
* ld-sparc/tlsg64.s: Likewise.
* ld-sparc/tlsg64.sd: Likewise.
* ld-sparc/tlslib.s: Likewise.
* ld-sparc/tlsnopic.s: Likewise.
* ld-sparc/tlspic.s: Likewise.
* ld-sparc/tlssunbin32.dd: Likewise.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.s: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunbin32.td: Likewise.
* ld-sparc/tlssunbin64.dd: Likewise.
* ld-sparc/tlssunbin64.rd: Likewise.
* ld-sparc/tlssunbin64.s: Likewise.
* ld-sparc/tlssunbin64.sd: Likewise.
* ld-sparc/tlssunbin64.td: Likewise.
* ld-sparc/tlssunbinpic32.s: Likewise.
* ld-sparc/tlssunbinpic64.s: Likewise.
* ld-sparc/tlssunnopic32.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic32.s: Likewise.
* ld-sparc/tlssunnopic32.sd: Likewise.
* ld-sparc/tlssunnopic64.dd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunnopic64.s: Likewise.
* ld-sparc/tlssunnopic64.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic32.s: Likewise.
* ld-sparc/tlssunpic32.sd: Likewise.
* ld-sparc/tlssunpic32.td: Likewise.
* ld-sparc/tlssunpic64.dd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-sparc/tlssunpic64.s: Likewise.
* ld-sparc/tlssunpic64.sd: Likewise.
* ld-sparc/tlssunpic64.td: Likewise.
2003-01-25 07:44:45 +08:00
|
|
|
#define bfd_elf32_bfd_link_hash_table_create \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_link_hash_table_create
|
|
|
|
#define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section
|
|
|
|
#define bfd_elf32_new_section_hook _bfd_sparc_elf_new_section_hook
|
bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
(elf32_sparc_rev32_howto): New variable.
(sparc_reloc_map): Add TLS relocs.
(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
Handle REV32.
(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
New functions.
(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
struct elf32_sparc_link_hash_table):
New structures.
(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
elf32_sparc_hash_table): Define.
(link_hash_newfunc, elf32_sparc_link_hash_table_create,
create_got_section, elf32_sparc_create_dynamic_sections,
elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
functions.
(elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
reference counting.
(elf32_sparc_gc_sweep_hook): Likewise.
(elf32_sparc_adjust_dynamic_symbol): Likewise.
(elf32_sparc_size_dynamic_sections): Likewise.
(elf32_sparc_relocate_section): Likewise.
(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
New functions.
(elf32_sparc_object_p): Allocate backend private object data.
(bfd_elf32_bfd_link_hash_table_create,
elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
elf_backend_can_refcount): Define.
(elf_backend_create_dynamic_sections): Define to
elf32_sparc_create_dynamic_sections.
* reloc.c: Add SPARC TLS relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
(sparc_reloc_map): Likewise.
gas/
* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
(tc_gen_reloc): Handle TLS relocs.
(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
relocs.
* config/obj-elf.c (obj_elf_section_word): Handle tls.
(obj_elf_type): Handle tls_object.
include/
* elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252.
ld/testsuite/
* ld-sparc/sparc.exp: New.
* ld-sparc/tlsg32.s: New test.
* ld-sparc/tlsg32.sd: Likewise.
* ld-sparc/tlsg64.s: Likewise.
* ld-sparc/tlsg64.sd: Likewise.
* ld-sparc/tlslib.s: Likewise.
* ld-sparc/tlsnopic.s: Likewise.
* ld-sparc/tlspic.s: Likewise.
* ld-sparc/tlssunbin32.dd: Likewise.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.s: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunbin32.td: Likewise.
* ld-sparc/tlssunbin64.dd: Likewise.
* ld-sparc/tlssunbin64.rd: Likewise.
* ld-sparc/tlssunbin64.s: Likewise.
* ld-sparc/tlssunbin64.sd: Likewise.
* ld-sparc/tlssunbin64.td: Likewise.
* ld-sparc/tlssunbinpic32.s: Likewise.
* ld-sparc/tlssunbinpic64.s: Likewise.
* ld-sparc/tlssunnopic32.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic32.s: Likewise.
* ld-sparc/tlssunnopic32.sd: Likewise.
* ld-sparc/tlssunnopic64.dd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunnopic64.s: Likewise.
* ld-sparc/tlssunnopic64.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic32.s: Likewise.
* ld-sparc/tlssunpic32.sd: Likewise.
* ld-sparc/tlssunpic32.td: Likewise.
* ld-sparc/tlssunpic64.dd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-sparc/tlssunpic64.s: Likewise.
* ld-sparc/tlssunpic64.sd: Likewise.
* ld-sparc/tlssunpic64.td: Likewise.
2003-01-25 07:44:45 +08:00
|
|
|
#define elf_backend_copy_indirect_symbol \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_copy_indirect_symbol
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_create_dynamic_sections \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_create_dynamic_sections
|
|
|
|
#define elf_backend_check_relocs _bfd_sparc_elf_check_relocs
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_adjust_dynamic_symbol \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_adjust_dynamic_symbol
|
|
|
|
#define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_size_dynamic_sections \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_size_dynamic_sections
|
|
|
|
#define elf_backend_relocate_section _bfd_sparc_elf_relocate_section
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_finish_dynamic_symbol \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_finish_dynamic_symbol
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_finish_dynamic_sections \
|
2005-04-20 05:26:30 +08:00
|
|
|
_bfd_sparc_elf_finish_dynamic_sections
|
|
|
|
#define bfd_elf32_mkobject _bfd_sparc_elf_mkobject
|
|
|
|
#define elf_backend_object_p _bfd_sparc_elf_object_p
|
|
|
|
#define elf_backend_gc_mark_hook _bfd_sparc_elf_gc_mark_hook
|
|
|
|
#define elf_backend_gc_sweep_hook _bfd_sparc_elf_gc_sweep_hook
|
|
|
|
#define elf_backend_plt_sym_val _bfd_sparc_elf_plt_sym_val
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define elf_backend_can_gc_sections 1
|
bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
(elf32_sparc_rev32_howto): New variable.
(sparc_reloc_map): Add TLS relocs.
(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
Handle REV32.
(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
New functions.
(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
struct elf32_sparc_link_hash_table):
New structures.
(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
elf32_sparc_hash_table): Define.
(link_hash_newfunc, elf32_sparc_link_hash_table_create,
create_got_section, elf32_sparc_create_dynamic_sections,
elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
functions.
(elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
reference counting.
(elf32_sparc_gc_sweep_hook): Likewise.
(elf32_sparc_adjust_dynamic_symbol): Likewise.
(elf32_sparc_size_dynamic_sections): Likewise.
(elf32_sparc_relocate_section): Likewise.
(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
New functions.
(elf32_sparc_object_p): Allocate backend private object data.
(bfd_elf32_bfd_link_hash_table_create,
elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
elf_backend_can_refcount): Define.
(elf_backend_create_dynamic_sections): Define to
elf32_sparc_create_dynamic_sections.
* reloc.c: Add SPARC TLS relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
(sparc_reloc_map): Likewise.
gas/
* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
(tc_gen_reloc): Handle TLS relocs.
(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
relocs.
* config/obj-elf.c (obj_elf_section_word): Handle tls.
(obj_elf_type): Handle tls_object.
include/
* elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252.
ld/testsuite/
* ld-sparc/sparc.exp: New.
* ld-sparc/tlsg32.s: New test.
* ld-sparc/tlsg32.sd: Likewise.
* ld-sparc/tlsg64.s: Likewise.
* ld-sparc/tlsg64.sd: Likewise.
* ld-sparc/tlslib.s: Likewise.
* ld-sparc/tlsnopic.s: Likewise.
* ld-sparc/tlspic.s: Likewise.
* ld-sparc/tlssunbin32.dd: Likewise.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.s: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunbin32.td: Likewise.
* ld-sparc/tlssunbin64.dd: Likewise.
* ld-sparc/tlssunbin64.rd: Likewise.
* ld-sparc/tlssunbin64.s: Likewise.
* ld-sparc/tlssunbin64.sd: Likewise.
* ld-sparc/tlssunbin64.td: Likewise.
* ld-sparc/tlssunbinpic32.s: Likewise.
* ld-sparc/tlssunbinpic64.s: Likewise.
* ld-sparc/tlssunnopic32.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic32.s: Likewise.
* ld-sparc/tlssunnopic32.sd: Likewise.
* ld-sparc/tlssunnopic64.dd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunnopic64.s: Likewise.
* ld-sparc/tlssunnopic64.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic32.s: Likewise.
* ld-sparc/tlssunpic32.sd: Likewise.
* ld-sparc/tlssunpic32.td: Likewise.
* ld-sparc/tlssunpic64.dd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-sparc/tlssunpic64.s: Likewise.
* ld-sparc/tlssunpic64.sd: Likewise.
* ld-sparc/tlssunpic64.td: Likewise.
2003-01-25 07:44:45 +08:00
|
|
|
#define elf_backend_can_refcount 1
|
1999-05-03 15:29:11 +08:00
|
|
|
#define elf_backend_want_got_plt 0
|
|
|
|
#define elf_backend_plt_readonly 0
|
|
|
|
#define elf_backend_want_plt_sym 1
|
|
|
|
#define elf_backend_got_header_size 4
|
2002-07-23 20:29:33 +08:00
|
|
|
#define elf_backend_rela_normal 1
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#include "elf32-target.h"
|