diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-05-29 20:33:00 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-05-29 20:33:00 +0000 |
commit | d1bf45aa9433f77547b091015145da0109f17917 (patch) | |
tree | 1b18557063e3f660308f0daa92034e8d371f8b5e /bfd/elf32-mips.c | |
parent | 90557a6aea39b0adf094187561fe50579701dd85 (diff) | |
download | gdb-d1bf45aa9433f77547b091015145da0109f17917.zip gdb-d1bf45aa9433f77547b091015145da0109f17917.tar.gz gdb-d1bf45aa9433f77547b091015145da0109f17917.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r-- | bfd/elf32-mips.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index f049ef4..88be852 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -96,7 +96,7 @@ static void mips_elf_final_write_processing static boolean mips_elf_set_private_flags PARAMS ((bfd *, flagword)); static boolean mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); static boolean mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); -static boolean mips_elf_section_from_shdr +static boolean mips_elf32_section_from_shdr PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); static boolean mips_elf_fake_sections PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); @@ -1564,6 +1564,7 @@ mips_elf_copy_private_bfd_data (ibfd, obfd) || (elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags)); + elf_gp (obfd) = elf_gp (ibfd); elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; elf_flags_init (obfd) = true; return true; @@ -1647,17 +1648,17 @@ mips_elf_merge_private_bfd_data (ibfd, obfd) /* Handle a MIPS specific section when reading an object file. This is called when elfcode.h finds a section with an unknown type. + This routine supports both the 32-bit and 64-bit ELF ABI. + FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure how to. */ -static boolean -mips_elf_section_from_shdr (abfd, hdr, name) +boolean +_bfd_mips_elf_section_from_shdr (abfd, hdr, name) bfd *abfd; - Elf32_Internal_Shdr *hdr; - char *name; + Elf_Internal_Shdr *hdr; + const char *name; { - asection *newsect; - /* There ought to be a place to keep ELF backend specific flags, but at the moment there isn't one. We just keep track of the sections by their name, instead. Fortunately, the ABI gives @@ -1712,27 +1713,42 @@ mips_elf_section_from_shdr (abfd, hdr, name) if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) return false; - newsect = hdr->bfd_section; if (hdr->sh_type == SHT_MIPS_DEBUG) { - if (! bfd_set_section_flags (abfd, newsect, - (bfd_get_section_flags (abfd, newsect) + if (! bfd_set_section_flags (abfd, hdr->bfd_section, + (bfd_get_section_flags (abfd, + hdr->bfd_section) | SEC_DEBUGGING))) return false; } + return true; +} + +/* Handle a 32-bit MIPS ELF specific section. */ + +static boolean +mips_elf32_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf_Internal_Shdr *hdr; + char *name; +{ + if (! _bfd_mips_elf_section_from_shdr (abfd, hdr, name)) + return false; + /* FIXME: We should record sh_info for a .gptab section. */ /* For a .reginfo section, set the gp value in the tdata information from the contents of this section. We need the gp value while - processing relocs, so we just get it now. */ + processing relocs, so we just get it now. The .reginfo section + is not used in the 64-bit MIPS ELF ABI. */ if (hdr->sh_type == SHT_MIPS_REGINFO) { Elf32_External_RegInfo ext; Elf32_RegInfo s; - if (! bfd_get_section_contents (abfd, newsect, (PTR) &ext, + if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, (file_ptr) 0, sizeof ext)) return false; bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); @@ -5923,7 +5939,7 @@ static const struct ecoff_debug_swap mips_elf_ecoff_debug_swap = #define elf_info_to_howto_rel mips_info_to_howto_rel #define elf_backend_sym_is_global mips_elf_sym_is_global #define elf_backend_object_p mips_elf_object_p -#define elf_backend_section_from_shdr mips_elf_section_from_shdr +#define elf_backend_section_from_shdr mips_elf32_section_from_shdr #define elf_backend_fake_sections mips_elf_fake_sections #define elf_backend_section_from_bfd_section \ mips_elf_section_from_bfd_section |