diff options
author | Alan Modra <amodra@gmail.com> | 2003-01-23 11:51:35 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-01-23 11:51:35 +0000 |
commit | f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2 (patch) | |
tree | 8e22fc0b8a4086a9c0f64272619db724cc6b1123 /bfd/elf64-mmix.c | |
parent | 489d0400afe4b18c94ce8b6195fa3d91978ecb08 (diff) | |
download | gdb-f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2.zip gdb-f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2.tar.gz gdb-f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2.tar.bz2 |
include/elf/ChangeLog
* sh.h: Split out various bits to bfd/elf32-sh64.h.
include/opcode/ChangeLog
* m68hc11.h (cpu6812s): Define.
bfd/ChangeLog
* elf-bfd.h (struct bfd_elf_section_data): Remove tdata. Change
dynindx to an int. Rearrange for better packing.
* elf.c (_bfd_elf_new_section_hook): Don't alloc if already done.
* elf32-mips.c (bfd_elf32_new_section_hook): Define.
* elf32-sh64.h: New. Split out from include/elf/sh.h.
(struct _sh64_elf_section_data): New struct.
(sh64_elf_section_data): Don't dereference sh64_info (was tdata).
* elf32-sh64-com.c: Include elf32-sh64.h.
* elf32-sh64.c: Likewise.
(sh64_elf_new_section_hook): New function.
(bfd_elf32_new_section_hook): Define.
(sh64_elf_fake_sections): Adjust for sh64_elf_section_data change.
(sh64_bfd_elf_copy_private_section_data): Likewise.
(sh64_elf_final_write_processing): Likewise.
* elf32-sparc.c (struct elf32_sparc_section_data): New.
(elf32_sparc_new_section_hook): New function.
(SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
(sec_do_relax): Define.
(elf32_sparc_relax_section): Adjust to use sec_do_relax.
(elf32_sparc_relocate_section): Likewise.
* elf64-mips.c (bfd_elf64_new_section_hook): Define.
* elf64-mmix.c (struct _mmix_elf_section_data): New.
(mmix_elf_section_data): Define. Use throughout file.
(mmix_elf_new_section_hook): New function.
(bfd_elf64_new_section_hook): Define.
* elf64-ppc.c (struct _ppc64_elf_section_data): New.
(ppc64_elf_section_data): Define. Use throughout.
(ppc64_elf_new_section_hook): New function.
(bfd_elf64_new_section_hook): Define.
* elf64-sparc.c (struct sparc64_elf_section_data): New.
(sparc64_elf_new_section_hook): New function.
(SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
(sec_do_relax): Define.
(sparc64_elf_relax_section): Adjust to use sec_do_relax.
(sparc64_elf_relocate_section): Likewise.
(bfd_elf64_new_section_hook): Define.
* elfn32-mips.c (bfd_elf32_new_section_hook): Define.
* elfxx-mips.c (struct _mips_elf_section_data): New.
(mips_elf_section_data): Define. Use throughout.
(_bfd_mips_elf_new_section_hook): New function.
(mips_elf_create_got_section): Don't alloc used_by_bfd.
* elfxx-mips.h (_bfd_mips_elf_new_section_hook): Declare.
* elfxx-target.h (bfd_elfNN_new_section_hook): Add #ifndef.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
opcodes/ChangeLog
* sh64-dis.c: Include elf32-sh64.h.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
gas/ChangeLog
* config/tc-sh64.c (shmedia_frob_section_type): Adjust for changed
sh64_elf_section_data.
* config/tc-sh64.h: Include elf32-sh64.h.
* config/tc-m68hc11.c: Don't include stdio.h.
(md_show_usage): Fix missing continuation.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
ld/ChangeLog
* emultempl/sh64elf.em: Include elf32-sh64.h.
(sh64_elf_${EMULATION_NAME}_before_allocation): Adjust for changed
sh64_elf_section_data.
(sh64_elf_${EMULATION_NAME}_after_allocation): Likewise.
Diffstat (limited to 'bfd/elf64-mmix.c')
-rw-r--r-- | bfd/elf64-mmix.c | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 3cca228..a7b2806 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1,5 +1,5 @@ /* MMIX-specific support for 64-bit ELF. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Hans-Peter Nilsson <hp@bitrange.com> This file is part of BFD, the Binary File Descriptor library. @@ -41,8 +41,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ _bfd_abort (__FILE__, __LINE__, \ "bad case for " #x) +struct _mmix_elf_section_data +{ + struct bfd_elf_section_data elf; + union + { + struct bpo_reloc_section_info *reloc; + struct bpo_greg_section_info *greg; + } bpo; +}; + +#define mmix_elf_section_data(sec) \ + ((struct _mmix_elf_section_data *) (sec)->used_by_bfd) + /* For each section containing a base-plus-offset (BPO) reloc, we attach - this struct as elf_section_data (section)->tdata, which is otherwise + this struct as mmix_elf_section_data (section)->bpo, which is otherwise NULL. */ struct bpo_reloc_section_info { @@ -83,7 +96,7 @@ struct bpo_reloc_request bfd_boolean valid; }; -/* We attach this as elf_section_data (sec)->tdata in the linker-allocated +/* We attach this as mmix_elf_section_data (sec)->bpo in the linker-allocated greg contents section (MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME), which is linked into the register contents section (MMIX_REG_CONTENTS_SECTION_NAME). This section is created by the @@ -135,6 +148,9 @@ static void mmix_info_to_howto_rela static int mmix_elf_sort_relocs PARAMS ((const PTR, const PTR)); +static bfd_boolean mmix_elf_new_section_hook + PARAMS ((bfd *, asection *)); + static bfd_boolean mmix_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -795,6 +811,22 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code) return NULL; } +static bfd_boolean +mmix_elf_new_section_hook (abfd, sec) + bfd *abfd; + asection *sec; +{ + struct _mmix_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = (struct _mmix_elf_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = (PTR) sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + /* This function performs the actual bitfiddling and sanity check for a final relocation. Each relocation gets its *worst*-case expansion @@ -983,13 +1015,11 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) case R_MMIX_BASE_PLUS_OFFSET: { struct bpo_reloc_section_info *bpodata - = (struct bpo_reloc_section_info *) - elf_section_data (isec)->tdata; + = mmix_elf_section_data (isec)->bpo.reloc; asection *bpo_greg_section = bpodata->bpo_greg_section; struct bpo_greg_section_info *gregdata - = (struct bpo_greg_section_info *) - elf_section_data (bpo_greg_section)->tdata; + = mmix_elf_section_data (bpo_greg_section)->bpo.greg; size_t bpo_index = gregdata->bpo_reloc_indexes[bpodata->bpo_index++]; @@ -1573,8 +1603,7 @@ mmix_elf_gc_sweep_hook (abfd, info, sec, relocs) const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; { struct bpo_reloc_section_info *bpodata - = (struct bpo_reloc_section_info *) - elf_section_data (sec)->tdata; + = mmix_elf_section_data (sec)->bpo.reloc; asection *allocated_gregs_section; /* If no bpodata here, we have nothing to do. */ @@ -1583,9 +1612,7 @@ mmix_elf_gc_sweep_hook (abfd, info, sec, relocs) allocated_gregs_section = bpodata->bpo_greg_section; - ((struct bpo_greg_section_info *) - elf_section_data (allocated_gregs_section)->tdata) - ->n_bpo_relocs + mmix_elf_section_data (allocated_gregs_section)->bpo.greg->n_bpo_relocs -= bpodata->n_bpo_relocs_this_section; return TRUE; @@ -1698,10 +1725,12 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) bfd_zalloc (bpo_greg_owner, sizeof (struct bpo_greg_section_info)); if (gregdata == NULL) return FALSE; - elf_section_data (allocated_gregs_section)->tdata = gregdata; + mmix_elf_section_data (allocated_gregs_section)->bpo.greg + = gregdata; } else if (gregdata == NULL) - gregdata = elf_section_data (allocated_gregs_section)->tdata; + gregdata + = mmix_elf_section_data (allocated_gregs_section)->bpo.greg; /* Get ourselves some auxiliary info for the BPO-relocs. */ if (bpodata == NULL) @@ -1714,7 +1743,7 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) * (sec->reloc_count + 1)); if (bpodata == NULL) return FALSE; - elf_section_data (sec)->tdata = bpodata; + mmix_elf_section_data (sec)->bpo.reloc = bpodata; bpodata->first_base_plus_offset_reloc = bpodata->bpo_index = gregdata->n_max_bpo_relocs; @@ -2084,8 +2113,7 @@ _bfd_mmix_prepare_linker_allocated_gregs (abfd, info) return TRUE; /* We use the target-data handle in the ELF section data. */ - gregdata = (struct bpo_greg_section_info *) - elf_section_data (bpo_gregs_section)->tdata; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; if (gregdata == NULL) return FALSE; @@ -2163,8 +2191,7 @@ _bfd_mmix_finalize_linker_allocated_gregs (abfd, link_info) /* We use the target-data handle in the ELF section data. */ - gregdata = (struct bpo_greg_section_info *) - elf_section_data (bpo_gregs_section)->tdata; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; if (gregdata == NULL) return FALSE; @@ -2260,8 +2287,7 @@ mmix_dump_bpo_gregs (link_info, pf) if (bpo_gregs_section == NULL) return; - gregdata = (struct bpo_greg_section_info *) - elf_section_data (bpo_gregs_section)->tdata; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; if (gregdata == NULL) return; @@ -2313,8 +2339,7 @@ mmix_elf_relax_section (abfd, sec, link_info, again) asection *bpo_gregs_section = NULL; struct bpo_greg_section_info *gregdata; struct bpo_reloc_section_info *bpodata - = (struct bpo_reloc_section_info *) - elf_section_data (sec)->tdata; + = mmix_elf_section_data (sec)->bpo.reloc; size_t bpono; bfd *bpo_greg_owner; Elf_Internal_Sym *isymbuf = NULL; @@ -2343,8 +2368,7 @@ mmix_elf_relax_section (abfd, sec, link_info, again) bpo_greg_owner = (bfd *) link_info->base_file; bpo_gregs_section = bpodata->bpo_greg_section; - gregdata = (struct bpo_greg_section_info *) - elf_section_data (bpo_gregs_section)->tdata; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; bpono = bpodata->first_base_plus_offset_reloc; @@ -2560,6 +2584,7 @@ mmix_elf_relax_section (abfd, sec, link_info, again) #define elf_backend_section_from_bfd_section \ mmix_elf_section_from_bfd_section +#define bfd_elf64_new_section_hook mmix_elf_new_section_hook #define bfd_elf64_bfd_final_link mmix_elf_final_link #define bfd_elf64_bfd_relax_section mmix_elf_relax_section |