* elf-bfd.h (struct elf_backend_data <merge_symbol>): Update proto.

(_bfd_elf_init_reloc_shdr): Delete.
	* elf.c (_bfd_elf_init_reloc_shdr): Make static.
	* elf64-x86-64.c (elf_x86_64_merge_symbol): Trim parameters to
	just what is needed.
	* elflink.c (_bfd_elf_merge_symbol): Update bed->merge_symbol call.
This commit is contained in:
Alan Modra 2013-03-25 06:00:06 +00:00
parent 483cf7761d
commit 5d13b3b319
5 changed files with 32 additions and 53 deletions

View File

@ -1,3 +1,12 @@
2013-03-25 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_backend_data <merge_symbol>): Update proto.
(_bfd_elf_init_reloc_shdr): Delete.
* elf.c (_bfd_elf_init_reloc_shdr): Make static.
* elf64-x86-64.c (elf_x86_64_merge_symbol): Trim parameters to
just what is needed.
* elflink.c (_bfd_elf_merge_symbol): Update bed->merge_symbol call.
2013-03-23 Alan Modra <amodra@gmail.com>
* elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration.

View File

@ -1207,19 +1207,10 @@ struct elf_backend_data
asection *(*common_section) (asection *);
/* Return TRUE if we can merge 2 definitions. */
bfd_boolean (*merge_symbol) (struct bfd_link_info *,
struct elf_link_hash_entry **,
struct elf_link_hash_entry *,
Elf_Internal_Sym *, asection **,
bfd_vma *, unsigned int *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd *, asection **,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd *, asection **);
bfd_boolean (*merge_symbol) (struct elf_link_hash_entry *,
const Elf_Internal_Sym *, asection **,
bfd_boolean, bfd_boolean,
bfd *, const asection *);
/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
@ -1919,8 +1910,6 @@ extern int _bfd_elf_sizeof_headers
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_new_section_hook
(bfd *, asection *);
extern bfd_boolean _bfd_elf_init_reloc_shdr
(bfd *, struct bfd_elf_section_reloc_data *, asection *, bfd_boolean);
extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
(const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr

View File

@ -2521,7 +2521,7 @@ _bfd_elf_single_rel_hdr (asection *sec)
USE_RELA_P is TRUE, we use RELA relocations; otherwise, we use REL
relocations. */
bfd_boolean
static bfd_boolean
_bfd_elf_init_reloc_shdr (bfd *abfd,
struct bfd_elf_section_reloc_data *reldata,
asection *asect,

View File

@ -5038,49 +5038,33 @@ elf_x86_64_common_section (asection *sec)
}
static bfd_boolean
elf_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym,
elf_x86_64_merge_symbol (struct elf_link_hash_entry *h,
const Elf_Internal_Sym *sym,
asection **psec,
bfd_vma *pvalue ATTRIBUTE_UNUSED,
unsigned int *pold_alignment ATTRIBUTE_UNUSED,
bfd_boolean *skip ATTRIBUTE_UNUSED,
bfd_boolean *override ATTRIBUTE_UNUSED,
bfd_boolean *type_change_ok ATTRIBUTE_UNUSED,
bfd_boolean *size_change_ok ATTRIBUTE_UNUSED,
bfd_boolean *newdyn ATTRIBUTE_UNUSED,
bfd_boolean *newdef,
bfd_boolean *newdyncommon ATTRIBUTE_UNUSED,
bfd_boolean *newweak ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED,
asection **sec,
bfd_boolean *olddyn ATTRIBUTE_UNUSED,
bfd_boolean *olddef,
bfd_boolean *olddyncommon ATTRIBUTE_UNUSED,
bfd_boolean *oldweak ATTRIBUTE_UNUSED,
bfd_boolean newdef,
bfd_boolean olddef,
bfd *oldbfd,
asection **oldsec)
const asection *oldsec)
{
/* A normal common symbol and a large common symbol result in a
normal common symbol. We turn the large common symbol into a
normal one. */
if (!*olddef
if (!olddef
&& h->root.type == bfd_link_hash_common
&& !*newdef
&& bfd_is_com_section (*sec)
&& *oldsec != *sec)
&& !newdef
&& bfd_is_com_section (*psec)
&& oldsec != *psec)
{
if (sym->st_shndx == SHN_COMMON
&& (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0)
&& (elf_section_flags (oldsec) & SHF_X86_64_LARGE) != 0)
{
h->root.u.c.p->section
= bfd_make_section_old_way (oldbfd, "COMMON");
h->root.u.c.p->section->flags = SEC_ALLOC;
}
else if (sym->st_shndx == SHN_X86_64_LCOMMON
&& (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0)
*psec = *sec = bfd_com_section_ptr;
&& (elf_section_flags (oldsec) & SHF_X86_64_LARGE) == 0)
*psec = bfd_com_section_ptr;
}
return TRUE;

View File

@ -1347,15 +1347,12 @@ _bfd_elf_merge_symbol (bfd *abfd,
/* We now know everything about the old and new symbols. We ask the
backend to check if we can merge them. */
if (bed->merge_symbol
&& !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue,
pold_alignment, skip, override,
type_change_ok, size_change_ok,
&newdyn, &newdef, &newdyncommon, &newweak,
abfd, &sec,
&olddyn, &olddef, &olddyncommon, &oldweak,
oldbfd, &oldsec))
return FALSE;
if (bed->merge_symbol != NULL)
{
if (!bed->merge_symbol (h, sym, psec, newdef, olddef, oldbfd, oldsec))
return FALSE;
sec = *psec;
}
/* If both the old and the new symbols look like common symbols in a
dynamic object, set the size of the symbol to the larger of the