@@ -2945,7 +2945,7 @@ elf_hppa_record_segment_addrs (bfd *abfd,
2945
2945
static bfd_boolean
2946
2946
elf_hppa_final_link (bfd * abfd , struct bfd_link_info * info )
2947
2947
{
2948
- bfd_boolean retval ;
2948
+ struct stat buf ;
2949
2949
struct elf64_hppa_link_hash_table * hppa_info = hppa_link_hash_table (info );
2950
2950
2951
2951
if (hppa_info == NULL )
@@ -3029,18 +3029,26 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
3029
3029
info );
3030
3030
3031
3031
/* Invoke the regular ELF backend linker to do all the work. */
3032
- retval = bfd_elf_final_link (abfd , info );
3032
+ if (!bfd_elf_final_link (abfd , info ))
3033
+ return FALSE;
3033
3034
3034
3035
elf_link_hash_traverse (elf_hash_table (info ),
3035
3036
elf_hppa_remark_useless_dynamic_symbols ,
3036
3037
info );
3037
3038
3038
3039
/* If we're producing a final executable, sort the contents of the
3039
3040
unwind section. */
3040
- if (retval && !bfd_link_relocatable (info ))
3041
- retval = elf_hppa_sort_unwind (abfd );
3041
+ if (bfd_link_relocatable (info ))
3042
+ return TRUE;
3043
+
3044
+ /* Do not attempt to sort non-regular files. This is here
3045
+ especially for configure scripts and kernel builds which run
3046
+ tests with "ld [...] -o /dev/null". */
3047
+ if (stat (abfd -> filename , & buf ) != 0
3048
+ || !S_ISREG (buf .st_mode ))
3049
+ return TRUE;
3042
3050
3043
- return retval ;
3051
+ return elf_hppa_sort_unwind ( abfd ) ;
3044
3052
}
3045
3053
3046
3054
/* Relocate the given INSN. VALUE should be the actual value we want
0 commit comments