diff options
author | John David Anglin <danglin@gcc.gnu.org> | 2016-01-31 11:52:24 -0500 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2016-01-31 11:52:24 -0500 |
commit | 6d4b2867f8441c7bf75dfef6b3c95a10241f9709 (patch) | |
tree | a0bc3682f4afd2f9e1fb83d49e87104e6dbb15e0 /bfd/elf32-hppa.c | |
parent | d9e3b590692e62d83c21e39ec6641c4c09e70e4c (diff) | |
download | binutils-gdb-6d4b2867f8441c7bf75dfef6b3c95a10241f9709.tar.gz |
Fix /usr/bin/ld: final link failed: File truncated error on hppa.
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r-- | bfd/elf32-hppa.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 921706d8ed1..699d02a5828 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -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); } |