This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Get rid of tdata from elf_section_data
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Thu, 23 Jan 2003 22:13:50 +1030
- Subject: Get rid of tdata from elf_section_data
This patch removes the tdata field from struct bfd_elf_section_data,
and instead allows back-ends to derive their own section_data
structures from the base bfd_elf_section_data. I wanted more than one
extra field for ppc64, and didn't care to suffer a double indirection.
Besides, this should save a little memory for targets that don't need
tdata.
There's also a little tidy of include/elf/sh.h, and the m68hc11/12
targets should compile again.
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.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
Index: include/elf/sh.h
===================================================================
RCS file: /cvs/src/src/include/elf/sh.h,v
retrieving revision 1.11
diff -u -p -r1.11 sh.h
--- include/elf/sh.h 30 Nov 2002 08:39:45 -0000 1.11
+++ include/elf/sh.h 23 Jan 2003 11:08:49 -0000
@@ -1,5 +1,5 @@
/* SH ELF support for BFD.
- Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -70,61 +70,6 @@
/* Symbol should be handled as DataLabel (attached to global SHN_UNDEF
symbols). */
#define STT_DATALABEL STT_LOPROC
-
-#define SH64_CRANGES_SECTION_NAME ".cranges"
-enum sh64_elf_cr_type {
- CRT_NONE = 0,
- CRT_DATA = 1,
- CRT_SH5_ISA16 = 2,
- CRT_SH5_ISA32 = 3
-};
-
-/* The official definition is this:
-
- typedef struct {
- Elf32_Addr cr_addr;
- Elf32_Word cr_size;
- Elf32_Half cr_type;
- } Elf32_CRange;
-
- but we have no use for that exact type. Instead we use this struct for
- the internal representation. */
-typedef struct {
- bfd_vma cr_addr;
- bfd_size_type cr_size;
- enum sh64_elf_cr_type cr_type;
-} sh64_elf_crange;
-
-#define SH64_CRANGE_SIZE (4 + 4 + 2)
-#define SH64_CRANGE_CR_ADDR_OFFSET 0
-#define SH64_CRANGE_CR_SIZE_OFFSET 4
-#define SH64_CRANGE_CR_TYPE_OFFSET (4 + 4)
-
-/* Get the contents type of an arbitrary address, or return CRT_NONE. */
-extern enum sh64_elf_cr_type sh64_get_contents_type
- PARAMS ((asection *, bfd_vma, sh64_elf_crange *));
-
-/* Simpler interface.
- FIXME: This seems redundant now that we export the interface above. */
-extern bfd_boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma));
-
-extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *));
-extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *));
-extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *));
-extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *));
-
-/* We put this in elf_section_data (section)->tdata. */
-struct sh64_section_data
-{
- flagword contents_flags;
-
- /* Only used in the cranges section, but we don't have an official
- backend-specific bfd field. */
- bfd_size_type cranges_growth;
-};
-
-#define sh64_elf_section_data(sec) \
- ((struct sh64_section_data *) ((elf_section_data (sec))->tdata))
#include "elf/reloc-macros.h"
Index: include/opcode/m68hc11.h
===================================================================
RCS file: /cvs/src/src/include/opcode/m68hc11.h,v
retrieving revision 1.2
diff -u -p -r1.2 m68hc11.h
--- include/opcode/m68hc11.h 13 Aug 2002 19:00:40 -0000 1.2
+++ include/opcode/m68hc11.h 23 Jan 2003 11:08:52 -0000
@@ -1,5 +1,5 @@
/* m68hc11.h -- Header file for Motorola 68HC11 & 68HC12 opcode table
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@nerim.fr)
This file is part of GDB, GAS, and the GNU binutils.
@@ -388,6 +388,7 @@ Software Foundation, 59 Temple Place - S
/* CPU identification. */
#define cpu6811 0x01
#define cpu6812 0x02
+#define cpu6812s 0x04
/* The opcode table is an array of struct m68hc11_opcode. */
struct m68hc11_opcode {
@@ -424,4 +425,3 @@ extern const struct m68hc12_opcode_alias
extern const int m68hc12_num_alias;
#endif /* _OPCODE_M68HC11_H */
-
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.90
diff -u -p -r1.90 elf-bfd.h
--- bfd/elf-bfd.h 30 Nov 2002 08:39:36 -0000 1.90
+++ bfd/elf-bfd.h 23 Jan 2003 11:08:59 -0000
@@ -1,6 +1,6 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -941,13 +941,6 @@ struct bfd_elf_section_data
/* The number of relocations currently assigned to REL_HDR2. */
unsigned int rel_count2;
- /* A pointer to a linked list tracking dynamic relocs copied for
- local symbols. */
- PTR local_dynrel;
-
- /* A pointer to the bfd section used for dynamic relocs. */
- asection *sreloc;
-
/* The ELF section number of this section. Only used for an output
file. */
int this_idx;
@@ -960,6 +953,12 @@ struct bfd_elf_section_data
REL_HDR2 if any. Only used for an output file. */
int rel_idx2;
+ /* Used by the backend linker when generating a shared library to
+ record the dynamic symbol index for a section symbol
+ corresponding to this section. A value of 0 means that there is
+ no dynamic symbol for this section. */
+ int dynindx;
+
/* Used by the backend linker to store the symbol hash table entries
associated with relocs against global symbols. */
struct elf_link_hash_entry **rel_hashes;
@@ -969,17 +968,12 @@ struct bfd_elf_section_data
pointer may be NULL. It is used by the backend linker. */
Elf_Internal_Rela *relocs;
- /* Used by the backend linker when generating a shared library to
- record the dynamic symbol index for a section symbol
- corresponding to this section. A value of 0 means that there is
- no dynamic symbol for this section. */
- long dynindx;
-
- /* A pointer used for various section optimizations. */
- PTR sec_info;
+ /* A pointer to a linked list tracking dynamic relocs copied for
+ local symbols. */
+ PTR local_dynrel;
- /* Type of that information. */
- enum elf_link_info_type sec_info_type;
+ /* A pointer to the bfd section used for dynamic relocs. */
+ asection *sreloc;
union {
/* Group name, if this section is a member of a group. */
@@ -993,8 +987,11 @@ struct bfd_elf_section_data
the linker. */
asection *next_in_group;
- /* A pointer available for the processor specific ELF backend. */
- PTR tdata;
+ /* A pointer used for various section optimizations. */
+ PTR sec_info;
+
+ /* Type of sec_info information. */
+ enum elf_link_info_type sec_info_type;
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.174
diff -u -p -r1.174 elf.c
--- bfd/elf.c 28 Dec 2002 21:15:35 -0000 1.174
+++ bfd/elf.c 23 Jan 2003 11:09:02 -0000
@@ -1,6 +1,6 @@
/* ELF executable support for BFD.
- 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.
@@ -2136,12 +2136,16 @@ _bfd_elf_new_section_hook (abfd, sec)
asection *sec;
{
struct bfd_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
- sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt);
- if (!sdata)
- return FALSE;
- sec->used_by_bfd = (PTR) sdata;
+ sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
+ if (sdata == NULL)
+ {
+ bfd_size_type amt = sizeof (*sdata);
+ sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = (PTR) sdata;
+ }
/* Indicate whether or not this section should use RELA relocations. */
sdata->use_rela_p
Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.160
diff -u -p -r1.160 elf32-mips.c
--- bfd/elf32-mips.c 30 Nov 2002 08:39:38 -0000 1.160
+++ bfd/elf32-mips.c 23 Jan 2003 11:09:04 -0000
@@ -1,6 +1,6 @@
/* MIPS-specific support for 32-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.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -1917,6 +1917,7 @@ static const struct ecoff_debug_swap mip
#define bfd_elf32_bfd_is_local_label_name \
mips_elf_is_local_label_name
#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
+#define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
#define bfd_elf32_bfd_get_relocated_section_contents \
_bfd_elf_mips_get_relocated_section_contents
Index: bfd/elf32-sh64.h
===================================================================
RCS file: bfd/elf32-sh64.h
diff -N bfd/elf32-sh64.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ bfd/elf32-sh64.h 23 Jan 2003 11:09:04 -0000
@@ -0,0 +1,83 @@
+/* SH ELF support for BFD.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ 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.
+
+ 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef ELF32_SH64_H
+#define ELF32_SH64_H
+
+#define SH64_CRANGES_SECTION_NAME ".cranges"
+enum sh64_elf_cr_type {
+ CRT_NONE = 0,
+ CRT_DATA = 1,
+ CRT_SH5_ISA16 = 2,
+ CRT_SH5_ISA32 = 3
+};
+
+/* The official definition is this:
+
+ typedef struct {
+ Elf32_Addr cr_addr;
+ Elf32_Word cr_size;
+ Elf32_Half cr_type;
+ } Elf32_CRange;
+
+ but we have no use for that exact type. Instead we use this struct for
+ the internal representation. */
+typedef struct {
+ bfd_vma cr_addr;
+ bfd_size_type cr_size;
+ enum sh64_elf_cr_type cr_type;
+} sh64_elf_crange;
+
+#define SH64_CRANGE_SIZE (4 + 4 + 2)
+#define SH64_CRANGE_CR_ADDR_OFFSET 0
+#define SH64_CRANGE_CR_SIZE_OFFSET 4
+#define SH64_CRANGE_CR_TYPE_OFFSET (4 + 4)
+
+/* Get the contents type of an arbitrary address, or return CRT_NONE. */
+extern enum sh64_elf_cr_type sh64_get_contents_type
+ PARAMS ((asection *, bfd_vma, sh64_elf_crange *));
+
+/* Simpler interface.
+ FIXME: This seems redundant now that we export the interface above. */
+extern bfd_boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma));
+
+extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *));
+
+struct sh64_section_data
+{
+ flagword contents_flags;
+
+ /* Only used in the cranges section, but we don't have an official
+ backend-specific bfd field. */
+ bfd_size_type cranges_growth;
+};
+
+struct _sh64_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ struct sh64_section_data *sh64_info;
+};
+
+#define sh64_elf_section_data(sec) \
+ ((struct _sh64_elf_section_data *) elf_section_data (sec))
+
+#endif /* ELF32_SH64_H */
Index: bfd/elf32-sh64-com.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64-com.c,v
retrieving revision 1.3
diff -u -p -r1.3 elf32-sh64-com.c
--- bfd/elf32-sh64-com.c 30 Nov 2002 08:39:38 -0000 1.3
+++ bfd/elf32-sh64-com.c 23 Jan 2003 11:09:04 -0000
@@ -1,5 +1,5 @@
/* Hitachi SH64-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,6 +24,7 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sh.h"
+#include "elf32-sh64.h"
#include "../opcodes/sh64-opc.h"
static bfd_boolean sh64_address_in_cranges
Index: bfd/elf32-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-sh64.c
--- bfd/elf32-sh64.c 20 Jan 2003 18:06:21 -0000 1.11
+++ bfd/elf32-sh64.c 23 Jan 2003 11:09:04 -0000
@@ -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_addres
#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_addres
#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_
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 (
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 (
= (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, l
&& 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
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.43
diff -u -p -r1.43 elf32-sparc.c
--- bfd/elf32-sparc.c 30 Nov 2002 08:39:38 -0000 1.43
+++ bfd/elf32-sparc.c 23 Jan 2003 11:09:05 -0000
@@ -1,6 +1,6 @@
/* SPARC-specific support for 32-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.
@@ -37,6 +37,8 @@ static bfd_boolean elf32_sparc_adjust_dy
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static bfd_boolean elf32_sparc_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf32_sparc_new_section_hook
+ PARAMS ((bfd *, asection *));
static bfd_boolean elf32_sparc_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
static bfd_boolean elf32_sparc_relocate_section
@@ -1067,8 +1069,30 @@ elf32_sparc_size_dynamic_sections (outpu
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 elf32_sparc_section_data
+{
+ struct bfd_elf_section_data elf;
+ unsigned int do_relax;
+};
+
+#define sec_do_relax(sec) \
+ ((struct elf32_sparc_section_data *) (sec)->used_by_bfd)->do_relax
+
+static bfd_boolean
+elf32_sparc_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct elf32_sparc_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct elf32_sparc_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
elf32_sparc_relax_section (abfd, section, link_info, again)
@@ -1078,7 +1102,7 @@ elf32_sparc_relax_section (abfd, section
bfd_boolean *again;
{
*again = FALSE;
- SET_SEC_DO_RELAX (section);
+ sec_do_relax (section) = 1;
return TRUE;
}
@@ -1590,7 +1614,7 @@ elf32_sparc_relocate_section (output_bfd
r = bfd_reloc_ok;
}
else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30)
- && SEC_DO_RELAX (input_section)
+ && sec_do_relax (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
Index: bfd/elf64-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mips.c,v
retrieving revision 1.42
diff -u -p -r1.42 elf64-mips.c
--- bfd/elf64-mips.c 5 Dec 2002 05:04:00 -0000 1.42
+++ bfd/elf64-mips.c 23 Jan 2003 11:09:07 -0000
@@ -1,5 +1,5 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
@@ -2746,6 +2746,7 @@ const struct elf_size_info mips_elf64_si
MIPS-specific function only applies to IRIX5, which had no 64-bit
ABI. */
#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
+#define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
#define bfd_elf64_bfd_get_relocated_section_contents \
_bfd_elf_mips_get_relocated_section_contents
Index: bfd/elf64-mmix.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mmix.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf64-mmix.c
--- bfd/elf64-mmix.c 8 Dec 2002 03:34:38 -0000 1.21
+++ bfd/elf64-mmix.c 23 Jan 2003 11:09:08 -0000
@@ -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 - Suit
_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, c
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
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,
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,
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, inf
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, inf
* (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
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_greg
/* 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_
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_
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_
#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
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.78
diff -u -p -r1.78 elf64-ppc.c
--- bfd/elf64-ppc.c 16 Jan 2003 04:09:36 -0000 1.78
+++ bfd/elf64-ppc.c 23 Jan 2003 11:09:11 -0000
@@ -56,6 +56,8 @@ static bfd_boolean ppc64_elf_object_p
PARAMS ((bfd *));
static bfd_boolean ppc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
+static bfd_boolean ppc64_elf_new_section_hook
+ PARAMS ((bfd *, asection *));
/* The name of the dynamic interpreter. This is put in the .interp
@@ -1675,6 +1677,35 @@ ppc64_elf_merge_private_bfd_data (ibfd,
return TRUE;
}
+
+struct _ppc64_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ union
+ {
+ asection **func_sec;
+ long *adjust;
+ } opd;
+};
+
+#define ppc64_elf_section_data(sec) \
+ ((struct _ppc64_elf_section_data *) (sec)->used_by_bfd)
+
+static bfd_boolean
+ppc64_elf_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct _ppc64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct _ppc64_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);
+}
/* The following functions are specific to the ELF linker, while
functions above are used generally. Those named ppc64_elf_* are
@@ -2564,7 +2595,7 @@ ppc64_elf_check_relocs (abfd, info, sec,
opd_sym_map = (asection **) bfd_zalloc (abfd, amt);
if (opd_sym_map == NULL)
return FALSE;
- elf_section_data (sec)->tdata = opd_sym_map;
+ ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map;
}
if (htab->elf.dynobj == NULL)
@@ -2939,7 +2970,7 @@ ppc64_elf_gc_mark_hook (sec, info, rel,
sections, as all functions are referenced in .opd. */
else if ((fdh->oh != NULL
&& ((struct ppc_link_hash_entry *) fdh->oh)->is_entry)
- || elf_section_data (sec)->tdata == NULL)
+ || ppc64_elf_section_data (sec)->opd.func_sec == NULL)
rsec = h->root.u.def.section;
break;
@@ -2957,10 +2988,10 @@ ppc64_elf_gc_mark_hook (sec, info, rel,
asection **opd_sym_section;
rsec = bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- opd_sym_section = (asection **) elf_section_data (rsec)->tdata;
+ opd_sym_section = ppc64_elf_section_data (rsec)->opd.func_sec;
if (opd_sym_section != NULL)
rsec = opd_sym_section[sym->st_value / 24];
- else if (elf_section_data (sec)->tdata != NULL)
+ else if (ppc64_elf_section_data (sec)->opd.func_sec != NULL)
rsec = NULL;
}
@@ -3563,13 +3594,13 @@ ppc64_elf_edit_opd (obfd, info)
continue;
amt = sec->_raw_size * sizeof (long) / 24;
- adjust = (long *) elf_section_data (sec)->tdata;
+ adjust = ppc64_elf_section_data (sec)->opd.adjust;
if (adjust == NULL)
{
/* Must be a ld -r link. ie. check_relocs hasn't been
called. */
adjust = (long *) bfd_zalloc (obfd, amt);
- elf_section_data (sec)->tdata = adjust;
+ ppc64_elf_section_data (sec)->opd.adjust = adjust;
}
memset (adjust, 0, (size_t) amt);
@@ -5305,7 +5336,7 @@ ppc64_elf_relocate_section (output_bfd,
TOCstart = elf_gp (output_bfd);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
- is_opd = elf_section_data (input_section)->tdata != NULL;
+ is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL;
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -5361,7 +5392,7 @@ ppc64_elf_relocate_section (output_bfd,
{
long *opd_sym_adjust;
- opd_sym_adjust = (long *) elf_section_data (sec)->tdata;
+ opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust;
if (opd_sym_adjust != NULL && sym->st_value % 24 == 0)
relocation += opd_sym_adjust[sym->st_value / 24];
}
@@ -6338,6 +6369,7 @@ ppc64_elf_finish_dynamic_sections (outpu
#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
+#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook
#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.65
diff -u -p -r1.65 elf64-sparc.c
--- bfd/elf64-sparc.c 30 Nov 2002 08:39:39 -0000 1.65
+++ bfd/elf64-sparc.c 23 Jan 2003 11:09:13 -0000
@@ -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_sect
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 (outpu
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
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
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_s
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
Index: bfd/elfn32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfn32-mips.c,v
retrieving revision 1.5
diff -u -p -r1.5 elfn32-mips.c
--- bfd/elfn32-mips.c 8 Jan 2003 22:00:53 -0000 1.5
+++ bfd/elfn32-mips.c 23 Jan 2003 11:09:14 -0000
@@ -2199,6 +2199,7 @@ static const struct ecoff_debug_swap mip
#define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
#define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
+#define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
#define bfd_elf32_bfd_get_relocated_section_contents \
_bfd_elf_mips_get_relocated_section_contents
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.37
diff -u -p -r1.37 elfxx-mips.c
--- bfd/elfxx-mips.c 2 Jan 2003 21:31:31 -0000 1.37
+++ bfd/elfxx-mips.c 23 Jan 2003 11:09:18 -0000
@@ -61,8 +61,7 @@ struct mips_got_entry
unsigned long gotidx;
};
-/* This structure is used to hold .got information when linking. It
- is stored in the tdata field of the bfd_elf_section_data structure. */
+/* This structure is used to hold .got information when linking. */
struct mips_got_info
{
@@ -79,6 +78,19 @@ struct mips_got_info
struct htab *got_entries;
};
+struct _mips_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ union
+ {
+ struct mips_got_info *got_info;
+ bfd_byte *tdata;
+ } u;
+};
+
+#define mips_elf_section_data(sec) \
+ ((struct _mips_elf_section_data *) (sec)->used_by_bfd)
+
/* This structure is passed to mips_elf_sort_hash_table_f when sorting
the dynamic symbols. */
@@ -638,6 +650,22 @@ mips_elf_link_hash_newfunc (entry, table
return (struct bfd_hash_entry *) ret;
}
+
+bfd_boolean
+_bfd_mips_elf_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct _mips_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct _mips_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);
+}
/* Read ECOFF debugging information from a .mdebug section into a
ecoff_debug_info structure. */
@@ -1467,8 +1495,8 @@ mips_elf_got_info (abfd, sgotp)
sgot = mips_elf_got_section (abfd);
BFD_ASSERT (sgot != NULL);
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
+ g = mips_elf_section_data (sgot)->u.got_info;
BFD_ASSERT (g != NULL);
if (sgotp)
@@ -1997,15 +2025,8 @@ mips_elf_create_got_section (abfd, info)
(htab_del) NULL);
if (g->got_entries == NULL)
return FALSE;
- if (elf_section_data (s) == NULL)
- {
- amt = sizeof (struct bfd_elf_section_data);
- s->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- if (elf_section_data (s) == NULL)
- return FALSE;
- }
- elf_section_data (s)->tdata = (PTR) g;
- elf_section_data (s)->this_hdr.sh_flags
+ mips_elf_section_data (s)->u.got_info = g;
+ mips_elf_section_data (s)->elf.this_hdr.sh_flags
|= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
return TRUE;
@@ -3310,19 +3331,19 @@ _bfd_mips_elf_section_processing (abfd,
if (hdr->sh_type == SHT_MIPS_OPTIONS
&& hdr->bfd_section != NULL
- && elf_section_data (hdr->bfd_section) != NULL
- && elf_section_data (hdr->bfd_section)->tdata != NULL)
+ && mips_elf_section_data (hdr->bfd_section) != NULL
+ && mips_elf_section_data (hdr->bfd_section)->u.tdata != NULL)
{
bfd_byte *contents, *l, *lend;
- /* We stored the section contents in the elf_section_data tdata
- field in the set_section_contents routine. We save the
- section contents so that we don't have to read them again.
+ /* We stored the section contents in the tdata field in the
+ set_section_contents routine. We save the section contents
+ so that we don't have to read them again.
At this point we know that elf_gp is set, so we can look
through the section contents to see if there is an
ODK_REGINFO structure. */
- contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata;
+ contents = mips_elf_section_data (hdr->bfd_section)->u.tdata;
l = contents;
lend = contents + hdr->sh_size;
while (l + sizeof (Elf_External_Options) <= lend)
@@ -4289,8 +4310,8 @@ _bfd_mips_elf_check_relocs (abfd, info,
g = NULL;
else
{
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
+ g = mips_elf_section_data (sgot)->u.got_info;
BFD_ASSERT (g != NULL);
}
}
@@ -4803,8 +4824,8 @@ _bfd_mips_elf_size_dynamic_sections (out
bfd_size_type local_gotno;
bfd *sub;
- BFD_ASSERT (elf_section_data (s) != NULL);
- g = (struct mips_got_info *) elf_section_data (s)->tdata;
+ BFD_ASSERT (mips_elf_section_data (s) != NULL);
+ g = mips_elf_section_data (s)->u.got_info;
BFD_ASSERT (g != NULL);
/* Calculate the total loadable size of the output. That
@@ -5527,7 +5548,7 @@ _bfd_mips_elf_finish_dynamic_symbol (out
sgot = mips_elf_got_section (dynobj);
BFD_ASSERT (sgot != NULL);
BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
+ g = mips_elf_section_data (sgot)->u.got_info;
BFD_ASSERT (g != NULL);
/* Run through the global symbol table, creating GOT entries for all
@@ -5675,7 +5696,7 @@ _bfd_mips_elf_finish_dynamic_sections (o
else
{
BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_got_info *) elf_section_data (sgot)->tdata;
+ g = mips_elf_section_data (sgot)->u.got_info;
BFD_ASSERT (g != NULL);
}
@@ -6504,7 +6525,7 @@ _bfd_mips_elf_hide_symbol (info, entry,
dynobj = elf_hash_table (info)->dynobj;
got = bfd_get_section_by_name (dynobj, ".got");
- g = (struct mips_got_info *) elf_section_data (got)->tdata;
+ g = mips_elf_section_data (got)->u.got_info;
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
@@ -6565,7 +6586,7 @@ _bfd_mips_elf_discard_info (abfd, cookie
if (skip != 0)
{
- elf_section_data (o)->tdata = tdata;
+ mips_elf_section_data (o)->u.tdata = tdata;
o->_cooked_size = o->_raw_size - skip * PDR_SIZE;
ret = TRUE;
}
@@ -6599,7 +6620,7 @@ _bfd_mips_elf_write_section (output_bfd,
if (strcmp (sec->name, ".pdr") != 0)
return FALSE;
- if (elf_section_data (sec)->tdata == NULL)
+ if (mips_elf_section_data (sec)->u.tdata == NULL)
return FALSE;
to = contents;
@@ -6608,7 +6629,7 @@ _bfd_mips_elf_write_section (output_bfd,
from < end;
from += PDR_SIZE, i++)
{
- if (((unsigned char *) elf_section_data (sec)->tdata)[i] == 1)
+ if ((mips_elf_section_data (sec)->u.tdata)[i] == 1)
continue;
if (to != from)
memcpy (to, from, PDR_SIZE);
@@ -6758,7 +6779,7 @@ _bfd_mips_elf_set_section_contents (abfd
if (elf_section_data (section) == NULL)
return FALSE;
}
- c = (bfd_byte *) elf_section_data (section)->tdata;
+ c = mips_elf_section_data (section)->u.tdata;
if (c == NULL)
{
bfd_size_type size;
@@ -6770,7 +6791,7 @@ _bfd_mips_elf_set_section_contents (abfd
c = (bfd_byte *) bfd_zalloc (abfd, size);
if (c == NULL)
return FALSE;
- elf_section_data (section)->tdata = (PTR) c;
+ mips_elf_section_data (section)->u.tdata = c;
}
memcpy (c + offset, location, (size_t) count);
@@ -7070,7 +7091,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Make sure we didn't grow the global .got region. */
dynobj = elf_hash_table (info)->dynobj;
got = bfd_get_section_by_name (dynobj, ".got");
- g = (struct mips_got_info *) elf_section_data (got)->tdata;
+ g = mips_elf_section_data (got)->u.got_info;
if (g->global_gotsym != NULL)
BFD_ASSERT ((elf_hash_table (info)->dynsymcount
Index: bfd/elfxx-mips.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.h,v
retrieving revision 1.7
diff -u -p -r1.7 elfxx-mips.h
--- bfd/elfxx-mips.h 30 Nov 2002 08:39:39 -0000 1.7
+++ bfd/elfxx-mips.h 23 Jan 2003 11:09:18 -0000
@@ -1,5 +1,5 @@
/* MIPS ELF specific backend routines.
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suit
#include "elf/common.h"
#include "elf/internal.h"
+extern bfd_boolean _bfd_mips_elf_new_section_hook
+ PARAMS ((bfd *, asection *));
extern void _bfd_mips_elf_symbol_processing
PARAMS ((bfd *, asymbol *));
extern bfd_boolean _bfd_mips_elf_section_processing
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.48
diff -u -p -r1.48 elfxx-target.h
--- bfd/elfxx-target.h 30 Nov 2002 08:39:39 -0000 1.48
+++ bfd/elfxx-target.h 23 Jan 2003 11:09:19 -0000
@@ -1,6 +1,6 @@
/* Target definitions for NN-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.
@@ -53,7 +53,9 @@
#define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
#endif
#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
+#ifndef bfd_elfNN_new_section_hook
#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
+#endif
#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
#ifndef bfd_elfNN_set_section_contents
#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
Index: opcodes/sh64-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/sh64-dis.c,v
retrieving revision 1.3
diff -u -p -r1.3 sh64-dis.c
--- opcodes/sh64-dis.c 30 Nov 2002 08:39:46 -0000 1.3
+++ opcodes/sh64-dis.c 23 Jan 2003 11:09:24 -0000
@@ -1,5 +1,5 @@
/* Disassemble SH64 instructions.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
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
@@ -25,6 +25,7 @@
/* We need to refer to the ELF header structure. */
#include "elf-bfd.h"
#include "elf/sh.h"
+#include "elf32-sh64.h"
#define ELF_MODE32_CODE_LABEL_P(SYM) \
(((elf_symbol_type *) (SYM))->internal_elf_sym.st_other & STO_SH5_ISA32)
Index: gas/config/tc-sh64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh64.c,v
retrieving revision 1.5
diff -u -p -r1.5 tc-sh64.c
--- gas/config/tc-sh64.c 30 Nov 2002 08:39:44 -0000 1.5
+++ gas/config/tc-sh64.c 23 Jan 2003 11:09:33 -0000
@@ -1,5 +1,5 @@
/* tc-sh64.c -- Assemble code for the Hitachi Super-H SHcompact and SHmedia.
- Copyright 2000, 2001, 2002 Free Software Foundation.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -463,11 +463,11 @@ shmedia_frob_section_type (sec)
else if (seginfo->tc_segment_info_data.contents_type == CRT_SH5_ISA32)
sec_type = SHF_SH5_ISA32;
- sec_elf_data = sh64_elf_section_data (sec);
+ sec_elf_data = sh64_elf_section_data (sec)->sh64_info;
if (sec_elf_data == NULL)
{
sec_elf_data = xcalloc (1, sizeof (*sec_elf_data));
- sh64_elf_section_data (sec) = sec_elf_data;
+ sh64_elf_section_data (sec)->sh64_info = sec_elf_data;
}
sec_elf_data->contents_flags = sec_type;
Index: gas/config/tc-sh64.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh64.h,v
retrieving revision 1.3
diff -u -p -r1.3 tc-sh64.h
--- gas/config/tc-sh64.h 5 Sep 2002 00:01:18 -0000 1.3
+++ gas/config/tc-sh64.h 23 Jan 2003 11:09:33 -0000
@@ -1,5 +1,5 @@
/* This file is tc-sh64.h
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -21,6 +21,7 @@
#define TC_SH64
#include "config/tc-sh.h"
#include "elf/sh.h"
+#include "elf32-sh64.h"
/* We need to override the tc-sh.h settings of HANDLE_ALIGN and
MAX_MEM_FOR_RS_ALIGN_CODE; we might need to put in SHmedia NOP:s, not
Index: gas/config/tc-m68hc11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68hc11.c,v
retrieving revision 1.36
diff -u -p -r1.36 tc-m68hc11.c
--- gas/config/tc-m68hc11.c 17 Jan 2003 22:51:28 -0000 1.36
+++ gas/config/tc-m68hc11.c 23 Jan 2003 11:09:35 -0000
@@ -19,7 +19,6 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdio.h>
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
@@ -376,7 +375,7 @@ md_show_usage (stream)
get_default_target ();
fprintf (stream, _("\
Motorola 68HC11/68HC12/68HCS12 options:\n\
- -m68hc11 | -m68hc12 |
+ -m68hc11 | -m68hc12 |\n\
-m68hcs12 specify the processor [default %s]\n\
-mshort use 16-bit int ABI (default)\n\
-mlong use 32-bit int ABI\n\
Index: ld/emultempl/sh64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/sh64elf.em,v
retrieving revision 1.2
diff -u -p -r1.2 sh64elf.em
--- ld/emultempl/sh64elf.em 30 Nov 2002 08:39:46 -0000 1.2
+++ ld/emultempl/sh64elf.em 23 Jan 2003 11:09:39 -0000
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GLD, the Gnu Linker.
#
@@ -31,6 +31,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sh.h"
+#include "elf32-sh64.h"
static void sh64_elf_${EMULATION_NAME}_before_allocation PARAMS ((void));
static void sh64_elf_${EMULATION_NAME}_after_allocation PARAMS ((void));
@@ -129,7 +130,7 @@ sh64_elf_${EMULATION_NAME}_before_alloca
if (bfd_get_flavour (output_bfd) != bfd_target_elf_flavour)
einfo (_("%FError: non-ELF output formats are not supported by this target's linker.\n"));
- sh64_sec_data = sh64_elf_section_data (osec);
+ sh64_sec_data = sh64_elf_section_data (osec)->sh64_info;
/* Omit excluded or garbage-collected sections. */
if (bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE)
@@ -139,7 +140,7 @@ sh64_elf_${EMULATION_NAME}_before_alloca
if (sh64_sec_data == NULL)
{
sh64_sec_data = xcalloc (1, sizeof (struct sh64_section_data));
- sh64_elf_section_data (osec) = sh64_sec_data;
+ sh64_elf_section_data (osec)->sh64_info = sh64_sec_data;
}
/* First find an input section so we have flags to compare with; the
@@ -330,9 +331,9 @@ sh64_elf_${EMULATION_NAME}_after_allocat
{
oflags_isa = SHF_SH5_ISA32_MIXED;
- BFD_ASSERT (sh64_elf_section_data (osec) != NULL);
+ BFD_ASSERT (sh64_elf_section_data (osec)->sh64_info);
- sh64_elf_section_data (osec)->contents_flags
+ sh64_elf_section_data (osec)->sh64_info->contents_flags
= SHF_SH5_ISA32_MIXED;
need_check_cranges = TRUE;
goto break_2;
@@ -378,7 +379,7 @@ sh64_elf_${EMULATION_NAME}_after_allocat
}
BFD_ASSERT (cranges->contents == NULL);
- BFD_ASSERT (sh64_elf_section_data (cranges) != NULL);
+ BFD_ASSERT (sh64_elf_section_data (cranges)->sh64_info != NULL);
/* Make sure we have .cranges in memory even if there were only
assembler-generated .cranges. */
@@ -395,7 +396,7 @@ sh64_elf_${EMULATION_NAME}_after_allocat
out the number of generated .cranges. */
if (new_cranges == 0)
{
- sh64_elf_section_data (cranges)->cranges_growth = 0;
+ sh64_elf_section_data (cranges)->sh64_info->cranges_growth = 0;
return;
}
@@ -415,7 +416,7 @@ sh64_elf_${EMULATION_NAME}_after_allocat
/* Omit excluded or garbage-collected sections, and output sections
which were not marked as needing further processing. */
if ((bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE) != 0
- || (sh64_elf_section_data (osec)->contents_flags
+ || (sh64_elf_section_data (osec)->sh64_info->contents_flags
!= SHF_SH5_ISA32_MIXED))
continue;
@@ -561,7 +562,7 @@ sh64_elf_${EMULATION_NAME}_after_allocat
Sorting before writing is done by sh64_elf_final_write_processing. */
cranges->_cooked_size = crangesp - cranges->contents;
- sh64_elf_section_data (cranges)->cranges_growth
+ sh64_elf_section_data (cranges)->sh64_info->cranges_growth
= cranges->_cooked_size - cranges->_raw_size;
cranges->_raw_size = cranges->_cooked_size;
}