]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
MIPS/BFD: Standardize orphan REL HI16 relocation warning
authorMaciej W. Rozycki <macro@orcam.me.uk>
Wed, 14 Jan 2026 22:28:44 +0000 (22:28 +0000)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Wed, 14 Jan 2026 22:28:44 +0000 (22:28 +0000)
Use the warning callback for the orphan REL HI16 relocation warning just
as with any other linker relocation processing warnings, standardizing
the message format and providing source location where available.

Test cases will be added with a separate change.

bfd/elfxx-mips.c

index 34f58c311c1a5e55066517ed8e109462b6a1a7e4..f4424aca5042fa1821003305c2471e5fa76dc755 100644 (file)
@@ -10605,12 +10605,18 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                        name = bfd_elf_sym_name (input_bfd, symtab_hdr,
                                                 local_syms + r_symndx,
                                                 sec);
-                     _bfd_error_handler
-                       /* xgettext:c-format */
-                       (_("%pB: can't find matching LO16 reloc against `%s'"
-                          " for %s at %#" PRIx64 " in section `%pA'"),
-                        input_bfd, name,
-                        howto->name, (uint64_t) rel->r_offset, input_section);
+                     /* xgettext:c-format */
+                     msg = bfd_asprintf (_("can't find matching LO16 reloc"
+                                           " against `%s' for %s at %#" PRIx64
+                                           " in section `%s'"),
+                                         name, howto->name,
+                                         (uint64_t) rel->r_offset,
+                                         input_section->name);
+                     if (msg == NULL)
+                       return false;
+                     info->callbacks->warning
+                       (info, msg, name, input_bfd, input_section,
+                        rel->r_offset);
                    }
                }
              else