aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sh64.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-01-23 11:51:35 +0000
committerAlan Modra <amodra@gmail.com>2003-01-23 11:51:35 +0000
commitf0abc2a11f47c3ecdfe0b54421092d17c70fc5f2 (patch)
tree8e22fc0b8a4086a9c0f64272619db724cc6b1123 /bfd/elf32-sh64.c
parent489d0400afe4b18c94ce8b6195fa3d91978ecb08 (diff)
downloadfsf-binutils-gdb-f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2.zip
fsf-binutils-gdb-f0abc2a11f47c3ecdfe0b54421092d17c70fc5f2.tar.gz
fsf-binutils-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/elf32-sh64.c')
-rw-r--r--bfd/elf32-sh64.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 492fd73..13953e6 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -23,6 +23,7 @@
#include "sysdep.h"
#include "elf-bfd.h"
#include "../opcodes/sh64-opc.h"
+#include "elf32-sh64.h"
/* Add a suffix for datalabel indirection symbols. It must not match any
other symbols; user symbols with or without version or other
@@ -37,6 +38,8 @@ struct sh64_find_section_vma_data
bfd_vma addr;
};
+static bfd_boolean sh64_elf_new_section_hook
+ PARAMS ((bfd *, asection *));
static bfd_boolean sh64_elf_copy_private_data
PARAMS ((bfd *, bfd *));
static bfd_boolean sh64_elf_merge_private_data
@@ -85,6 +88,8 @@ static void sh64_find_section_for_address
#define elf_backend_final_write_processing sh64_elf_final_write_processing
#define elf_backend_section_from_shdr sh64_backend_section_from_shdr
+#define bfd_elf32_new_section_hook sh64_elf_new_section_hook
+
/* For objcopy, we need to set up sh64_elf_section_data (asection *) from
incoming section flags. This is otherwise done in sh64elf.em when
linking or tc-sh64.c when assembling. */
@@ -100,6 +105,24 @@ static void sh64_find_section_for_address
#define INCLUDE_SHMEDIA
#include "elf32-sh.c"
+/* Tack some extra info on struct bfd_elf_section_data. */
+
+static bfd_boolean
+sh64_elf_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct _sh64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct _sh64_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);
+}
+
/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass
through SHT_SH5_CR_SORTED on a sorted .cranges section. */
@@ -109,9 +132,9 @@ sh64_elf_fake_sections (output_bfd, elf_section_hdr, asect)
Elf_Internal_Shdr *elf_section_hdr;
asection *asect;
{
- if (sh64_elf_section_data (asect) != NULL)
+ if (sh64_elf_section_data (asect)->sh64_info != NULL)
elf_section_hdr->sh_flags
- |= sh64_elf_section_data (asect)->contents_flags;
+ |= sh64_elf_section_data (asect)->sh64_info->contents_flags;
/* If this section has the SEC_SORT_ENTRIES flag set, it is a sorted
.cranges section passing through objcopy. */
@@ -300,7 +323,7 @@ sh64_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
if (! _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec))
return FALSE;
- sh64_sec_data = sh64_elf_section_data (isec);
+ sh64_sec_data = sh64_elf_section_data (isec)->sh64_info;
if (sh64_sec_data == NULL)
{
sh64_sec_data = bfd_zmalloc (sizeof (struct sh64_section_data));
@@ -312,7 +335,7 @@ sh64_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
= (elf_section_data (isec)->this_hdr.sh_flags
& (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED));
- sh64_elf_section_data (osec) = sh64_sec_data;
+ sh64_elf_section_data (osec)->sh64_info = sh64_sec_data;
}
return TRUE;
@@ -656,7 +679,7 @@ sh64_elf_final_write_processing (abfd, linker)
&& cranges != NULL
&& elf_elfheader (abfd)->e_type != ET_EXEC
&& (ld_generated_cranges_size
- = sh64_elf_section_data (cranges)->cranges_growth) != 0)
+ = sh64_elf_section_data (cranges)->sh64_info->cranges_growth) != 0)
{
bfd_vma incoming_cranges_size
= ((cranges->_cooked_size != 0