[binutils-gdb] s390: Improve diagnostic for reloc against misaligned sym

Jens Remus jremus@sourceware.org
Mon May 19 08:40:39 GMT 2025


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

commit d463846740dc791d9129574db9bd4bc83a7ff554
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Mon May 19 10:38:01 2025 +0200

    s390: Improve diagnostic for reloc against misaligned sym
    
    Report the BFD in which a misaligned symbol is defined in the error
    message.  This complements commit 906f69cf65da ("IBM zSystems: Issue
    error for *DBL relocs on misaligned symbols").  While at it reword
    the error message.
    
    Old error message text (re-wrapped):
    <sec-bfd>(<sec>+<off>): misaligned symbol `<sym>' (<addr>) for
                            relocation <rel>
    
    New error message text (re-wrapped):
    <sec-bfd>(<sec>+<off>): relocation <rel> against misaligned symbol
                            `<sym>' (<addr>) in <sym-bfd>
    
    Note that the linker tests do not require to be updated, as they match
    against the pattern ".*misaligned symbol.*", which has not changed in
    the error message.
    
    bfd/
            PR ld/32969
            * elf64-s390.c (elf_s390_relocate_section): Report BFD
            in which a misaligned symbol is defined in error message.
    
    Bug: https://sourceware.org/PR32969
    Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 bfd/elf64-s390.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 259ad13be51..7ae11dc8e8b 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3204,13 +3204,14 @@ elf_s390_relocate_section (bfd *output_bfd,
 	  _bfd_error_handler
 	    /* xgettext:c-format */
 	    (_("%pB(%pA+%#" PRIx64 "): "
-	       "misaligned symbol `%s' (%#" PRIx64 ") for relocation %s"),
+	       "relocation %s against misaligned symbol `%s' (%#" PRIx64 ") in %pB"),
 	     input_bfd,
 	     input_section,
 	     (uint64_t) rel->r_offset,
+	     howto->name,
 	     h->root.root.string,
 	     (uint64_t)relocation,
-	     howto->name);
+	     sec->owner);
 	  return false;
 	}


More information about the Binutils-cvs mailing list