X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-hppa.c;h=699d02a58282a4f3edb0f527964c8e0c42c72bf0;hb=c55978a67a2e23999c3359a13bb807b665fcb33e;hp=41bf5c57c59d27c4a9fcaf184f1c746ef1dd3706;hpb=0e1862bb401f47716446aef143b2bf7a4563f541;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 41bf5c57c5..699d02a582 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1,5 +1,5 @@ /* BFD back-end for HP PA-RISC ELF files. - Copyright (C) 1990-2015 Free Software Foundation, Inc. + Copyright (C) 1990-2016 Free Software Foundation, Inc. Original code by Center for Software Science @@ -270,7 +270,7 @@ struct elf32_hppa_link_hash_table /* Assorted information used by elf32_hppa_size_stubs. */ unsigned int bfd_count; - int top_index; + unsigned int top_index; asection **input_list; Elf_Internal_Sym **all_local_syms; @@ -2215,7 +2215,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->etab.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (bfd_link_executable (info)) + if (bfd_link_executable (info) && !info->nointerp) { sec = bfd_get_linker_section (dynobj, ".interp"); if (sec == NULL) @@ -2495,7 +2495,7 @@ elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) { bfd *input_bfd; unsigned int bfd_count; - int top_id, top_index; + unsigned int top_id, top_index; asection *section; asection **input_list, **list; bfd_size_type amt; @@ -3245,6 +3245,8 @@ tpoff (struct bfd_link_info *info, bfd_vma address) static bfd_boolean elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info) { + struct stat buf; + /* Invoke the regular ELF linker to do all the work. */ if (!bfd_elf_final_link (abfd, info)) return FALSE; @@ -3254,6 +3256,13 @@ elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info) if (bfd_link_relocatable (info)) return TRUE; + /* Do not attempt to sort non-regular files. This is here + especially for configure scripts and kernel builds which run + tests with "ld [...] -o /dev/null". */ + if (stat (abfd->filename, &buf) != 0 + || !S_ISREG(buf.st_mode)) + return TRUE; + return elf_hppa_sort_unwind (abfd); } @@ -4585,9 +4594,10 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd, if (htab->splt != NULL && htab->splt->size != 0) { - /* Set plt entry size. */ - elf_section_data (htab->splt->output_section) - ->this_hdr.sh_entsize = PLT_ENTRY_SIZE; + /* Set plt entry size to 0 instead of PLT_ENTRY_SIZE, since we add the + plt stubs and as such the section does not hold a table of fixed-size + entries. */ + elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize = 0; if (htab->need_plt_stub) {