* 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> 2013-03-23 Alan Modra <amodra@gmail.com>
* elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration. * elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration.

View File

@ -1207,19 +1207,10 @@ struct elf_backend_data
asection *(*common_section) (asection *); asection *(*common_section) (asection *);
/* Return TRUE if we can merge 2 definitions. */ /* Return TRUE if we can merge 2 definitions. */
bfd_boolean (*merge_symbol) (struct bfd_link_info *, bfd_boolean (*merge_symbol) (struct elf_link_hash_entry *,
struct elf_link_hash_entry **, const Elf_Internal_Sym *, asection **,
struct elf_link_hash_entry *, bfd_boolean, bfd_boolean,
Elf_Internal_Sym *, asection **, bfd *, const 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 **);
/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *); 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 *); (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_new_section_hook extern bfd_boolean _bfd_elf_new_section_hook
(bfd *, asection *); (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 extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
(const char *, const struct bfd_elf_special_section *, unsigned int); (const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr 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 USE_RELA_P is TRUE, we use RELA relocations; otherwise, we use REL
relocations. */ relocations. */
bfd_boolean static bfd_boolean
_bfd_elf_init_reloc_shdr (bfd *abfd, _bfd_elf_init_reloc_shdr (bfd *abfd,
struct bfd_elf_section_reloc_data *reldata, struct bfd_elf_section_reloc_data *reldata,
asection *asect, asection *asect,

View File

@ -5038,49 +5038,33 @@ elf_x86_64_common_section (asection *sec)
} }
static bfd_boolean static bfd_boolean
elf_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, elf_x86_64_merge_symbol (struct elf_link_hash_entry *h,
struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED, const Elf_Internal_Sym *sym,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym,
asection **psec, asection **psec,
bfd_vma *pvalue ATTRIBUTE_UNUSED, bfd_boolean newdef,
unsigned int *pold_alignment ATTRIBUTE_UNUSED, bfd_boolean olddef,
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 *oldbfd, bfd *oldbfd,
asection **oldsec) const asection *oldsec)
{ {
/* A normal common symbol and a large common symbol result in a /* A normal common symbol and a large common symbol result in a
normal common symbol. We turn the large common symbol into a normal common symbol. We turn the large common symbol into a
normal one. */ normal one. */
if (!*olddef if (!olddef
&& h->root.type == bfd_link_hash_common && h->root.type == bfd_link_hash_common
&& !*newdef && !newdef
&& bfd_is_com_section (*sec) && bfd_is_com_section (*psec)
&& *oldsec != *sec) && oldsec != *psec)
{ {
if (sym->st_shndx == SHN_COMMON 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 h->root.u.c.p->section
= bfd_make_section_old_way (oldbfd, "COMMON"); = bfd_make_section_old_way (oldbfd, "COMMON");
h->root.u.c.p->section->flags = SEC_ALLOC; h->root.u.c.p->section->flags = SEC_ALLOC;
} }
else if (sym->st_shndx == SHN_X86_64_LCOMMON else if (sym->st_shndx == SHN_X86_64_LCOMMON
&& (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0) && (elf_section_flags (oldsec) & SHF_X86_64_LARGE) == 0)
*psec = *sec = bfd_com_section_ptr; *psec = bfd_com_section_ptr;
} }
return TRUE; 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 /* We now know everything about the old and new symbols. We ask the
backend to check if we can merge them. */ backend to check if we can merge them. */
if (bed->merge_symbol if (bed->merge_symbol != NULL)
&& !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue, {
pold_alignment, skip, override, if (!bed->merge_symbol (h, sym, psec, newdef, olddef, oldbfd, oldsec))
type_change_ok, size_change_ok, return FALSE;
&newdyn, &newdef, &newdyncommon, &newweak, sec = *psec;
abfd, &sec, }
&olddyn, &olddef, &olddyncommon, &oldweak,
oldbfd, &oldsec))
return FALSE;
/* If both the old and the new symbols look like common symbols in a /* 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 dynamic object, set the size of the symbol to the larger of the