LoongArch: get the opcode of instruction approriately

Message ID 20240731025009.1681755-1-wangxin03@loongson.cn
State New
Headers
Series LoongArch: get the opcode of instruction approriately |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

ywgrit July 31, 2024, 2:50 a.m. UTC
  ---
 bfd/elfnn-loongarch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index db6d419a052..5fa19a24e79 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4965,7 +4965,7 @@  loongarch_relax_pcala_addi (bfd *abfd, asection *sec, asection *sym_sec,
       || (ELFNN_R_TYPE ((rel_lo + 1)->r_info) != R_LARCH_RELAX)
       || (ELFNN_R_TYPE ((rel_hi + 1)->r_info) != R_LARCH_RELAX)
       || (rel_hi->r_offset + 4 != rel_lo->r_offset)
-      || ((add & addi_d) != addi_d)
+      || ((add & 0xffc00000) != addi_d)
       /* Is pcalau12i $rd + addi.d $rd,$rd?  */
       || ((add & 0x1f) != rd)
       || (((add >> 5) & 0x1f) != rd)
@@ -5026,7 +5026,7 @@  loongarch_relax_call36 (bfd *abfd, asection *sec, asection *sym_sec,
 
   /* Is pcalau12i + addi.d insns?  */
   if ((ELFNN_R_TYPE ((rel + 1)->r_info) != R_LARCH_RELAX)
-      || ((jirl & jirl_opcode) != jirl_opcode)
+      || ((jirl & 0xfc000000) != jirl_opcode)
       || ((bfd_signed_vma)(symval - pc) < (bfd_signed_vma)(int32_t)0xf8000000)
       || ((bfd_signed_vma)(symval - pc) > (bfd_signed_vma)(int32_t)0x7fffffc))
     return false;
@@ -5191,7 +5191,7 @@  loongarch_relax_tls_ld_gd_desc (bfd *abfd, asection *sec, asection *sym_sec,
       || (ELFNN_R_TYPE ((rel_lo + 1)->r_info) != R_LARCH_RELAX)
       || (ELFNN_R_TYPE ((rel_hi + 1)->r_info) != R_LARCH_RELAX)
       || (rel_hi->r_offset + 4 != rel_lo->r_offset)
-      || ((add & addi_d) != addi_d)
+      || ((add & 0xffc00000) != addi_d)
       /* Is pcalau12i $rd + addi.d $rd,$rd?  */
       || ((add & 0x1f) != rd)
       || (((add >> 5) & 0x1f) != rd)