aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-sparc.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/elf64-sparc.c
parent489d0400afe4b18c94ce8b6195fa3d91978ecb08 (diff)
downloadgdb-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-sparc.c')
-rw-r--r--bfd/elf64-sparc.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index c3a3f05..7e38d97 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 64-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -77,6 +77,8 @@ static bfd_boolean sparc64_elf_fake_sections
static const char *sparc64_elf_print_symbol_all
PARAMS ((bfd *, PTR, asymbol *));
+static bfd_boolean sparc64_elf_new_section_hook
+ PARAMS ((bfd *, asection *));
static bfd_boolean sparc64_elf_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
static bfd_boolean sparc64_elf_relocate_section
@@ -1868,8 +1870,30 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
return TRUE;
}
-#define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
-#define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
+struct sparc64_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ unsigned int do_relax;
+};
+
+#define sec_do_relax(sec) \
+ ((struct sparc64_elf_section_data *) (sec)->used_by_bfd)->do_relax
+
+static bfd_boolean
+sparc64_elf_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct sparc64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct sparc64_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);
+}
static bfd_boolean
sparc64_elf_relax_section (abfd, section, link_info, again)
@@ -1879,7 +1903,7 @@ sparc64_elf_relax_section (abfd, section, link_info, again)
bfd_boolean *again;
{
*again = FALSE;
- SET_SEC_DO_RELAX (section);
+ sec_do_relax (section) = 1;
return TRUE;
}
@@ -2456,7 +2480,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_WDISP30:
do_wplt30:
- if (SEC_DO_RELAX (input_section)
+ if (sec_do_relax (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
@@ -3116,6 +3140,8 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_reloc_type_lookup
#define bfd_elf64_bfd_relax_section \
sparc64_elf_relax_section
+#define bfd_elf64_new_section_hook \
+ sparc64_elf_new_section_hook
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections