]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: LoongArch: Add linker relaxation support for R_LARCH_CALL30
authorAlan Modra <amodra@gmail.com>
Tue, 16 Dec 2025 08:43:15 +0000 (19:13 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 16 Dec 2025 08:43:15 +0000 (19:13 +1030)
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.

bfd/elfnn-loongarch.c

index f7dcb8453b20ec912042a1f6dafc8e0beb43c69a..82f6390505bf39bb6b85dd57afa61cf08ef199e2 100644 (file)
@@ -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;