X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felfnn-ia64.c;h=0c441a8891a378ce8962cdcdfef93773c27ff9eb;hb=60d67dc84bbc7d73672d297d714f8a4a0547618d;hp=ef6344728b81a113b337a233ab0c632ee8f999ce;hpb=ce558b89b15a18fd67fdc02a4d410a6d92d2ba63;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index ef6344728b..0c441a8891 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -1,5 +1,5 @@ /* IA-64 support for 64-bit ELF - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2017 Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of BFD, the Binary File Descriptor library. @@ -617,8 +617,9 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec, { _bfd_error_handler /* xgettext:c-format */ - (_("%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect branch."), - sec->owner, sec, (unsigned long) roff); + (_("%B: Can't relax br at %#Lx in section `%A'." + " Please use brl or indirect branch."), + sec->owner, roff, sec); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1274,7 +1275,8 @@ elfNN_ia64_hash_copy_indirect (struct bfd_link_info *info, /* Copy down any references that we may have already seen to the symbol which just became indirect. */ - dir->root.ref_dynamic |= ind->root.ref_dynamic; + if (dir->root.versioned != versioned_hidden) + dir->root.ref_dynamic |= ind->root.ref_dynamic; dir->root.ref_regular |= ind->root.ref_regular; dir->root.ref_regular_nonweak |= ind->root.ref_regular_nonweak; dir->root.needs_plt |= ind->root.needs_plt; @@ -2188,6 +2190,9 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, else h = NULL; + if (h && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) + continue; + /* We can only get preliminary data on whether a symbol is locally or externally defined, as not all of the input files have yet been processed. Do something with what we know, as @@ -2357,12 +2362,15 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; h->ref_regular = 1; } else h = NULL; + if (h && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) + continue; + /* We can only get preliminary data on whether a symbol is locally or externally defined, as not all of the input files have yet been processed. Do something with what we know, as @@ -2715,7 +2723,8 @@ allocate_fptr (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data) if (!bfd_link_executable (x->info) && (!h - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && !UNDEFWEAK_NO_DYNAMIC_RELOC (x->info, h)) || (h->root.type != bfd_link_hash_undefweak && h->root.type != bfd_link_hash_undefined))) { @@ -2844,8 +2853,8 @@ allocate_dynrel_entries (struct elfNN_ia64_dyn_sym_info *dyn_i, shared = bfd_link_pic (x->info); resolved_zero = (dyn_i->h - && ELF_ST_VISIBILITY (dyn_i->h->other) - && dyn_i->h->root.type == bfd_link_hash_undefweak); + && UNDEFWEAK_NO_DYNAMIC_RELOC (x->info, + dyn_i->h)); /* Take care of the GOT and PLT relocations. */ @@ -2954,12 +2963,12 @@ elfNN_ia64_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, /* If this is a weak symbol, and there is a real definition, the processor independent code will have arranged for us to see the real definition first, and we can just use the same value. */ - if (h->u.weakdef != NULL) + if (h->is_weakalias) { - BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined - || h->u.weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->u.weakdef->root.u.def.section; - h->root.u.def.value = h->u.weakdef->root.u.def.value; + struct elf_link_hash_entry *def = weakdef (h); + BFD_ASSERT (def->root.type == bfd_link_hash_defined); + h->root.u.def.section = def->root.u.def.section; + h->root.u.def.value = def->root.u.def.value; return TRUE; } @@ -3317,7 +3326,8 @@ set_got_entry (bfd *abfd, struct bfd_link_info *info, /* Install a dynamic relocation if needed. */ if (((bfd_link_pic (info) && (!dyn_i->h - || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT + || (ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT + && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, dyn_i->h)) || dyn_i->h->root.type != bfd_link_hash_undefweak) && dyn_r_type != R_IA64_DTPREL32LSB && dyn_r_type != R_IA64_DTPREL64LSB) @@ -3481,7 +3491,8 @@ set_pltoff_entry (bfd *abfd, struct bfd_link_info *info, if (!is_plt && bfd_link_pic (info) && (!dyn_i->h - || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT + || (ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT + && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, dyn_i->h)) || dyn_i->h->root.type != bfd_link_hash_undefweak)) { unsigned int dyn_r_type; @@ -3683,9 +3694,8 @@ elfNN_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final) overflow: _bfd_error_handler /* xgettext:c-format */ - (_("%s: short data segment overflowed (0x%lx >= 0x400000)"), - bfd_get_filename (abfd), - (unsigned long) (max_short_vma - min_short_vma)); + (_("%B: short data segment overflowed (%#Lx >= 0x400000)"), + abfd, max_short_vma - min_short_vma); return FALSE; } else if ((gp_val > min_short_vma @@ -3694,8 +3704,7 @@ overflow: && max_short_vma - gp_val >= 0x200000)) { _bfd_error_handler - (_("%s: __gp does not cover short data segment"), - bfd_get_filename (abfd)); + (_("%B: __gp does not cover short data segment"), abfd); return FALSE; } } @@ -3836,8 +3845,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, { _bfd_error_handler /* xgettext:c-format */ - (_("%B: unknown relocation type %d"), - input_bfd, (int) r_type); + (_("%B: unknown relocation type %d"), input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -3945,6 +3953,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, case R_IA64_DIR64LSB: /* Install a dynamic relocation for this reloc. */ if ((dynamic_symbol_p || bfd_link_pic (info)) + && !(h && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) && r_symndx != STN_UNDEF && (input_section->flags & SEC_ALLOC) != 0) { @@ -4473,9 +4482,10 @@ missing_tls_sec: case R_IA64_LTOFF_DTPREL22: _bfd_error_handler /* xgettext:c-format */ - (_("%B: missing TLS section for relocation %s against `%s' at 0x%lx in section `%A'."), - input_bfd, input_section, howto->name, name, - rel->r_offset); + (_("%B: missing TLS section for relocation %s against `%s'" + " at %#Lx in section `%A'."), + input_bfd, howto->name, name, + rel->r_offset, input_section); break; case R_IA64_PCREL21B: @@ -4489,9 +4499,10 @@ missing_tls_sec: that the section is too big to relax. */ _bfd_error_handler /* xgettext:c-format */ - (_("%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> 0x1000000)."), - input_bfd, input_section, howto->name, name, - rel->r_offset, input_section->size); + (_("%B: Can't relax br (%s) to `%s' at %#Lx" + " in section `%A' with size %#Lx (> 0x1000000)."), + input_bfd, howto->name, name, rel->r_offset, + input_section, input_section->size); break; } /* Fall through. */ @@ -4663,13 +4674,6 @@ elfNN_ia64_finish_dynamic_sections (bfd *abfd, dyn.d_un.d_ptr = (sgotplt->output_section->vma + sgotplt->output_offset); break; - - case DT_RELASZ: - /* Do not have RELASZ include JMPREL. This makes things - easier on ld.so. This is not what the rest of BFD set up. */ - dyn.d_un.d_val -= (ia64_info->minplt_entries - * sizeof (ElfNN_External_Rela)); - break; } bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon); @@ -5074,6 +5078,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define elf_backend_fixup_symbol _bfd_elf_link_hash_fixup_symbol #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class #define elf_backend_rela_normal 1 +#define elf_backend_dtrel_excludes_plt 1 #define elf_backend_special_sections elfNN_ia64_special_sections #define elf_backend_default_execstack 0