asan: mips_gprel_reloc segfault

Not just the undefined section has a NULL owner, the absolute section
has too.  Which means we can't find output_bfd for __gp.  Also, may as
well test directly for output_bfd == NULL.

	* coff-mips.c (mips_gprel_reloc): Don't segfault on any of
	bfd_is_const_section sections.
This commit is contained in:
Alan Modra
2022-06-03 12:32:00 +09:30
parent dcefca4019
commit 679dc6e716

View File

@@ -593,11 +593,10 @@ mips_gprel_reloc (bfd *abfd ATTRIBUTE_UNUSED,
{
relocatable = false;
output_bfd = symbol->section->output_section->owner;
if (output_bfd == NULL)
return bfd_reloc_undefined;
}
if (bfd_is_und_section (symbol->section) && ! relocatable)
return bfd_reloc_undefined;
/* We have to figure out the gp value, so that we can adjust the
symbol value correctly. We look up the symbol _gp in the output
BFD. If we can't find it, we're stuck. We cache it in the ECOFF