[binutils-gdb] asan: mips_gprel_reloc segfault
Alan Modra
amodra@sourceware.org
Fri Jun 3 03:09:28 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=679dc6e71647adf2719c411de5006358d27978b7
commit 679dc6e71647adf2719c411de5006358d27978b7
Author: Alan Modra <amodra@gmail.com>
Date: Fri Jun 3 12:32:00 2022 +0930
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.
Diff:
---
bfd/coff-mips.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 9614d338abe..d4dc1bd3c19 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -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
More information about the Binutils-cvs
mailing list