Fix a segfault when creating an import library with 0 exports.

PR 26588
	* emultempl/pe.em (_finish): Only generate a import library if not
	exporting relocs.
	* emultempl/pep.em: Likewise.
This commit is contained in:
Jeremy Drake 2020-09-11 17:51:16 +01:00 committed by Nick Clifton
parent ad570dd76c
commit 9cdc5bacdd
3 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2020-09-11 Jeremy Drake <sourceware-bugzilla@jdrake.com>
PR 26588
* emultempl/pe.em (_finish): Only generate a import library if not
exporting relocs.
* emultempl/pep.em: Likewise.
2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> 2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
* testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead * testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead

View file

@ -1996,7 +1996,8 @@ gld_${EMULATION_NAME}_finish (void)
) )
{ {
pe_dll_fill_sections (link_info.output_bfd, &link_info); pe_dll_fill_sections (link_info.output_bfd, &link_info);
if (command_line.out_implib_filename) if (command_line.out_implib_filename
&& pe_def_file->num_exports != 0)
pe_dll_generate_implib (pe_def_file, command_line.out_implib_filename, pe_dll_generate_implib (pe_def_file, command_line.out_implib_filename,
&link_info); &link_info);
} }

View file

@ -1823,7 +1823,8 @@ gld_${EMULATION_NAME}_finish (void)
&& pep_def_file->num_exports != 0)) && pep_def_file->num_exports != 0))
{ {
pep_dll_fill_sections (link_info.output_bfd, &link_info); pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (command_line.out_implib_filename) if (command_line.out_implib_filename
&& pep_def_file->num_exports != 0)
pep_dll_generate_implib (pep_def_file, pep_dll_generate_implib (pep_def_file,
command_line.out_implib_filename, &link_info); command_line.out_implib_filename, &link_info);
} }