From patchwork Wed Jul 31 02:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Wang X-Patchwork-Id: 94834 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 256033861032 for ; Wed, 31 Jul 2024 02:50:44 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 2984A3860C2C for ; Wed, 31 Jul 2024 02:50:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2984A3860C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2984A3860C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722394220; cv=none; b=r3V1CGBpbhAe/cUn89HwJ/ebUfJHAdt1d4EKVcRMyKCjChV8C4nWhn9RcwPjeBGg7hhEuEhDI38aNYs4cNGH+uKDLrE9T17F4I1f7P2eqktPOYw5A9Y9qTALVob/a1nbJezd+YDZLDxMfvpO8REFZNum5IEci0YoF+xaz0xGYwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722394220; c=relaxed/simple; bh=I8FEc7mUbS77ribvB5aUxKL7L5If8vigtpWU71r3xCQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=oWtmQ1dynEulvX2uyVp1SzrWuqOKkUj/6ybQ89Qxo1L5m35SZCN5lE0M6ajf2U1769i/PrWk8+BByVaR0jNaMLiP8+lr1xDnR89YXGIx0CU4KFjPWIMFuuRUNo8hf05zOHPHb2LMphzSklhn6z5z1Vr+r2iAZCsa/60+tksPHw4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-704466b19c4so3200997a34.0 for ; Tue, 30 Jul 2024 19:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722394218; x=1722999018; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RaRScqww0t4/iW6HCsLaYaCKzALlIl6IhFg927Opx5U=; b=GQ5taGWLSGB1/WhdT2UGBSrx+Hs8i74OCIz4PDfr0yR1+8iV2guj8zZhMp9vB9abzz giXwd2rWTucUk1pschRYgDnSJlTAcb/QwkwM/SGZ3tllY1t1ALFB//Ap0GuyTKdY7t+G 2946YO5SwdGxeaAbhseDK/xtaKpfYsl5ikW6r/vGc0Vk58d8wfX/NQuJD6ybvsAcI48f dMfC+6ffnLnJYxBl8ltGqoW5LfA4n3yV0HeGQ2Jw9HybPjLtQMeBkN3S4zqS64oMN/Sh /xhAkuz0q/ZZsQ74X5s46klWDPr5mGXAMeNJaQgQi3kSPuBIHmghkpqBUKDBW50lgzwS 9IAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722394218; x=1722999018; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RaRScqww0t4/iW6HCsLaYaCKzALlIl6IhFg927Opx5U=; b=whDyKxziUGPpFnT075XDjwbknn2GpbjyJ0r9x9iYhYLCIeTDwNAnEsXU8uKqg5i1Bk FxTP9eQo5Vi57fDQ9JPQ+FCWNg0KzUFluAazs7U33PjxqkpkMFwp7htV8aO4j4ewFeHU tfDSKJaVL3bAW6slqqhwMsrdcPiDLyj77ndI8jfXtz8O+9I1aRLZbllANmNagn+dH9m4 B+bTFQ3hBaEjDSqia0/WxmnQY/z9vqcnncLno38OSGfIEUaNYFxvVGPsIvCFSKahOTTx SSI0j5gFPfMkbr773Fh1puB0OQ88T4schBY5HpzIFSjRxydRhnrW57yv3bONLLMV0aZK pK8g== X-Gm-Message-State: AOJu0YzJQeBmWijfS25R2615UyLtRMBX9ef3DPcNku+XoSHg6q632WWQ T1HzUVpcOVM3+oJnLOXgnW0nmD1tOrsxtEv+FXXeWyNN2NP7p26BMT0+ZHbHb3sMLA== X-Google-Smtp-Source: AGHT+IGmDE/hZgOQueAG4uAD1hm8O9opC+N4fZEei3iw6y9M9sl9grTlDa/1s7tuhBp/LvGHPJ/HEg== X-Received: by 2002:a05:6870:ac11:b0:261:1ffb:4ab2 with SMTP id 586e51a60fabf-267d4dc63d2mr16288300fac.20.1722394218144; Tue, 30 Jul 2024 19:50:18 -0700 (PDT) Received: from localhost ([2408:8469:c180:4adf:59df:6722:24ff:4286]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70ead6e122esm9377229b3a.14.2024.07.30.19.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 19:50:17 -0700 (PDT) From: Xin Wang X-Google-Original-From: Xin Wang To: binutils@sourceware.org Cc: Xin Wang Subject: [PATCH] LoongArch: get the opcode of instruction approriately Date: Wed, 31 Jul 2024 10:50:09 +0800 Message-Id: <20240731025009.1681755-1-wangxin03@loongson.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org --- bfd/elfnn-loongarch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)