[binutils-gdb] MIPS/BFD: Standardize orphan REL HI16 relocation warning

Maciej W. Rozycki macro@sourceware.org
Wed Jan 14 22:31:26 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3f467fba80cea49a1941a24b1716a5e9c82fa77c

commit 3f467fba80cea49a1941a24b1716a5e9c82fa77c
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed Jan 14 22:28:44 2026 +0000

    MIPS/BFD: Standardize orphan REL HI16 relocation warning
    
    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.

Diff:
---
 bfd/elfxx-mips.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 34f58c311c1..f4424aca504 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -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


More information about the Binutils-cvs mailing list