aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-01-24 09:47:43 +0000
committerNick Clifton <nickc@redhat.com>2023-01-24 09:47:43 +0000
commitf3d8ae90b23695d86ebf894a4a6b95846007fafd (patch)
tree7ae978b19ab2400f82a8d1b009b580b84462af45 /bfd/cofflink.c
parent59d49a8d83a289624a1dff4e8833f2b7c286d764 (diff)
downloadfsf-binutils-gdb-f3d8ae90b23695d86ebf894a4a6b95846007fafd.zip
fsf-binutils-gdb-f3d8ae90b23695d86ebf894a4a6b95846007fafd.tar.gz
fsf-binutils-gdb-f3d8ae90b23695d86ebf894a4a6b95846007fafd.tar.bz2
Fix seg-fault when generating an empty DLL with LTO enabled.
ld PR 29998 * pe-dll.c (generate_reloc): Handle sections with no assigned output section. Terminate early of there are no relocs to put in the .reloc section. (pe_exe_fill_sections): Do not emit an empty .reloc section. bfd * cofflink.c (_bfd_coff_generic_relocate_section): Add an assertion that the output section is set for defined, global symbols.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 0722688..3174bd3 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2977,10 +2977,11 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
else
{
if (h->root.type == bfd_link_hash_defined
+ /* Defined weak symbols are a GNU extension. */
|| h->root.type == bfd_link_hash_defweak)
{
- /* Defined weak symbols are a GNU extension. */
sec = h->root.u.def.section;
+ BFD_ASSERT (sec->output_section != NULL);
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
@@ -3087,7 +3088,6 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
return false;
case bfd_reloc_overflow:
{
-
/* Ignore any weak undef symbols that may have overflowed. Due to
PR ld/19011 the base address is now in the upper 64-bit address
range. This means that when _bfd_final_link_relocate calculates
@@ -3123,5 +3123,6 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
}
}
}
+
return true;
}