+2016-01-31 John David Anglin <danglin@gcc.gnu.org>
+
+ PR ld/19526
+ * elf32-hppa.c (elf32_hppa_final_link): Don't sort non-regular output
+ files.
+ * elf64-hppa.c (elf32_hppa_final_link): Likewise. Remove retval.
+
2016-01-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19539
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;
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);
}
static bfd_boolean
elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
{
- bfd_boolean retval;
+ struct stat buf;
struct elf64_hppa_link_hash_table *hppa_info = hppa_link_hash_table (info);
if (hppa_info == NULL)
info);
/* Invoke the regular ELF backend linker to do all the work. */
- retval = bfd_elf_final_link (abfd, info);
+ if (!bfd_elf_final_link (abfd, info))
+ return FALSE;
elf_link_hash_traverse (elf_hash_table (info),
elf_hppa_remark_useless_dynamic_symbols,
/* If we're producing a final executable, sort the contents of the
unwind section. */
- if (retval && !bfd_link_relocatable (info))
- retval = elf_hppa_sort_unwind (abfd);
+ 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 retval;
+ return elf_hppa_sort_unwind (abfd);
}
/* Relocate the given INSN. VALUE should be the actual value we want