From 6d4b2867f8441c7bf75dfef6b3c95a10241f9709 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sun, 31 Jan 2016 11:52:24 -0500 Subject: Fix /usr/bin/ld: final link failed: File truncated error on hppa. --- bfd/elf32-hppa.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bfd/elf32-hppa.c') diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 921706d..699d02a 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); } -- cgit v1.1