From: Jakub Jelinek Date: Mon, 17 Dec 2001 22:44:12 +0000 (+0000) Subject: * elf-bfd.h (elf_discarded_section): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed4de5e2e022526c1d1294cefd2e3c1973d06c39;p=binutils-gdb.git * elf-bfd.h (elf_discarded_section): Define. * elflink.h (elf_link_input_bfd): Use it. (elf_reloc_symbol_deleted_p): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Don't warn about overflows for pc relative relocs against discarded sections. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5bb1798c55a..fe895c4972c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2001-12-17 Jakub Jelinek + + * elf-bfd.h (elf_discarded_section): Define. + * elflink.h (elf_link_input_bfd): Use it. + (elf_reloc_symbol_deleted_p): Likewise. + + * elf64-alpha.c (elf64_alpha_relocate_section): Don't warn about + overflows for pc relative relocs against discarded sections. + 2001-12-17 Thiemo Seufer * elf32-mips.c (_bfd_mips_elf_relocate_section): Formatting. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 24ebcd9384a..46978d0cb88 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -883,6 +883,12 @@ struct bfd_elf_section_data #define elf_group_name(sec) (elf_section_data(sec)->group_name) #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) +/* 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) + #define get_elf_backend_data(abfd) \ ((struct elf_backend_data *) (abfd)->xvec->backend_data) diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 1bfe15df64d..14c20f3022f 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3628,6 +3628,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, { const char *name; + /* Don't warn if the overflow is due to pc relative reloc + against discarded section. Section optimization code should + handle it. */ + + if (r_symndx < symtab_hdr->sh_info + && sec != NULL && howto->pc_relative + && elf_discarded_section (sec)) + break; + if (h != NULL) name = h->root.root.root.string; else diff --git a/bfd/elflink.h b/bfd/elflink.h index 13f10d2df75..f5eb2771929 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -6551,11 +6551,7 @@ elf_link_input_bfd (finfo, input_bfd) discarded section. */ if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h->root.u.def.section) - && bfd_is_abs_section (h->root.u.def.section - ->output_section) - && (elf_section_data (h->root.u.def.section) - ->sec_info_type != ELF_INFO_TYPE_MERGE)) + && elf_discarded_section (h->root.u.def.section)) { #if BFD_VERSION_DATE < 20031005 if ((o->flags & SEC_DEBUGGING) != 0) @@ -6584,11 +6580,7 @@ elf_link_input_bfd (finfo, input_bfd) { asection *sec = finfo->sections[r_symndx]; - if (sec != NULL - && ! bfd_is_abs_section (sec) - && bfd_is_abs_section (sec->output_section) - && (elf_section_data (sec)->sec_info_type - != ELF_INFO_TYPE_MERGE)) + if (sec != NULL && elf_discarded_section (sec)) { #if BFD_VERSION_DATE < 20031005 if ((o->flags & SEC_DEBUGGING) != 0 @@ -8085,9 +8077,7 @@ elf_reloc_symbol_deleted_p (offset, cookie) if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h->root.u.def.section) - && bfd_is_abs_section (h->root.u.def.section - ->output_section)) + && elf_discarded_section (h->root.u.def.section)) return true; else return false; @@ -8103,9 +8093,7 @@ elf_reloc_symbol_deleted_p (offset, cookie) if (isym.st_shndx < SHN_LORESERVE || isym.st_shndx > SHN_HIRESERVE) { isec = section_from_elf_index (rcookie->abfd, isym.st_shndx); - if (isec != NULL - && ! bfd_is_abs_section (isec) - && bfd_is_abs_section (isec->output_section)) + if (isec != NULL && elf_discarded_section (isec)) return true; } }