[binutils-gdb] Re: LoongArch: Add linker relaxation support for R_LARCH_CALL30

Alan Modra amodra@sourceware.org
Tue Dec 16 08:51:44 GMT 2025


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

commit 71f40938da488e0b4ed370296f7cce173c27ac97
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Dec 16 19:13:15 2025 +1030

    Re: LoongArch: Add linker relaxation support for R_LARCH_CALL30
    
    clang catches this error and another like it on line 6320.
    elfnn-loongarch.c:6357:35: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
     6357 |                    && (r_type != R_LARCH_CALL36 || r_type != R_LARCH_CALL30))
          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
    
            * elfnn-loongarch.c (loongarch_elf_relax_section): Correct tests
            for R_LARCH_CALL36 and_LARCH_CALL30.

Diff:
---
 bfd/elfnn-loongarch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index f7dcb8453b2..82f6390505b 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -6317,7 +6317,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
 				    + r_symndx;
 
 	  if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
-	       && (r_type != R_LARCH_CALL36 || r_type != R_LARCH_CALL30))
+	       && (r_type != R_LARCH_CALL36 && r_type != R_LARCH_CALL30))
 	      || sym->st_shndx == SHN_ABS)
 	    continue;
 
@@ -6354,7 +6354,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
 	     is not set yet.  */
 	  if (h != NULL
 	      && ((h->type == STT_GNU_IFUNC
-		   && (r_type != R_LARCH_CALL36 || r_type != R_LARCH_CALL30))
+		   && (r_type != R_LARCH_CALL36 && r_type != R_LARCH_CALL30))
 		  || bfd_is_abs_section (h->root.u.def.section)
 		  || h->start_stop))
 	    continue;


More information about the Binutils-cvs mailing list