From: Alan Modra Date: Wed, 14 Apr 2021 07:56:45 +0000 (+0930) Subject: PR27631, ubsan: elf32-metag.c:1550:10 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8985b74b7d0f957eda8ec12e88665dab17f00a15;p=binutils-gdb.git PR27631, ubsan: elf32-metag.c:1550:10 PR 27631 * elf32-metag.c (elf_metag_relocate_section): Don't use &hh->elf when hh might be NULL, test for NULL first. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c3e52533a10..4d715226693 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-04-14 Alan Modra + + PR 27631 + * elf32-metag.c (elf_metag_relocate_section): Don't use &hh->elf + when hh might be NULL, test for NULL first. + 2021-04-14 Alan Modra PR 27630 diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 82e67eac99a..984741847a9 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1546,8 +1546,8 @@ elf_metag_relocate_section (bfd *output_bfd, if ((bfd_link_pic (info) && r_symndx != STN_UNDEF && (input_section->flags & SEC_ALLOC) != 0 - && (r_type != R_METAG_RELBRANCH - || !SYMBOL_CALLS_LOCAL (info, &hh->eh))) + && !(r_type == R_METAG_RELBRANCH + && (hh == NULL || SYMBOL_CALLS_LOCAL (info, &hh->eh)))) || (!bfd_link_pic (info) && hh != NULL && hh->eh.dynindx != -1