From patchwork Thu Jul 27 10:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyang He X-Patchwork-Id: 126884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp990621vqo; Thu, 27 Jul 2023 03:13:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMCugvc2HKZYT4fDTW1NlzJUAbDO5OBQXLfRC7oq9wHrtW5l18lLfwaB9/Qc9Q2OjSswiq X-Received: by 2002:a17:907:75e4:b0:99b:c689:3f3d with SMTP id jz4-20020a17090775e400b0099bc6893f3dmr1595948ejc.25.1690452789523; Thu, 27 Jul 2023 03:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690452789; cv=none; d=google.com; s=arc-20160816; b=jWO48T8yS24sbJY34COX9nwrQFgX3PGVXgtg4kqX4x76I1rSVI96gCykSxlXNHC47V 1+sAQeKVs+MWjQaAaatgmjHcL+SdTVTq6kYfh8+hQZjjOtubEBkcqMuCyMeodTcOvut7 FIhUskuVYGcuT3406talBjxvvC/4Mb0VM6cK0mQ9QsGCl6OsNAnQsQYaH3H+O26nWLyb x8Zn/nSbyptz63Vg4XUOYXGVSBRils4K5tflgZVmdxuuQzZqSkR7SMKjpezWS1/bCaWY Xvh1sOXgJc23FhewpnYbvdDvRPY9uJD+37w5XrXDupRSzGJxEzVbWRUFKCo0o9BIPZtP //9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dmarc-filter :delivered-to; bh=w5l5sbsmhuLaDAM83oZ8Mfroq2a3170IaImDGU4lhJA=; fh=x97qV7cBa0Rgkfvy/Zf1Z7u2m/bSgiOUNuiDiz2TqAI=; b=aHp+Y5dPSY16RX2HvqzXEE0qmBJP5kNm3YqcmfgHNpeb2sCxpecfKaikMlZCEzCtnO i09QV2IcfAFcDrrjlvqF5U2dt1JDg0jA0C7hy1EvutfsdRgV4NwOMUNL6Zs+I0RbMHNa 8sA+NWmcQhb0UYFSTjur1E74895LC6oWvKLHkM2gDRZVmG//gqaOei3JaYqQT1Ze4mFn IPeUesbREqXA6IUIRac82qy+OoFV9A6Fd6wJrvALoCn2CIWNNj3eaWWPckhXeU6pUYRW I+MU41z8I0zCIZMiUnOZT1OnO8y7yI7GCBsKjE6KAHv7Ne+1AB/xoz7QTe8NUMCCkGYi /GXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e12-20020a17090681cc00b0099238b86ef1si734820ejx.164.2023.07.27.03.13.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 03:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08B1C3856DC7 for ; Thu, 27 Jul 2023 10:03:26 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id AC08E3858C2F for ; Thu, 27 Jul 2023 10:03:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC08E3858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [111.9.175.10]) by gateway (Coremail) with SMTP id _____8Cx5_HjQMJkWqwKAA--.26630S3; Thu, 27 Jul 2023 18:03:16 +0800 (CST) Received: from localhost.localdomain (unknown [111.9.175.10]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxvM7dQMJkl+s8AA--.32174S2; Thu, 27 Jul 2023 18:03:11 +0800 (CST) From: Jinyang He To: Chenghua Xu , Zhensong Liu , mengqinggang , WANG Xuerui Cc: Xi Ruoyao , binutils@sourceware.org, Xing Li Subject: [PATCH 1/2] LoongArch: bfd: Correct the name of R_LARCH_SOP_POP_32_U in howto_table Date: Thu, 27 Jul 2023 18:03:07 +0800 Message-Id: <20230727100308.28761-1-hejinyang@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxvM7dQMJkl+s8AA--.32174S2 X-CM-SenderInfo: pkhmx0p1dqwqxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj9xXoWrZFWrJFyDuF17CFy7KFWxGrX_yoWxCwb_JF y3Ary8KF4rJF18C3sxKry5J3ZxC3WIvFsIvFZ7Kr4DWw48ta15Ar4kXry8Cw1jvr15uF93 Zw1DGr9xAw1a9osvyTuYvTs0mTUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb7kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAF wI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7V AKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x 0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUwMKuUUUUU X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772568224427208938 X-GMAIL-MSGID: 1772568224427208938 --- bfd/elfxx-loongarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c index f27c9fdba..924b11cfa 100644 --- a/bfd/elfxx-loongarch.c +++ b/bfd/elfxx-loongarch.c @@ -516,7 +516,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0, /* bitpos. */ complain_overflow_unsigned, /* complain_on_overflow. */ bfd_elf_generic_reloc, /* special_function. */ - "R_LARCH_SOP_POP_32_S_U", /* name. */ + "R_LARCH_SOP_POP_32_U", /* name. */ false, /* partial_inplace. */ 0xffffffff00000000, /* src_mask */ 0x00000000ffffffff, /* dst_mask */ From patchwork Thu Jul 27 10:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyang He X-Patchwork-Id: 126885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp990701vqo; Thu, 27 Jul 2023 03:13:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1Jk1hnIo5VxNd6FM35rRV8eNi0q77mWRMRDkEkzFmcGTWWsJu5J8s314vA24j5NlzcLaR X-Received: by 2002:a2e:7001:0:b0:2b6:e3d5:76a7 with SMTP id l1-20020a2e7001000000b002b6e3d576a7mr1404415ljc.24.1690452799517; Thu, 27 Jul 2023 03:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690452799; cv=none; d=google.com; s=arc-20160816; b=RIHvGFUh5VSNO0/2QdyGXOueg5wvZHg0c/hzBkKjQYMfgcswVmBNVl+KwjKVxEKBQb x8DpEgHKE5duUIeHIs7MIZNa+gfe5i8DT+xOgIZpo8IJh6ZEvUK92D8hgBV8vKsI3qNB krtUREPTEfETsfg9wsD7iNSw63iC8+6D17eywhWpaODmsz9TzKD9AmuXj/zBZ/Hv0uRD strH3cQyNMlhTBDOR34E2HFr2nOdsf2exskev3bClJhqU8IQKWkYT22TtE1tr3uYe04A UE/lnIFB95NSpYpqr918oMzqMkl0zTjbIdfrLWb7gaGU4nuDal9v4O1x26ovnt1Ed+Hv SUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dmarc-filter:delivered-to; bh=OA+l9DZZ3ZGDaeso/vtbC8vL1Ca/FEOrKWEMnTc/cZY=; fh=x97qV7cBa0Rgkfvy/Zf1Z7u2m/bSgiOUNuiDiz2TqAI=; b=pOo7G/dMV3yeB3pBIj5CDwVFkonQ7rOVCDbJNllz0y55Ty2gMdXHjhzIxdYzjDa3wB +MvldYH2F3AFHSqr5KMj9jJ+bGU6pJwbvWXEGPvnwpfnfN7tVS7fuCQrDJQestmycWQ4 rBigYJUYJM3OcYzCADnvBBBJpPSxux/w0YubDEytBFFcx6h6hC6fPjfnh34/3PlH5lkM SkoJWZhISmlm5nIJBF+V5nG7gUKos03Uhpd6eR6LTi2iZps76CYG2vmxwlAWEBUEYNsu wvljVmf2blTS5M/OXxLloqnMjR10cpplBiDf88SwseQi+VwTwDP9P03zHcCBbttvdZCC ZRhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v6-20020a170906858600b0098859d239dfsi802156ejx.796.2023.07.27.03.13.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 03:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C6473850232 for ; Thu, 27 Jul 2023 10:03:30 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id AC2F13858402 for ; Thu, 27 Jul 2023 10:03:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC2F13858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [111.9.175.10]) by gateway (Coremail) with SMTP id _____8DxPOvkQMJkXawKAA--.21430S3; Thu, 27 Jul 2023 18:03:16 +0800 (CST) Received: from localhost.localdomain (unknown [111.9.175.10]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxvM7dQMJkl+s8AA--.32174S3; Thu, 27 Jul 2023 18:03:15 +0800 (CST) From: Jinyang He To: Chenghua Xu , Zhensong Liu , mengqinggang , WANG Xuerui Cc: Xi Ruoyao , binutils@sourceware.org, Xing Li Subject: [PATCH 2/2] LoongArch: ld: Fix other pop relocs overflow check and add tests Date: Thu, 27 Jul 2023 18:03:08 +0800 Message-Id: <20230727100308.28761-2-hejinyang@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230727100308.28761-1-hejinyang@loongson.cn> References: <20230727100308.28761-1-hejinyang@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxvM7dQMJkl+s8AA--.32174S3 X-CM-SenderInfo: pkhmx0p1dqwqxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj9fXoWfCF4UGFy8trW3Jr48GFWUWrX_yoW5ur1xWo WvyFyUWa1xC3ZFyr4aq3yrXry7Kr40kF43uFnIvasrCa1I9ryYkrZ8Ca1rZr4xJwn5JFs8 Z34UG343XF4Sqr98l-sFpf9Il3svdjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8wcxFpf 9Il3svdxBIdaVrn0xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3 UjIYCTnIWjp_UUUYb7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI 8IcIk0rVWrJVCq3wAFIxvE14AKwVWUGVWUXwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xG Y2AK021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14 v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAF wI0_Cr1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1YL9UUUUU= X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772568234643979472 X-GMAIL-MSGID: 1772568234643979472 Add reloc_unsign_bits() to fix others sop_pop relocs overflow check. Then add over/underflow tests for relocs B*, SOP_POP* and PCREL20_S2. bfd/ChangeLog: * bfd/elfxx-loongarch.c: Add reloc_unsign_bits(). ld/ChangeLog: * testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Add test. * testsuite/ld-loongarch-elf/abi1_overflow_check1.dd: New test. * testsuite/ld-loongarch-elf/abi1_overflow_check1.s: New test. * testsuite/ld-loongarch-elf/abi1_overflow_check2.s: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check1.s: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check2.s: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check_b16.d: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check_b21.d: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check_b26.d: New test. * testsuite/ld-loongarch-elf/abi2_overflow_check_pcrel20.d: New test. * testsuite/ld-loongarch-elf/overflow_b16.d: New test. * testsuite/ld-loongarch-elf/overflow_b21.d: New test. * testsuite/ld-loongarch-elf/overflow_b26.d: New test. * testsuite/ld-loongarch-elf/overflow_pcrel20.d: New test. * testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/overflow_s_10_12.d: New test. * testsuite/ld-loongarch-elf/overflow_s_10_16.d: New test. * testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/overflow_s_10_5.d: New test. * testsuite/ld-loongarch-elf/overflow_s_5_20.d: New test. * testsuite/ld-loongarch-elf/overflow_u.d: New test. * testsuite/ld-loongarch-elf/overflow_u_10_12.d: New test. * testsuite/ld-loongarch-elf/underflow_b16.d: New test. * testsuite/ld-loongarch-elf/underflow_b21.d: New test. * testsuite/ld-loongarch-elf/underflow_b26.d: New test. * testsuite/ld-loongarch-elf/underflow_pcrel20.d: New test. * testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/underflow_s_10_12.d: New test. * testsuite/ld-loongarch-elf/underflow_s_10_16.d: New test. * testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d: New test. * testsuite/ld-loongarch-elf/underflow_s_10_5.d: New test. * testsuite/ld-loongarch-elf/underflow_s_5_20.d: New test. --- bfd/elfxx-loongarch.c | 33 ++++++++++---- .../ld-loongarch-elf/abi1_overflow_check1.dd | 18 ++++++++ .../ld-loongarch-elf/abi1_overflow_check1.s | 39 +++++++++++++++++ .../ld-loongarch-elf/abi1_overflow_check2.s | 43 +++++++++++++++++++ .../ld-loongarch-elf/abi2_overflow_check1.s | 24 +++++++++++ .../ld-loongarch-elf/abi2_overflow_check2.s | 24 +++++++++++ .../abi2_overflow_check_b16.d | 9 ++++ .../abi2_overflow_check_b21.d | 9 ++++ .../abi2_overflow_check_b26.d | 9 ++++ .../abi2_overflow_check_pcrel20.d | 9 ++++ .../ld-loongarch-elf/ld-loongarch-elf.exp | 39 +++++++++++++++++ ld/testsuite/ld-loongarch-elf/overflow_b16.d | 4 ++ ld/testsuite/ld-loongarch-elf/overflow_b21.d | 4 ++ ld/testsuite/ld-loongarch-elf/overflow_b26.d | 4 ++ .../ld-loongarch-elf/overflow_pcrel20.d | 4 ++ .../overflow_s_0_10_10_16_s2.d | 4 ++ .../overflow_s_0_5_10_16_s2.d | 4 ++ .../ld-loongarch-elf/overflow_s_10_12.d | 4 ++ .../ld-loongarch-elf/overflow_s_10_16.d | 4 ++ .../ld-loongarch-elf/overflow_s_10_16_s2.d | 4 ++ .../ld-loongarch-elf/overflow_s_10_5.d | 4 ++ .../ld-loongarch-elf/overflow_s_5_20.d | 4 ++ ld/testsuite/ld-loongarch-elf/overflow_u.d | 4 ++ .../ld-loongarch-elf/overflow_u_10_12.d | 4 ++ ld/testsuite/ld-loongarch-elf/underflow_b16.d | 4 ++ ld/testsuite/ld-loongarch-elf/underflow_b21.d | 4 ++ ld/testsuite/ld-loongarch-elf/underflow_b26.d | 4 ++ .../ld-loongarch-elf/underflow_pcrel20.d | 4 ++ .../underflow_s_0_10_10_16_s2.d | 4 ++ .../underflow_s_0_5_10_16_s2.d | 4 ++ .../ld-loongarch-elf/underflow_s_10_12.d | 4 ++ .../ld-loongarch-elf/underflow_s_10_16.d | 4 ++ .../ld-loongarch-elf/underflow_s_10_16_s2.d | 4 ++ .../ld-loongarch-elf/underflow_s_10_5.d | 4 ++ .../ld-loongarch-elf/underflow_s_5_20.d | 4 ++ 35 files changed, 343 insertions(+), 9 deletions(-) create mode 100644 ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.dd create mode 100644 ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.s create mode 100644 ld/testsuite/ld-loongarch-elf/abi1_overflow_check2.s create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check1.s create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check2.s create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b16.d create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b21.d create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b26.d create mode 100644 ld/testsuite/ld-loongarch-elf/abi2_overflow_check_pcrel20.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_b16.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_b21.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_b26.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_u.d create mode 100644 ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_b16.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_b21.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_b26.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d create mode 100644 ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c index 924b11cfa..9b4fbfe36 100644 --- a/bfd/elfxx-loongarch.c +++ b/bfd/elfxx-loongarch.c @@ -55,6 +55,8 @@ static bool reloc_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *val); static bool reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val); +static bool +reloc_unsign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val); static bfd_reloc_status_type loongarch_elf_add_sub_reloc (bfd *, arelent *, asymbol *, void *, @@ -383,7 +385,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x7c00, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_S_10_5, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_sign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_U_10_12, /* type (39). */ @@ -400,7 +402,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x3ffc00, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_U_10_12, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_unsign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_12, /* type (40). */ @@ -417,7 +419,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x3ffc00, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_S_10_12, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_sign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16, /* type (41). */ @@ -434,7 +436,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x3fffc00, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_S_10_16, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_sign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16_S2, /* type (42). */ @@ -468,7 +470,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x1ffffe0, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_S_5_20, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_sign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_0_5_10_16_S2, @@ -522,7 +524,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = 0x00000000ffffffff, /* dst_mask */ false, /* pcrel_offset */ BFD_RELOC_LARCH_SOP_POP_32_U, /* bfd_reloc_code_real_type */ - reloc_bits, /* adjust_reloc_bits */ + reloc_unsign_bits, /* adjust_reloc_bits */ NULL), /* larch_reloc_type_name */ /* 8-bit in-place addition, for local label subtraction. */ @@ -1671,9 +1673,10 @@ reloc_bits (bfd *abfd ATTRIBUTE_UNUSED, } static bool -reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) +reloc_bits_sanity (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val, bool sign) { - if (howto->complain_on_overflow != complain_overflow_signed) + if ((sign && howto->complain_on_overflow != complain_overflow_signed) + || (!sign && howto->complain_on_overflow != complain_overflow_unsigned)) return false; bfd_signed_vma val = (bfd_signed_vma)(*fix_val); @@ -1689,7 +1692,7 @@ reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) } bfd_signed_vma mask = ((bfd_signed_vma)0x1 << (howto->bitsize - + howto->rightshift - 1)) - 1; + + howto->rightshift - sign)) - 1; /* Positive number: high part is all 0; Negative number: if high part is not all 0, high part must be all 1. @@ -1728,6 +1731,18 @@ reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) return true; } +static bool +reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) +{ + return reloc_bits_sanity (abfd, howto, fix_val, true); +} + +static bool +reloc_unsign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) +{ + return reloc_bits_sanity (abfd, howto, fix_val, false); +} + bool loongarch_adjust_reloc_bitsfield (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val) diff --git a/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.dd b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.dd new file mode 100644 index 000000000..c85271408 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.dd @@ -0,0 +1,18 @@ +#... +.*00003c00.* +.*00004000.* +.*001ffc00.* +.*00200000.* +.*01fffc00.* +.*02000000.* +.*01fffc00.* +.*02000000.* +.*03fffc0f.* +.*00000010.* +.*03fffdff.* +.*00000200.* +.*00ffffe0.* +.*01000000.* +.*003ffc00.* +.*ffffffff.* +#pass diff --git a/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.s b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.s new file mode 100644 index 000000000..02507f19c --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check1.s @@ -0,0 +1,39 @@ +.macro sign_check reloc_name reloc_bits + .reloc off, R_LARCH_SOP_PUSH_ABSOLUTE, (1 << (\reloc_bits - 1)) - 1 + .reloc off, \reloc_name + .word 0 + .set off, off + 4 + .reloc off, R_LARCH_SOP_PUSH_ABSOLUTE, -(1 << (\reloc_bits - 1)) + .reloc off, \reloc_name + .word 0 + .set off, off + 4 +.endm + +.macro sign_check_s2 reloc_name reloc_bits + .reloc off, R_LARCH_SOP_PUSH_ABSOLUTE, ((1 << (\reloc_bits - 1)) - 1) << 2 + .reloc off, \reloc_name + .word 0 + .set off, off + 4 + .reloc off, R_LARCH_SOP_PUSH_ABSOLUTE, (-(1 << (\reloc_bits - 1))) << 2 + .reloc off, \reloc_name + .word 0 + .set off, off + 4 +.endm + +.macro unsign_check reloc_name reloc_bits + .reloc off, R_LARCH_SOP_PUSH_ABSOLUTE, (1 << \reloc_bits) - 1 + .reloc off, \reloc_name + .word 0 + .set off, off + 4 +.endm + +.set off, 0 +sign_check R_LARCH_SOP_POP_32_S_10_5 5 +sign_check R_LARCH_SOP_POP_32_S_10_12 12 +sign_check R_LARCH_SOP_POP_32_S_10_16 16 +sign_check_s2 R_LARCH_SOP_POP_32_S_10_16_S2 16 +sign_check_s2 R_LARCH_SOP_POP_32_S_0_5_10_16_S2 21 +sign_check_s2 R_LARCH_SOP_POP_32_S_0_10_10_16_S2 26 +sign_check R_LARCH_SOP_POP_32_S_5_20 20 +unsign_check R_LARCH_SOP_POP_32_U_10_12 12 +unsign_check R_LARCH_SOP_POP_32_U 32 diff --git a/ld/testsuite/ld-loongarch-elf/abi1_overflow_check2.s b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check2.s new file mode 100644 index 000000000..34f2d5920 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi1_overflow_check2.s @@ -0,0 +1,43 @@ +.macro sign_check reloc_sym reloc_name reloc_bits + .ifdef \reloc_sym + .ifdef overflow + .reloc 0, R_LARCH_SOP_PUSH_ABSOLUTE, 1 << (\reloc_bits - 1) + .reloc 0, \reloc_name + .else + .reloc 0, R_LARCH_SOP_PUSH_ABSOLUTE, -(1 << (\reloc_bits - 1)) - 1 + .reloc 0, \reloc_name + .endif + .word 0 + .endif +.endm + +.macro sign_check_s2 reloc_sym reloc_name reloc_bits + .ifdef \reloc_sym + .ifdef overflow + .reloc 0, R_LARCH_SOP_PUSH_ABSOLUTE, (1 << (\reloc_bits - 1)) << 2 + .reloc 0, \reloc_name + .else + .reloc 0, R_LARCH_SOP_PUSH_ABSOLUTE, (-(1 << (\reloc_bits - 1)) - 1) << 2 + .reloc 0, \reloc_name + .endif + .word 0 + .endif +.endm + +.macro unsign_check reloc_sym reloc_name reloc_bits + .ifdef \reloc_sym + .reloc 0, R_LARCH_SOP_PUSH_ABSOLUTE, 1 << \reloc_bits + .reloc 0, \reloc_name + .word 0 + .endif +.endm + +sign_check s_10_5 R_LARCH_SOP_POP_32_S_10_5 5 +sign_check s_10_12 R_LARCH_SOP_POP_32_S_10_12 12 +sign_check s_10_16 R_LARCH_SOP_POP_32_S_10_16 16 +sign_check_s2 s_10_16_s2 R_LARCH_SOP_POP_32_S_10_16_S2 16 +sign_check_s2 s_0_5_10_16_s2 R_LARCH_SOP_POP_32_S_0_5_10_16_S2 21 +sign_check_s2 s_0_10_10_16_s2 R_LARCH_SOP_POP_32_S_0_10_10_16_S2 26 +sign_check s_5_20 R_LARCH_SOP_POP_32_S_5_20 20 +unsign_check u_10_12 R_LARCH_SOP_POP_32_U_10_12 12 +unsign_check u R_LARCH_SOP_POP_32_U 32 diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check1.s b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check1.s new file mode 100644 index 000000000..f1bc3868f --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check1.s @@ -0,0 +1,24 @@ + .text +.ifdef b16 + beq $a0, $a1, low + beq $a0, $a1, high +.endif +.ifdef b21 + beqz $a0, low + beqz $a0, high +.endif +.ifdef b26 + b low + b high +.endif +.ifdef pcrel20 + .reloc 0, R_LARCH_PCREL20_S2, low + pcaddi $a0, 0 + .reloc 4, R_LARCH_PCREL20_S2, high + pcaddi $a0, 0 +.endif + + .section ".low" +low: nop + .section ".high" +high: nop diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check2.s b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check2.s new file mode 100644 index 000000000..1c25bd8c5 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check2.s @@ -0,0 +1,24 @@ + .text + +.set idx, 0 +.ifdef underflow + nop + .set idx, 4 +.endif + +.ifdef b16 + beq $a0, $a1, local_sym +.endif +.ifdef b21 + beqz $a0, local_sym +.endif +.ifdef b26 + b local_sym +.endif +.ifdef pcrel20 + .reloc idx, R_LARCH_PCREL20_S2, local_sym + pcaddi $a0, 0 +.endif + + .section ".local_sym" +local_sym: nop diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b16.d b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b16.d new file mode 100644 index 000000000..cd73a5136 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b16.d @@ -0,0 +1,9 @@ +#source: abi2_overflow_check1.s +#as: --defsym b16=1 +#ld: -e 0 -Ttext 0x20000000 --section-start=.low=0x1ffe0000 --section-start=.high=0x20020000 +#objdump: -s + +#... +Contents of section .text: + 20000000 8500005a 85fcff59.* +#pass diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b21.d b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b21.d new file mode 100644 index 000000000..143824388 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b21.d @@ -0,0 +1,9 @@ +#source: abi2_overflow_check1.s +#as: --defsym b21=1 +#ld: -e 0 -Ttext 0x20000000 --section-start=.low=0x1fc00000 --section-start=.high=0x20400000 +#objdump: -s + +#... +Contents of section .text: + 20000000 90000040 8ffcff43.* +#pass diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b26.d b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b26.d new file mode 100644 index 000000000..c8e996995 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_b26.d @@ -0,0 +1,9 @@ +#source: abi2_overflow_check1.s +#as: --defsym b26=1 +#ld: -e 0 -Ttext 0x20000000 --section-start=.low=0x18000000 --section-start=.high=0x28000000 +#objdump: -s + +#... +Contents of section .text: + 20000000 00020050 fffdff53.* +#pass diff --git a/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_pcrel20.d b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_pcrel20.d new file mode 100644 index 000000000..3948f4216 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abi2_overflow_check_pcrel20.d @@ -0,0 +1,9 @@ +#source: abi2_overflow_check1.s +#as: --defsym pcrel20=1 +#ld: -e 0 -Ttext 0x20000000 --section-start=.low=0x1fe00000 --section-start=.high=0x20200000 +#objdump: -s + +#... +Contents of section .text: + 20000000 04000019 e4ffff18.* +#pass diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp index b95cc53e5..a6812ea2a 100644 --- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp @@ -32,6 +32,22 @@ if [istarget "loongarch64-*-*"] { run_dump_test "syscall" run_dump_test "disas-jirl" run_dump_test "local-ifunc-reloc" + run_dump_test "overflow_s_10_5" + run_dump_test "overflow_s_10_12" + run_dump_test "overflow_s_10_16" + run_dump_test "overflow_s_10_16_s2" + run_dump_test "overflow_s_0_5_10_16_s2" + run_dump_test "overflow_s_0_10_10_16_s2" + run_dump_test "overflow_s_5_20" + run_dump_test "overflow_u_10_12" + run_dump_test "overflow_u" + run_dump_test "underflow_s_10_5" + run_dump_test "underflow_s_10_12" + run_dump_test "underflow_s_10_16" + run_dump_test "underflow_s_10_16_s2" + run_dump_test "underflow_s_0_5_10_16_s2" + run_dump_test "underflow_s_0_10_10_16_s2" + run_dump_test "underflow_s_5_20" } if [istarget "loongarch32-*-*"] { @@ -54,5 +70,28 @@ if [istarget "loongarch64-*-*"] { ] \ "64_pcrel" \ ] \ + [list \ + "abi1_overflow_check1" \ + "-e 0x0" "" \ + "" \ + {abi1_overflow_check1.s} \ + [list \ + [list objdump -D abi1_overflow_check1.dd] \ + ] \ + "abi1_overflow_check1" \ + ] \ ] } + +run_dump_test "abi2_overflow_check_b16" +run_dump_test "abi2_overflow_check_b21" +run_dump_test "abi2_overflow_check_b26" +run_dump_test "abi2_overflow_check_pcrel20" +run_dump_test "overflow_b16" +run_dump_test "overflow_b21" +run_dump_test "overflow_b26" +run_dump_test "overflow_pcrel20" +run_dump_test "underflow_b16" +run_dump_test "underflow_b21" +run_dump_test "underflow_b26" +run_dump_test "underflow_pcrel20" diff --git a/ld/testsuite/ld-loongarch-elf/overflow_b16.d b/ld/testsuite/ld-loongarch-elf/overflow_b16.d new file mode 100644 index 000000000..a015f57d8 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_b16.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym overflow=1 --defsym b16=1 +#ld: -e 0 --section-start=.local_sym=0x20020000 +#error: .*relocation truncated to fit: R_LARCH_B16 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/overflow_b21.d b/ld/testsuite/ld-loongarch-elf/overflow_b21.d new file mode 100644 index 000000000..ad0d20de1 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_b21.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym overflow=1 --defsym b21=1 +#ld: -e 0 --section-start=.local_sym=0x20400000 +#error: .*relocation truncated to fit: R_LARCH_B21 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/overflow_b26.d b/ld/testsuite/ld-loongarch-elf/overflow_b26.d new file mode 100644 index 000000000..510283756 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_b26.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym overflow=1 --defsym b26=1 +#ld: -e 0 --section-start=.local_sym=0x28000000 +#error: .*relocation truncated to fit: R_LARCH_B26 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d b/ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d new file mode 100644 index 000000000..354fc2903 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_pcrel20.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym overflow=1 --defsym pcrel20=1 +#ld: -e 0 --section-start=.local_sym=0x20200000 +#error: .*relocation truncated to fit: R_LARCH_PCREL20_S2 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d new file mode 100644 index 000000000..38a7d0173 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_0_10_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_0_10_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_0_10_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d new file mode 100644 index 000000000..cf6cbcce0 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_0_5_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_0_5_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_0_5_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d b/ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d new file mode 100644 index 000000000..30541c999 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_10_12.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_10_12=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_12 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d b/ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d new file mode 100644 index 000000000..304ab9697 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_10_16.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_10_16=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_16 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d new file mode 100644 index 000000000..00037013f --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d b/ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d new file mode 100644 index 000000000..183a43451 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_10_5.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_10_5=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_5 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d b/ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d new file mode 100644 index 000000000..d35448945 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_s_5_20.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym s_5_20=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_5_20 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_u.d b/ld/testsuite/ld-loongarch-elf/overflow_u.d new file mode 100644 index 000000000..ea332a6a5 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_u.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym u=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_U against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d b/ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d new file mode 100644 index 000000000..80ac8f1fa --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/overflow_u_10_12.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym overflow=1 --defsym u_10_12=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_U_10_12 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_b16.d b/ld/testsuite/ld-loongarch-elf/underflow_b16.d new file mode 100644 index 000000000..dcb50b9d4 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_b16.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym underflow=1 --defsym b16=1 +#ld: -e 0 --section-start=.local_sym=0x1ffe0000 +#error: .*relocation truncated to fit: R_LARCH_B16 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/underflow_b21.d b/ld/testsuite/ld-loongarch-elf/underflow_b21.d new file mode 100644 index 000000000..55047e12a --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_b21.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym underflow=1 --defsym b21=1 +#ld: -e 0 --section-start=.local_sym=0x1fc00000 +#error: .*relocation truncated to fit: R_LARCH_B21 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/underflow_b26.d b/ld/testsuite/ld-loongarch-elf/underflow_b26.d new file mode 100644 index 000000000..675c47f0e --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_b26.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym underflow=1 --defsym b26=1 +#ld: -e 0 --section-start=.local_sym=0x28000000 +#error: .*relocation truncated to fit: R_LARCH_B26 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d b/ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d new file mode 100644 index 000000000..186034e4f --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_pcrel20.d @@ -0,0 +1,4 @@ +#source: abi2_overflow_check2.s +#as: --defsym underflow=1 --defsym pcrel20=1 +#ld: -e 0 --section-start=.local_sym=0x1fe00000 +#error: .*relocation truncated to fit: R_LARCH_PCREL20_S2 against `local_sym' diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d new file mode 100644 index 000000000..cd7abb1a1 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_0_10_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_0_10_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_0_10_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d new file mode 100644 index 000000000..21474c9d1 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_0_5_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_0_5_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_0_5_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d b/ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d new file mode 100644 index 000000000..7cbd45216 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_10_12.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_10_12=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_12 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d b/ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d new file mode 100644 index 000000000..e3dde7e25 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_10_16.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_10_16=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_16 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d b/ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d new file mode 100644 index 000000000..b05b56df4 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_10_16_s2.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_10_16_s2=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_16_S2 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d b/ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d new file mode 100644 index 000000000..5e0352e4f --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_10_5.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_10_5=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_10_5 against `' \ No newline at end of file diff --git a/ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d b/ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d new file mode 100644 index 000000000..d88818a52 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/underflow_s_5_20.d @@ -0,0 +1,4 @@ +#source: abi1_overflow_check2.s +#as: --defsym underflow=1 --defsym s_5_20=1 +#ld: -e 0 +#error: .*relocation truncated to fit: R_LARCH_SOP_POP_32_S_5_20 against `' \ No newline at end of file