From 5d13b3b31966d19c8cd83b8e4116db437fb820e2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 25 Mar 2013 06:00:06 +0000 Subject: [PATCH] * elf-bfd.h (struct elf_backend_data ): 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. --- bfd/ChangeLog | 9 +++++++++ bfd/elf-bfd.h | 19 ++++--------------- bfd/elf.c | 2 +- bfd/elf64-x86-64.c | 40 ++++++++++++---------------------------- bfd/elflink.c | 15 ++++++--------- 5 files changed, 32 insertions(+), 53 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0aa68e9..74d0900 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2013-03-25 Alan Modra + + * elf-bfd.h (struct elf_backend_data ): 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 * elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index dd9ba6b..c05807d 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -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 diff --git a/bfd/elf.c b/bfd/elf.c index 3ba7e5f..05d492d 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -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, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 9406479..3aeb4e6 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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; diff --git a/bfd/elflink.c b/bfd/elflink.c index 2da6ac5..b5d9415 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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 -- 2.7.4