X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf64-alpha.c;h=767d89c4072e3bf797954c9cc300c1f49fa32e40;hb=a2229c2308383785a88185c4af83ba0565426566;hp=9569b38eed70652bc1b1ad04beaaff6cf52df748;hpb=cc03ec8004768da5aa88f3fdc4607dd68f81583f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 9569b38eed..767d89c407 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -305,7 +305,9 @@ alpha_elf_dynamic_symbol_p (h, info) if ((info->shared && !info->symbolic) || ((h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) + & (ELF_LINK_HASH_DEF_DYNAMIC + | ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR)) == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) return TRUE; @@ -1554,7 +1556,7 @@ elf64_alpha_relax_opt_call (info, symval) } else { - tsec_relocs = (_bfd_elf64_link_read_relocs + tsec_relocs = (_bfd_elf_link_read_relocs (info->abfd, info->tsec, (PTR) NULL, (Elf_Internal_Rela *) NULL, info->link_info->keep_memory)); @@ -2056,7 +2058,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) /* We are not currently changing any sizes, so only one pass. */ *again = FALSE; - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; @@ -2070,7 +2072,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; /* Load the relocations for this section. */ - internal_relocs = (_bfd_elf64_link_read_relocs + internal_relocs = (_bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, link_info->keep_memory)); if (internal_relocs == NULL) @@ -2184,7 +2186,13 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) info.h = NULL; info.other = isym->st_other; - info.first_gotent = &local_got_entries[r_symndx]; + if (local_got_entries) + info.first_gotent = &local_got_entries[r_symndx]; + else + { + info.first_gotent = &info.gotent; + info.gotent = NULL; + } } else { @@ -2457,7 +2465,7 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd_vma *valp; { if (sym->st_shndx == SHN_COMMON - && !info->relocateable + && !info->relocatable && sym->st_size <= elf_gp_size (abfd)) { /* Common symbols less than or equal to -G nn bytes are @@ -3049,7 +3057,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) bfd_boolean got_created; bfd_size_type amt; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table(info)->dynobj; @@ -3855,7 +3863,7 @@ elf64_alpha_always_size_sections (output_bfd, info) { bfd *i; - if (info->relocateable) + if (info->relocatable) return TRUE; /* First, take care of the indirect symbols created by versioning. */ @@ -4082,7 +4090,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (!info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -4168,7 +4176,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info) #define add_dynamic_entry(TAG, VAL) \ bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) - if (!info->shared) + if (info->executable) { if (!add_dynamic_entry (DT_DEBUG, 0)) return FALSE; @@ -4322,7 +4330,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, const char *section_name; /* Handle relocatable links with a smaller loop. */ - if (info->relocateable) + if (info->relocatable) return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, contents, relocs, local_syms, local_sections); @@ -4438,8 +4446,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, unless it has been done already. */ if ((sec->flags & SEC_MERGE) && ELF_ST_TYPE (sym->st_info) == STT_SECTION - && (elf_section_data (sec)->sec_info_type - == ELF_INFO_TYPE_MERGE) + && sec->sec_info_type == ELF_INFO_TYPE_MERGE && gotent && !gotent->reloc_xlated) { @@ -4498,7 +4505,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, else if (h->root.root.type == bfd_link_hash_undefweak) undef_weak_ref = TRUE; else if (info->shared - && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) ; @@ -4510,7 +4516,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) return FALSE; - ret_val = FALSE; continue; } @@ -4576,8 +4581,20 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, value -= gp; goto default_reloc; - case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: + /* If the target section was a removed linkonce section, + r_symndx will be zero. In this case, assume that the + switch will not be used, so don't fill it in. If we + do nothing here, we'll get relocation truncated messages, + due to the placement of the application above 4GB. */ + if (r_symndx == 0) + { + r = bfd_reloc_ok; + break; + } + /* FALLTHRU */ + + case R_ALPHA_GPREL16: case R_ALPHA_GPRELLOW: if (dynamic_symbol_p) { @@ -5171,7 +5188,7 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info) bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } - /* Initialize the PLT0 entry */ + /* Initialize the PLT0 entry. */ if (splt->_raw_size > 0) { bfd_put_32 (output_bfd, PLT_HEADER_WORD1, splt->contents); @@ -5539,7 +5556,7 @@ static const struct elf_size_info alpha_elf_size_info = sizeof (Elf_External_Note), 8, 1, - 64, 8, + 64, 3, ELFCLASS64, EV_CURRENT, bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr,