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.
This commit is contained in:
parent
f8bd30003a
commit
68bfbfcc5a
19 changed files with 174 additions and 114 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, */
|
||||
|
|
|
@ -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)
|
||||
&& 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)
|
||||
|
|
|
@ -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,
|
||||
|
|
26
bfd/elf.c
26
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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
13
bfd/ieee.c
13
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);
|
||||
|
||||
|
|
44
bfd/mmo.c
44
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
|
||||
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);
|
||||
mmo_section_data (sec)->head));
|
||||
return (! abfd->tdata.mmo_data->have_error
|
||||
&& mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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, \
|
||||
\
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-02-04 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
|
||||
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
|
||||
|
||||
2003-02-02 Richard Sandiford <rsandifo@redhat.com>
|
||||
|
||||
* config/tc-mips.c (enum small_ex_type): Remove.
|
||||
|
|
|
@ -755,11 +755,12 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
|
|||
if (type == SHT_NOBITS)
|
||||
seg_info (sec)->bss = 1;
|
||||
|
||||
if (linkonce)
|
||||
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
||||
bfd_set_section_flags (stdoutput, sec, flags);
|
||||
if (flags & SEC_MERGE)
|
||||
sec->entsize = entsize;
|
||||
elf_group_name (sec) = group_name;
|
||||
elf_linkonce_p (sec) = linkonce;
|
||||
|
||||
/* Add a symbol for this section to the symbol table. */
|
||||
secsym = symbol_find (name);
|
||||
|
@ -776,8 +777,8 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
|
|||
if (((old_sec->flags ^ flags)
|
||||
& (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
|
||||
| SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS
|
||||
| SEC_THREAD_LOCAL))
|
||||
|| linkonce != elf_linkonce_p (sec))
|
||||
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
|
||||
| SEC_THREAD_LOCAL)))
|
||||
as_warn (_("ignoring changed section attributes for %s"), name);
|
||||
if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
|
||||
as_warn (_("ignoring changed section entity size for %s"), name);
|
||||
|
@ -2037,7 +2038,7 @@ elf_frob_file ()
|
|||
|
||||
flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
|
||||
for (s = list.head[i]; s != NULL; s = elf_next_in_group (s))
|
||||
if (elf_linkonce_p (s) != ((flags & SEC_LINK_ONCE) != 0))
|
||||
if ((s->flags ^ flags) & SEC_LINK_ONCE)
|
||||
{
|
||||
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
||||
if (s != list.head[i])
|
||||
|
|
Loading…
Reference in a new issue