aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-02-04 12:34:08 +0000
committerAlan Modra <amodra@gmail.com>2003-02-04 12:34:08 +0000
commit68bfbfcc5aa8bda806bef9edf274059d6ad571fc (patch)
tree67e23bcd83a595235d03d491a88d7ec6ea7ef9f3 /bfd
parentf8bd30003a95f7b0d943688b21d3a5758e898674 (diff)
downloadgdb-68bfbfcc5aa8bda806bef9edf274059d6ad571fc.zip
gdb-68bfbfcc5aa8bda806bef9edf274059d6ad571fc.tar.gz
gdb-68bfbfcc5aa8bda806bef9edf274059d6ad571fc.tar.bz2
bfd
* elf-bfd.h (enum elf_link_info_type): Remove. (struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields to struct sec. Remove linkonce_p field. (elf_linkonce_p): Delete. (elf_discarded_section): Update for sec_info_type change. * section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24. (ELF_INFO_TYPE_NONE): Define. (ELF_INFO_TYPE_STABS): Define. (ELF_INFO_TYPE_MERGE): Define. (ELF_INFO_TYPE_EH_FRAME): Define. (ELF_INFO_TYPE_JUST_SYMS): Define. (STD_SECTION): Update struct sec initializer. * ecoff.c (bfd_debug_section): Likewise. * elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p. * elflink.h: Likewise. * elf-eh-frame.c: Likewise. * elf64-alpha.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * bfd-in2.h: Regenerate. * elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than referring to used_by_bfd. * elf64-sparc.c (sec_do_relax): Likewise. * elf64-mmix.c (mmix_elf_section_data): Likewise. * elfxx-mips.c (mips_elf_section_data): Likewise. * ieee.c (ieee_slurp_section_data): Use ieee_per_section macro. (ieee_get_section_contents): Likewise. (ieee_new_section_hook): Formatting. (ieee_canonicalize_reloc): Remove commented out code. * mmo.c (mmo_section_data): Define. Use throughout file. * oasys.c (oasys_get_section_contents): Use oasys_per_section macro. gas * config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog36
-rw-r--r--bfd/bfd-in2.h29
-rw-r--r--bfd/ecoff.c8
-rw-r--r--bfd/elf-bfd.h30
-rw-r--r--bfd/elf-eh-frame.c8
-rw-r--r--bfd/elf.c26
-rw-r--r--bfd/elf32-sparc.c2
-rw-r--r--bfd/elf64-alpha.c3
-rw-r--r--bfd/elf64-mmix.c2
-rw-r--r--bfd/elf64-sparc.c2
-rw-r--r--bfd/elflink.h18
-rw-r--r--bfd/elfxx-ia64.c3
-rw-r--r--bfd/elfxx-mips.c5
-rw-r--r--bfd/ieee.c13
-rw-r--r--bfd/mmo.c46
-rw-r--r--bfd/oasys.c6
-rw-r--r--bfd/section.c37
17 files changed, 164 insertions, 110 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ef1e407..21d22b3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,39 @@
+2003-02-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (enum elf_link_info_type): Remove.
+ (struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
+ to struct sec. Remove linkonce_p field.
+ (elf_linkonce_p): Delete.
+ (elf_discarded_section): Update for sec_info_type change.
+ * section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
+ flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
+ (ELF_INFO_TYPE_NONE): Define.
+ (ELF_INFO_TYPE_STABS): Define.
+ (ELF_INFO_TYPE_MERGE): Define.
+ (ELF_INFO_TYPE_EH_FRAME): Define.
+ (ELF_INFO_TYPE_JUST_SYMS): Define.
+ (STD_SECTION): Update struct sec initializer.
+ * ecoff.c (bfd_debug_section): Likewise.
+ * elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
+ * elflink.h: Likewise.
+ * elf-eh-frame.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+ * elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
+ referring to used_by_bfd.
+ * elf64-sparc.c (sec_do_relax): Likewise.
+ * elf64-mmix.c (mmix_elf_section_data): Likewise.
+ * elfxx-mips.c (mips_elf_section_data): Likewise.
+ * ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
+ (ieee_get_section_contents): Likewise.
+ (ieee_new_section_hook): Formatting.
+ (ieee_canonicalize_reloc): Remove commented out code.
+ * mmo.c (mmo_section_data): Define. Use throughout file.
+ * oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
+
2003-01-31 Graydon Hoare <graydon@redhat.com>
* Makefile.am (opncls.lo): Add dependency upon libiberty.h.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a079599..462fe71 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1261,10 +1261,35 @@ typedef struct sec
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
- /* Used by the ELF code to mark sections which have been allocated
- to segments. */
+ /* The following flags are used by the ELF linker. */
+
+ /* Mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
+ /* Type of sec_info information. */
+ unsigned int sec_info_type:3;
+#define ELF_INFO_TYPE_NONE 0
+#define ELF_INFO_TYPE_STABS 1
+#define ELF_INFO_TYPE_MERGE 2
+#define ELF_INFO_TYPE_EH_FRAME 3
+#define ELF_INFO_TYPE_JUST_SYMS 4
+
+ /* Nonzero if this section uses RELA relocations, rather than REL. */
+ unsigned int use_rela_p:1;
+
+ /* Bits used by various backends. */
+ unsigned int has_tls_reloc:1;
+
+ /* Usused bits. */
+ unsigned int flag11:1;
+ unsigned int flag12:1;
+ unsigned int flag13:1;
+ unsigned int flag14:1;
+ unsigned int flag15:1;
+ unsigned int flag16:4;
+ unsigned int flag20:4;
+ unsigned int flag24:8;
+
/* End of internal packed boolean fields. */
/* The virtual memory address of the section - where it will be
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 752752f..1ba7d56 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1,6 +1,6 @@
/* Generic ECOFF (Extended-COFF) routines.
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -81,6 +81,10 @@ static asection bfd_debug_section =
"*DEBUG*", 0, 0, NULL, 0, 0, 0,
/* linker_mark, linker_has_input, gc_mark, segment_mark, */
0, 0, 0, 0,
+ /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, */
+ 0, 0, 0, 0, 0,
+ /* flag13, flag14, flag15, flag16, flag20, flag24, */
+ 0, 0, 0, 0, 0, 0,
/* vma, lma, _cooked_size, _raw_size, */
0, 0, 0, 0,
/* output_offset, output_section, alignment_power, */
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 394f70c..8c401b5 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -229,16 +229,6 @@ struct elf_link_loaded_list
bfd *abfd;
};
-enum elf_link_info_type
-{
- ELF_INFO_TYPE_NONE,
- ELF_INFO_TYPE_STABS,
- ELF_INFO_TYPE_MERGE,
- ELF_INFO_TYPE_EH_FRAME,
- ELF_INFO_TYPE_JUST_SYMS,
- ELF_INFO_TYPE_LAST
-};
-
/* Structures used by the eh_frame optimization code. */
struct cie_header
{
@@ -989,29 +979,19 @@ struct bfd_elf_section_data
/* 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;
-
- /* Nonzero when a group is COMDAT. */
- unsigned int linkonce_p:1;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
#define elf_group_name(sec) (elf_section_data(sec)->group.name)
#define elf_group_id(sec) (elf_section_data(sec)->group.id)
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
-#define elf_linkonce_p(sec) (elf_section_data(sec)->linkonce_p)
/* Return TRUE if section has been discarded. */
-#define elf_discarded_section(sec) \
- (!bfd_is_abs_section(sec) \
- && bfd_is_abs_section((sec)->output_section) \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+#define elf_discarded_section(sec) \
+ (!bfd_is_abs_section (sec) \
+ && bfd_is_abs_section ((sec)->output_section) \
+ && sec->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 7c12674..3db9453 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1,5 +1,5 @@
/* .eh_frame section optimization.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -605,7 +605,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
}
elf_section_data (sec)->sec_info = sec_info;
- elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
+ sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
/* Ok, now we can assign new offsets. */
offset = 0;
@@ -758,7 +758,7 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
struct eh_frame_sec_info *sec_info;
unsigned int lo, hi, mid;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
return offset;
sec_info = (struct eh_frame_sec_info *)
elf_section_data (sec)->sec_info;
@@ -828,7 +828,7 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents)
ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
== ELFCLASS64) ? 8 : 4;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
return bfd_set_section_contents (abfd, sec->output_section,
contents,
(file_ptr) sec->output_offset,
diff --git a/bfd/elf.c b/bfd/elf.c
index 7c20971..c4c6487 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -969,11 +969,8 @@ merge_sections_remove_hook (abfd, sec)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
{
- struct bfd_elf_section_data *sec_data;
-
- sec_data = elf_section_data (sec);
- BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
- sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
+ BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE);
+ sec->sec_info_type = ELF_INFO_TYPE_NONE;
}
/* Finish SHF_MERGE section merging. */
@@ -1001,7 +998,7 @@ _bfd_elf_link_just_syms (sec, info)
if (!is_elf_hash_table (info))
return;
- elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
+ sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
}
/* Copy the program header and other data from one object module to
@@ -2007,8 +2004,7 @@ bfd_section_from_shdr (abfd, shindex)
/* In the section to which the relocations apply, mark whether
its relocations are of the REL or RELA variety. */
if (hdr->sh_size != 0)
- elf_section_data (target_sect)->use_rela_p
- = (hdr->sh_type == SHT_RELA);
+ target_sect->use_rela_p = hdr->sh_type == SHT_RELA;
abfd->flags |= HAS_RELOC;
return TRUE;
}
@@ -2148,8 +2144,7 @@ _bfd_elf_new_section_hook (abfd, sec)
}
/* Indicate whether or not this section should use RELA relocations. */
- sdata->use_rela_p
- = get_elf_backend_data (abfd)->default_use_rela_p;
+ sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p;
return TRUE;
}
@@ -2507,7 +2502,7 @@ elf_fake_sections (abfd, asect, failedptrarg)
&& !_bfd_elf_init_reloc_shdr (abfd,
&elf_section_data (asect)->rel_hdr,
asect,
- elf_section_data (asect)->use_rela_p))
+ asect->use_rela_p))
*failedptr = TRUE;
}
@@ -5190,8 +5185,7 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
elf_next_in_group (osec) = elf_next_in_group (isec);
elf_group_name (osec) = elf_group_name (isec);
- elf_section_data (osec)->use_rela_p
- = elf_section_data (isec)->use_rela_p;
+ osec->use_rela_p = isec->use_rela_p;
return TRUE;
}
@@ -7336,7 +7330,7 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
+ sym->st_value);
if ((sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
asection *msec;
@@ -7361,7 +7355,7 @@ _bfd_elf_rel_local_sym (abfd, sym, psec, addend)
{
asection *sec = *psec;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ if (sec->sec_info_type != ELF_INFO_TYPE_MERGE)
return sym->st_value + addend;
return _bfd_merged_section_offset (abfd, psec,
@@ -7379,7 +7373,7 @@ _bfd_elf_section_offset (abfd, info, sec, offset)
struct bfd_elf_section_data *sec_data;
sec_data = elf_section_data (sec);
- switch (sec_data->sec_info_type)
+ switch (sec->sec_info_type)
{
case ELF_INFO_TYPE_STABS:
return _bfd_stab_section_offset (abfd,
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index dcdce31..1c22100 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -2058,7 +2058,7 @@ struct elf32_sparc_section_data
};
#define sec_do_relax(sec) \
- ((struct elf32_sparc_section_data *) (sec)->used_by_bfd)->do_relax
+ ((struct elf32_sparc_section_data *) elf_section_data (sec))->do_relax
static bfd_boolean
elf32_sparc_new_section_hook (abfd, sec)
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 9569b38..3c5df03 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -4438,8 +4438,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
unless it has been done already. */
if ((sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && (elf_section_data (sec)->sec_info_type
- == ELF_INFO_TYPE_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE
&& gotent
&& !gotent->reloc_xlated)
{
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index a7b2806..bcf9962 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -52,7 +52,7 @@ struct _mmix_elf_section_data
};
#define mmix_elf_section_data(sec) \
- ((struct _mmix_elf_section_data *) (sec)->used_by_bfd)
+ ((struct _mmix_elf_section_data *) elf_section_data (sec))
/* For each section containing a base-plus-offset (BPO) reloc, we attach
this struct as mmix_elf_section_data (section)->bpo, which is otherwise
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 7164be2..c9d248e 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1925,7 +1925,7 @@ struct sparc64_elf_section_data
};
#define sec_do_relax(sec) \
- ((struct sparc64_elf_section_data *) (sec)->used_by_bfd)->do_relax
+ ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax
static bfd_boolean
sparc64_elf_new_section_hook (abfd, sec)
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 060b129..aa359a1 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -1,5 +1,5 @@
/* ELF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1304,7 +1304,7 @@ elf_link_add_object_symbols (abfd, info)
Test for --just-symbols by looking at info set up by
_bfd_elf_link_just_syms. */
if ((s = abfd->sections) != NULL
- && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
goto error_return;
/* Find the name to use in a DT_NEEDED entry that refers to this
@@ -2234,7 +2234,7 @@ elf_link_add_object_symbols (abfd, info)
&secdata->sec_info))
goto error_return;
if (secdata->sec_info)
- secdata->sec_info_type = ELF_INFO_TYPE_STABS;
+ stab->sec_info_type = ELF_INFO_TYPE_STABS;
}
}
}
@@ -2256,7 +2256,7 @@ elf_link_add_object_symbols (abfd, info)
s, &secdata->sec_info))
goto error_return;
else if (secdata->sec_info)
- secdata->sec_info_type = ELF_INFO_TYPE_MERGE;
+ s->sec_info_type = ELF_INFO_TYPE_MERGE;
}
}
@@ -5916,7 +5916,7 @@ elf_link_sec_merge_syms (h, data)
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& ((sec = h->root.u.def.section)->flags & SEC_MERGE)
- && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
bfd *output_bfd = (bfd *) data;
@@ -6522,7 +6522,7 @@ elf_link_input_bfd (finfo, input_bfd)
{
isec = section_from_elf_index (input_bfd, isym->st_shndx);
if (isec
- && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
+ && isec->sec_info_type == ELF_INFO_TYPE_MERGE
&& ELF_ST_TYPE (isym->st_info) != STT_SECTION)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,
@@ -7015,7 +7015,7 @@ elf_link_input_bfd (finfo, input_bfd)
{
/* Section written out. */
}
- else switch (elf_section_data (o)->sec_info_type)
+ else switch (o->sec_info_type)
{
case ELF_INFO_TYPE_STABS:
if (! (_bfd_write_section_stabs
@@ -8268,7 +8268,7 @@ elf_bfd_discard_info (output_bfd, info)
if (stab != NULL
&& (stab->_raw_size == 0
|| bfd_is_abs_section (stab->output_section)
- || elf_section_data (stab)->sec_info_type != ELF_INFO_TYPE_STABS))
+ || stab->sec_info_type != ELF_INFO_TYPE_STABS))
stab = NULL;
if (stab == NULL
@@ -8374,7 +8374,7 @@ elf_section_ignore_discarded_relocs (sec)
{
struct elf_backend_data *bed;
- switch (elf_section_data (sec)->sec_info_type)
+ switch (sec->sec_info_type)
{
case ELF_INFO_TYPE_STABS:
case ELF_INFO_TYPE_EH_FRAME:
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 7097de0..df48866 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -3763,8 +3763,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
if ((sym_sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && (elf_section_data (sym_sec)->sec_info_type
- == ELF_INFO_TYPE_MERGE))
+ && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
struct elfNN_ia64_local_hash_entry *loc_h;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 22cc8a2..1410519 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -148,7 +148,7 @@ struct _mips_elf_section_data
};
#define mips_elf_section_data(sec) \
- ((struct _mips_elf_section_data *) (sec)->used_by_bfd)
+ ((struct _mips_elf_section_data *) elf_section_data (sec))
/* This structure is passed to mips_elf_sort_hash_table_f when sorting
the dynamic symbols. */
@@ -4600,8 +4600,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt);
if (!esd->rel_hdr2)
return FALSE;
- _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec,
- !elf_section_data (sec)->use_rela_p);
+ _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, !sec->use_rela_p);
}
return TRUE;
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 779fd71..0811952 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -1,6 +1,6 @@
/* BFD back-end for ieee-695 objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -2074,7 +2074,7 @@ ieee_slurp_section_data (abfd)
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
- ieee_per_section_type *per = (ieee_per_section_type *) s->used_by_bfd;
+ ieee_per_section_type *per = ieee_per_section (s);
if ((s->flags & SEC_DEBUGGING) != 0)
continue;
per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
@@ -2098,7 +2098,7 @@ ieee_slurp_section_data (abfd)
section_number = must_parse_int (&(ieee->h));
s = ieee->section_table[section_number];
s->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
- current_map = (ieee_per_section_type *) s->used_by_bfd;
+ current_map = ieee_per_section (s);
location_ptr = current_map->data - s->vma;
/* The document I have says that Microtec's compilers reset */
/* this after a sec section, even though the standard says not */
@@ -2192,8 +2192,8 @@ ieee_new_section_hook (abfd, newsect)
bfd *abfd;
asection *newsect;
{
- newsect->used_by_bfd = (PTR)
- bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
+ newsect->used_by_bfd
+ = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
if (!newsect->used_by_bfd)
return FALSE;
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
@@ -2221,7 +2221,7 @@ ieee_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;
+ ieee_per_section_type *p = ieee_per_section (section);
if ((section->flags & SEC_DEBUGGING) != 0)
return _bfd_generic_get_section_contents (abfd, section, location,
offset, count);
@@ -2237,7 +2237,6 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
arelent **relptr;
asymbol **symbols;
{
-/* ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
ieee_data_type *ieee = IEEE_DATA (abfd);
diff --git a/bfd/mmo.c b/bfd/mmo.c
index f734fa9..56c9746 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -1,5 +1,5 @@
/* BFD back-end for mmo objects (MMIX-specific object-format).
- Copyright 2001, 2002
+ Copyright 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Hans-Peter Nilsson (hp@bitrange.com).
Infrastructure and other bits originally copied from srec.c and
@@ -335,6 +335,9 @@ struct mmo_section_data_struct
mmo_data_list_type *tail;
};
+#define mmo_section_data(sec) \
+ ((struct mmo_section_data_struct *) (sec)->used_by_bfd)
+
/* These structures are used in bfd_map_over_sections constructs. */
/* Used when writing out sections; all but the register contents section
@@ -1177,12 +1180,11 @@ mmo_get_spec_section (abfd, spec_data_number)
}
loc->next = NULL;
- if (((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail != NULL)
- ((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail->next
- = loc;
+ if (mmo_section_data (sec)->tail != NULL)
+ mmo_section_data (sec)->tail->next = loc;
else
- ((struct mmo_section_data_struct *) (sec->used_by_bfd))->head = loc;
- ((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail = loc;
+ mmo_section_data (sec)->head = loc;
+ mmo_section_data (sec)->tail = loc;
loc->where = section_vma;
return sec;
@@ -1517,8 +1519,7 @@ mmo_get_loc (sec, vma, size)
int size;
{
bfd_size_type allocated_size;
- struct mmo_section_data_struct *sdatap
- = (struct mmo_section_data_struct *) sec->used_by_bfd;
+ struct mmo_section_data_struct *sdatap = mmo_section_data (sec);
struct mmo_data_list_struct *datap = sdatap->head;
struct mmo_data_list_struct *entry;
@@ -2463,15 +2464,9 @@ mmo_internal_write_section (abfd, sec)
if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0)
/* FIXME: Output source file name and line number. */
- return
- mmo_write_loc_chunk_list (abfd,
- ((struct mmo_section_data_struct *)
- (sec->used_by_bfd))->head);
+ return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head);
else if (strcmp (sec->name, MMO_DATA_SECTION_NAME) == 0)
- return
- mmo_write_loc_chunk_list (abfd,
- ((struct mmo_section_data_struct *)
- (sec->used_by_bfd))->head);
+ return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head);
else if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0)
/* Not handled here. */
{
@@ -2486,9 +2481,7 @@ mmo_internal_write_section (abfd, sec)
int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX));
mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_SPEC << 16) | n);
return (! abfd->tdata.mmo_data->have_error
- && mmo_write_chunk_list (abfd,
- ((struct mmo_section_data_struct *)
- (sec->used_by_bfd))->head));
+ && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
}
/* Ignore sections that are just allocated or empty; we write out
_contents_ here. */
@@ -2605,16 +2598,11 @@ EXAMPLE
/* Writing a LOP_LOC ends the LOP_SPEC data, and makes data actually
loaded. */
if (bfd_get_section_flags (abfd, sec) & SEC_LOAD)
- return
- ! abfd->tdata.mmo_data->have_error
- && mmo_write_loc_chunk_list (abfd,
- ((struct mmo_section_data_struct *)
- (sec->used_by_bfd))->head);
- return
- ! abfd->tdata.mmo_data->have_error
- && mmo_write_chunk_list (abfd,
- ((struct mmo_section_data_struct *)
- (sec->used_by_bfd))->head);
+ return (! abfd->tdata.mmo_data->have_error
+ && mmo_write_loc_chunk_list (abfd,
+ mmo_section_data (sec)->head));
+ return (! abfd->tdata.mmo_data->have_error
+ && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
}
return TRUE;
}
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 494e155..3c39386 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1,6 +1,6 @@
/* BFD back-end for oasys objects.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -864,7 +864,7 @@ oasys_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- oasys_per_section_type *p = (oasys_per_section_type *) section->used_by_bfd;
+ oasys_per_section_type *p = oasys_per_section (section);
oasys_slurp_section_data (abfd);
if (! p->initialized)
{
diff --git a/bfd/section.c b/bfd/section.c
index 35a0e5a..89f8126 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1,6 +1,6 @@
/* Object file "section" support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -377,10 +377,35 @@ CODE_FRAGMENT
. {* A mark flag used by some linker backends for garbage collection. *}
. unsigned int gc_mark : 1;
.
-. {* Used by the ELF code to mark sections which have been allocated
-. to segments. *}
+. {* The following flags are used by the ELF linker. *}
+.
+. {* Mark sections which have been allocated to segments. *}
. unsigned int segment_mark : 1;
.
+. {* Type of sec_info information. *}
+. unsigned int sec_info_type:3;
+.#define ELF_INFO_TYPE_NONE 0
+.#define ELF_INFO_TYPE_STABS 1
+.#define ELF_INFO_TYPE_MERGE 2
+.#define ELF_INFO_TYPE_EH_FRAME 3
+.#define ELF_INFO_TYPE_JUST_SYMS 4
+.
+. {* Nonzero if this section uses RELA relocations, rather than REL. *}
+. unsigned int use_rela_p:1;
+.
+. {* Bits used by various backends. *}
+. unsigned int has_tls_reloc:1;
+.
+. {* Usused bits. *}
+. unsigned int flag11:1;
+. unsigned int flag12:1;
+. unsigned int flag13:1;
+. unsigned int flag14:1;
+. unsigned int flag15:1;
+. unsigned int flag16:4;
+. unsigned int flag20:4;
+. unsigned int flag24:8;
+.
. {* End of internal packed boolean fields. *}
.
. {* The virtual memory address of the section - where it will be
@@ -590,6 +615,12 @@ static const asymbol global_syms[] =
/* linker_mark, linker_has_input, gc_mark, segment_mark, */ \
0, 0, 1, 0, \
\
+ /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, */ \
+ 0, 0, 0, 0, 0, \
+ \
+ /* flag13, flag14, flag15, flag16, flag20, flag24, */ \
+ 0, 0, 0, 0, 0, 0, \
+ \
/* vma, lma, _cooked_size, _raw_size, */ \
0, 0, 0, 0, \
\