2005-07-07 H.J. Lu <hongjiu.lu@intel.com>

* elf-bfd.h (elf_backend_data): Add special_sections.

	* elf.c (_bfd_elf_get_sec_type_attr): Check special_sections
	first.

	* elf32-arm.c (elf_backend_get_sec_type_attr): Removed.
	(elf_backend_special_sections): New. Defined.
	* elf32-m32r.c: Likewise.
	* elf32-m68hc11.c: Likewise.
	* elf32-m68hc12.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-mips.h: Likewise.

	* elfxx-target.h (elf_backend_special_sections): New.
	(elfNN_bed): Initialize special_sections.
This commit is contained in:
H.J. Lu 2005-07-08 00:26:53 +00:00
parent e7de25feb2
commit 29ef70053f
19 changed files with 67 additions and 273 deletions

View File

@ -1,3 +1,30 @@
2005-07-07 H.J. Lu <hongjiu.lu@intel.com>
* elf-bfd.h (elf_backend_data): Add special_sections.
* elf.c (_bfd_elf_get_sec_type_attr): Check special_sections
first.
* elf32-arm.c (elf_backend_get_sec_type_attr): Removed.
(elf_backend_special_sections): New. Defined.
* elf32-m32r.c: Likewise.
* elf32-m68hc11.c: Likewise.
* elf32-m68hc12.c: Likewise.
* elf32-mcore.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-sh64.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-mips.h: Likewise.
* elfxx-target.h (elf_backend_special_sections): New.
(elfNN_bed): Initialize special_sections.
2005-07-07 Bob Wilson <bob.wilson@acm.org>
* xtensa-modules.c: Update tables with Xtensa MMU features.

View File

@ -981,6 +981,9 @@ struct elf_backend_data
const struct elf_size_info *s;
/* An array of target specific special sections. */
const struct bfd_elf_special_section *special_sections;
/* The size in bytes of the header for the GOT. This includes the
so-called reserved entries on some systems. */
bfd_vma got_header_size;

View File

@ -2339,15 +2339,27 @@ _bfd_elf_get_special_section (const char *name,
}
const struct bfd_elf_special_section *
_bfd_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
_bfd_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
int i;
const struct bfd_elf_special_section *spec;
const struct elf_backend_data *bed;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
bed = get_elf_backend_data (abfd);
spec = bed->special_sections;
if (spec)
{
spec = _bfd_elf_get_special_section (sec->name,
bed->special_sections,
sec->use_rela_p);
if (spec != NULL)
return spec;
}
if (sec->name[0] != '.')
return NULL;

View File

@ -6962,24 +6962,6 @@ elf32_arm_symbian_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf32_arm_symbian_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf32_arm_symbian_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
static void
elf32_arm_symbian_begin_write_processing (bfd *abfd,
struct bfd_link_info *link_info
@ -7032,8 +7014,8 @@ elf32_arm_symbian_modify_segment_map (bfd *abfd,
#define bfd_elf32_bfd_link_hash_table_create \
elf32_arm_symbian_link_hash_table_create
#undef elf_backend_get_sec_type_attr
#define elf_backend_get_sec_type_attr elf32_arm_symbian_get_sec_type_attr
#undef elf_backend_special_sections
#define elf_backend_special_sections elf32_arm_symbian_special_sections
#undef elf_backend_begin_write_processing
#define elf_backend_begin_write_processing \

View File

@ -4020,24 +4020,6 @@ static const struct bfd_elf_special_section m32r_elf_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
m32r_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
m32r_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
static bfd_boolean
m32r_elf_fake_sections (bfd *abfd,
Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED,
@ -4141,7 +4123,7 @@ m32r_elf_reloc_type_class (const Elf_Internal_Rela *rela)
#define bfd_elf32_bfd_merge_private_bfd_data m32r_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags m32r_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data m32r_elf_print_private_bfd_data
#define elf_backend_get_sec_type_attr m32r_elf_get_sec_type_attr
#define elf_backend_special_sections m32r_elf_special_sections
#include "elf32-target.h"

View File

@ -1265,24 +1265,6 @@ static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] =
{ ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf32_m68hc11_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf32_m68hc11_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#define ELF_ARCH bfd_arch_m68hc11
#define ELF_MACHINE_CODE EM_68HC11
@ -1302,7 +1284,7 @@ elf32_m68hc11_get_sec_type_attr (bfd *abfd, asection *sec)
#define elf_backend_object_p 0
#define elf_backend_final_write_processing 0
#define elf_backend_can_gc_sections 1
#define elf_backend_get_sec_type_attr elf32_m68hc11_get_sec_type_attr
#define elf_backend_special_sections elf32_m68hc11_special_sections
#define bfd_elf32_bfd_link_hash_table_create \
m68hc11_elf_bfd_link_hash_table_create

View File

@ -543,24 +543,6 @@ static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] =
{ ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf32_m68hc12_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf32_m68hc12_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#define ELF_ARCH bfd_arch_m68hc12
#define ELF_MACHINE_CODE EM_68HC12
@ -578,7 +560,7 @@ elf32_m68hc12_get_sec_type_attr (bfd *abfd, asection *sec)
#define elf_backend_object_p m68hc12_elf_set_mach_from_flags
#define elf_backend_final_write_processing 0
#define elf_backend_can_gc_sections 1
#define elf_backend_get_sec_type_attr elf32_m68hc12_get_sec_type_attr
#define elf_backend_special_sections elf32_m68hc12_special_sections
#define elf_backend_post_process_headers elf32_m68hc11_post_process_headers
#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook

View File

@ -642,24 +642,6 @@ static const struct bfd_elf_special_section mcore_elf_special_sections[]=
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
mcore_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
mcore_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec
#define TARGET_BIG_NAME "elf32-mcore-big"
#define TARGET_LITTLE_SYM bfd_elf32_mcore_little_vec
@ -678,7 +660,7 @@ mcore_elf_get_sec_type_attr (bfd *abfd, asection *sec)
#define elf_backend_gc_mark_hook mcore_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook mcore_elf_gc_sweep_hook
#define elf_backend_check_relocs mcore_elf_check_relocs
#define elf_backend_get_sec_type_attr mcore_elf_get_sec_type_attr
#define elf_backend_special_sections mcore_elf_special_sections
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1

View File

@ -89,7 +89,7 @@ static void sh64_find_section_for_address
#define elf_backend_merge_symbol_attribute sh64_elf_merge_symbol_attribute
#define elf_backend_final_write_processing sh64_elf_final_write_processing
#define elf_backend_section_from_shdr sh64_backend_section_from_shdr
#define elf_backend_get_sec_type_attr sh64_elf_get_sec_type_attr
#define elf_backend_special_sections sh64_elf_special_sections
#define elf_backend_section_flags sh64_elf_section_flags
#define bfd_elf32_new_section_hook sh64_elf_new_section_hook
@ -760,24 +760,6 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
sh64_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
sh64_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf32_sh64_vec
#undef TARGET_BIG_NAME

View File

@ -3054,24 +3054,6 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] =
+ SHF_V850_R0REL) },
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
v850_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
v850_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850"
@ -3096,7 +3078,7 @@ v850_elf_get_sec_type_attr (bfd *abfd, asection *sec)
#define elf_backend_fake_sections v850_elf_fake_sections
#define elf_backend_gc_mark_hook v850_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
#define elf_backend_get_sec_type_attr v850_elf_get_sec_type_attr
#define elf_backend_special_sections v850_elf_special_sections
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1

View File

@ -9489,25 +9489,6 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
{ ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf_xtensa_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf_xtensa_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#ifndef ELF_ARCH
#define TARGET_LITTLE_SYM bfd_elf32_xtensa_le_vec
@ -9566,6 +9547,6 @@ elf_xtensa_get_sec_type_attr (bfd *abfd, asection *sec)
#define elf_backend_reloc_type_class elf_xtensa_reloc_type_class
#define elf_backend_relocate_section elf_xtensa_relocate_section
#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections
#define elf_backend_get_sec_type_attr elf_xtensa_get_sec_type_attr
#define elf_backend_special_sections elf_xtensa_special_sections
#include "elf32-target.h"

View File

@ -5169,24 +5169,6 @@ static const struct bfd_elf_special_section elf64_alpha_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf64_alpha_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf64_alpha_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. Copied
from elf32-mips.c. */
@ -5325,8 +5307,8 @@ static const struct elf_size_info alpha_elf_size_info =
#define elf_backend_size_info \
alpha_elf_size_info
#define elf_backend_get_sec_type_attr \
elf64_alpha_get_sec_type_attr
#define elf_backend_special_sections \
elf64_alpha_special_sections
/* A few constants that determine how the .plt section is set up. */
#define elf_backend_want_got_plt 0

View File

@ -2678,24 +2678,6 @@ static const struct bfd_elf_special_section elf64_hppa_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elf64_hppa_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elf64_hppa_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
/* The hash bucket size is the standard one, namely 4. */
const struct elf_size_info hppa64_elf_size_info =
@ -2792,7 +2774,7 @@ const struct elf_size_info hppa64_elf_size_info =
#define elf_backend_get_symbol_type elf64_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf64_hppa_reloc_type_class
#define elf_backend_rela_normal 1
#define elf_backend_get_sec_type_attr elf64_hppa_get_sec_type_attr
#define elf_backend_special_sections elf64_hppa_special_sections
#include "elf64-target.h"
@ -2801,7 +2783,7 @@ const struct elf_size_info hppa64_elf_size_info =
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf64-hppa-linux"
#undef elf_backend_get_sec_type_attr
#undef elf_backend_special_sections
#define INCLUDED_TARGET_FILE 1
#include "elf64-target.h"

View File

@ -100,7 +100,7 @@ static bfd_vma opd_entry_value
#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook
#define elf_backend_get_sec_type_attr ppc64_elf_get_sec_type_attr
#define elf_backend_special_sections ppc64_elf_special_sections
/* The name of the dynamic interpreter. This is put in the .interp
section. */
@ -2524,24 +2524,6 @@ static const struct bfd_elf_special_section ppc64_elf_special_sections[]=
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
ppc64_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
ppc64_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
struct _ppc64_elf_section_data
{
struct bfd_elf_section_data elf;

View File

@ -4074,24 +4074,6 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
sh64_elf64_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
sh64_elf64_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
#define TARGET_BIG_SYM bfd_elf64_sh64_vec
#define TARGET_BIG_NAME "elf64-sh64"
#define TARGET_LITTLE_SYM bfd_elf64_sh64l_vec
@ -4150,7 +4132,7 @@ sh64_elf64_get_sec_type_attr (bfd *abfd, asection *sec)
sh64_elf64_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
sh64_elf64_finish_dynamic_sections
#define elf_backend_get_sec_type_attr sh64_elf64_get_sec_type_attr
#define elf_backend_special_sections sh64_elf64_special_sections
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1

View File

@ -5058,24 +5058,6 @@ static const struct bfd_elf_special_section elfNN_ia64_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *
elfNN_ia64_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
elfNN_ia64_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}
static bfd_boolean
elfNN_ia64_object_p (bfd *abfd)
{
@ -5297,7 +5279,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
#define elf_backend_rela_normal 1
#define elf_backend_get_sec_type_attr elfNN_ia64_get_sec_type_attr
#define elf_backend_special_sections elfNN_ia64_special_sections
/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with
SHF_LINK_ORDER. But it doesn't set theh sh_link or sh_info fields.

View File

@ -9979,21 +9979,3 @@ const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] =
{ ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
{ NULL, 0, 0, 0, 0 }
};
const struct bfd_elf_special_section *
_bfd_mips_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
const struct bfd_elf_special_section *ssect;
/* See if this is one of the special sections. */
if (sec->name == NULL)
return NULL;
ssect = _bfd_elf_get_special_section (sec->name,
_bfd_mips_elf_special_sections,
sec->use_rela_p);
if (ssect != NULL)
return ssect;
return _bfd_elf_get_sec_type_attr (abfd, sec);
}

View File

@ -127,10 +127,10 @@ extern bfd_boolean _bfd_mips_relax_section
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_vma _bfd_mips_elf_sign_extend
(bfd_vma, int);
extern const struct bfd_elf_special_section *_bfd_mips_elf_get_sec_type_attr
(bfd *, asection *);
extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols
#define elf_backend_get_sec_type_attr _bfd_mips_elf_get_sec_type_attr
#define elf_backend_special_sections _bfd_mips_elf_special_sections
#define elf_backend_eh_frame_address_size _bfd_mips_elf_eh_frame_address_size

View File

@ -509,6 +509,10 @@
#define elf_backend_size_info _bfd_elfNN_size_info
#endif
#ifndef elf_backend_special_sections
#define elf_backend_special_sections NULL
#endif
#ifndef elf_backend_sign_extend_vma
#define elf_backend_sign_extend_vma 0
#endif
@ -591,6 +595,7 @@ static const struct elf_backend_data elfNN_bed =
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
&elf_backend_size_info,
elf_backend_special_sections,
elf_backend_got_header_size,
elf_backend_collect,
elf_backend_type_change_ok,