From patchwork Fri Sep 1 03:09:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cai X-Patchwork-Id: 137364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp639918vqu; Thu, 31 Aug 2023 20:09:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH36LEb+qgjXQwZrTIjj2zUiajvKdUToG9P/3TKCqqR+FkQljTcIVfRnZJAFejIAYeARdCX X-Received: by 2002:a2e:6a09:0:b0:2b7:7c:d5a1 with SMTP id f9-20020a2e6a09000000b002b7007cd5a1mr598024ljc.23.1693537769820; Thu, 31 Aug 2023 20:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693537769; cv=none; d=google.com; s=arc-20160816; b=wAvMppPxN0PABf994vKWwXVoWzZiwAEaASGDmM7K6N5fozf7wCg50HjrnyPZdbiL8H ht7skojklc5rh7eDjd+oU9xQOE5X/qKcMbuzCVGWSfbA8i6LLM9Ya06vGzbr002j7ixb vNxQm1BohCa2OlfRJLbWknliiKc1sHzuBxsqTu6rsjy7bcyLKDd+578Unl9a0r9sQb17 qPaw3E+IFLOBI9UU3y1qKPYFslCt4Ww1zBlDU03i4a+UwM7Zsigtot0NpiFojX7gDT3l jBKq6Czzzdui/ODL7jcwbeFOJquK9Sp0aKJC2iGYW+xest58IdReRe/UyO+n142QJGAO UBqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dmarc-filter:delivered-to; bh=U+3DJuH7Qm2/VM+9OJqA2BotXEisaMbwmWHgCwgMJmU=; fh=SFAHdVKDqye1W7UDFjoNlSTpjW/NojV9cPAdHsifNOI=; b=usBu8vQHmeSH8ZkTM6VqvrUq4iGWhsPJ5e0vj3fOqSh5lKju9hLwlP+M3zKaDGNrXp htRsECoGMVCXPfOm2wl9CYIKfsv87PNuPQi1EiHQOACPckUMnUBRdwtS35smkGrNYmfb rQ8YuH5q/A+geZYc10l5T2bxhAc3WiLjRySlEA5xEoeCnsgwQpf1dAfsnxwscQYYhBYm iSUX1/cPtDHWXEeTpURd30pFR+N4EPoGx6fHw+DWl/1bm3/SNkNRIUf4qVCLse8Xoet0 CoU2AR2YzQdOnrrCpOlj2vmD8tdjI7VUItbThlf1pIzEdWHt5aQxJQ7ft9SR53n8Qjev dYBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id cb2-20020a170906a44200b0099bd06989ecsi1758371ejb.522.2023.08.31.20.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 20:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 D575C3857714 for ; Fri, 1 Sep 2023 03:09:20 +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 176403858D37 for ; Fri, 1 Sep 2023 03:09:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 176403858D37 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 [10.2.5.5]) by gateway (Coremail) with SMTP id _____8Dxl+jTVfFkBqwdAA--.24609S3; Fri, 01 Sep 2023 11:09:07 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxX8_PVfFkIY5oAA--.55924S5; Fri, 01 Sep 2023 11:09:05 +0800 (CST) From: cailulu To: binutils@sourceware.org Subject: [PATCH 2/2] Add testcase for generation of 32/64_PCREL. Date: Fri, 1 Sep 2023 11:09:01 +0800 Message-Id: <20230901030901.2519730-2-cailulu@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230901030901.2519730-1-cailulu@loongson.cn> References: <20230901030901.2519730-1-cailulu@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxX8_PVfFkIY5oAA--.55924S5 X-CM-SenderInfo: xfdlz3tox6z05rqj20fqof0/1tbiAQABB2TwEzQQawAAsP X-Coremail-Antispam: 1Uk129KBj93XoW3Ary7GF48tr13GrWDZF1DJwc_yoW7tF4Upr nrZr9akFW8C3Z7WFW3KFy5C343Xw40va1jvas3GF1Ikr1xGry8Aw4xJr4Ygaykt34UJ34a vr1kXrW29r9FkwbCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvIb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE 14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x 0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C267AKxVWUXVWUAwC20s026c02 F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GF ylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7Cj xVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r 4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jO db8UUUUU= X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: , Cc: maskray@google.com, xuchenghua@loongson.cn, liuzhensong@loongson.cn, cailulu , chenglulu@loongson.cn Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775803060657993440 X-GMAIL-MSGID: 1775803060657993440 --- gas/testsuite/gas/loongarch/pcrel_norelax.d | 56 +++++++++++++++++++ gas/testsuite/gas/loongarch/pcrel_norelax.s | 42 +++++++++++++++ gas/testsuite/gas/loongarch/pcrel_relax.d | 60 +++++++++++++++++++++ gas/testsuite/gas/loongarch/pcrel_relax.s | 46 ++++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 gas/testsuite/gas/loongarch/pcrel_norelax.d create mode 100644 gas/testsuite/gas/loongarch/pcrel_norelax.s create mode 100644 gas/testsuite/gas/loongarch/pcrel_relax.d create mode 100644 gas/testsuite/gas/loongarch/pcrel_relax.s diff --git a/gas/testsuite/gas/loongarch/pcrel_norelax.d b/gas/testsuite/gas/loongarch/pcrel_norelax.d new file mode 100644 index 00000000000..842c8d48e0e --- /dev/null +++ b/gas/testsuite/gas/loongarch/pcrel_norelax.d @@ -0,0 +1,56 @@ +#as: -mno-relax +#objdump: -Dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +00000000.* <.L1>: +[ ]+... +[ ]+0:[ ]+R_LARCH_32_PCREL[ ]+.L3 +[ ]+4:[ ]+R_LARCH_32_PCREL[ ]+.L3\+0x4 + +0*00000008[ ]+<.L2>: +[ ]+... +[ ]+8:[ ]+R_LARCH_64_PCREL[ ]+.L3 +[ ]+10:[ ]+R_LARCH_64_PCREL[ ]+.L3\+0x8 + +Disassembly[ ]+of[ ]+section[ ]+sx: + +0*00000000[ ]+<.L3>: +[ ]+0:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+4:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+8:[ ]+ffffffff[ ]+.word[ ]+0xffffffff + +0*0000000c[ ]+<.L4>: +[ ]+... +[ ]+c:[ ]+R_LARCH_ADD32[ ]+.L4 +[ ]+c:[ ]+R_LARCH_SUB32[ ]+.L5 +[ ]+10:[ ]+R_LARCH_ADD64[ ]+.L4 +[ ]+10:[ ]+R_LARCH_SUB64[ ]+.L5 + +Disassembly[ ]+of[ ]+section[ ]+sy: + +0*00000000[ ]+<.L5>: +[ ]+... +[ ]+0:[ ]+R_LARCH_32_PCREL[ ]+.L1 +[ ]+4:[ ]+R_LARCH_32_PCREL[ ]+.L2\+0x4 +[ ]+8:[ ]+R_LARCH_64_PCREL[ ]+.L1\+0x8 +[ ]+10:[ ]+R_LARCH_64_PCREL[ ]+.L2\+0x10 + +Disassembly[ ]+of[ ]+section[ ]+sz: + +0*00000000[ ]+: +[ ]+0:[ ]+fffffff8[ ]+.word[ ]+0xfffffff8 +[ ]+4:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+8:[ ]+00000000[ ]+.word[ ]+0x00000000 +[ ]+8:[ ]+R_LARCH_ADD32[ ]+.L2 +[ ]+8:[ ]+R_LARCH_SUB32[ ]+.L3 +[ ]+c:[ ]+fffffff8[ ]+.word[ ]+0xfffffff8 +[ ]+10:[ ]+ffffffff[ ]+.word[ ]+0xffffffff +[ ]+14:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+18:[ ]+ffffffff[ ]+.word[ ]+0xffffffff +[ ]+... +[ ]+1c:[ ]+R_LARCH_ADD64[ ]+.L2 +[ ]+1c:[ ]+R_LARCH_SUB64[ ]+.L3 diff --git a/gas/testsuite/gas/loongarch/pcrel_norelax.s b/gas/testsuite/gas/loongarch/pcrel_norelax.s new file mode 100644 index 00000000000..09527f146a9 --- /dev/null +++ b/gas/testsuite/gas/loongarch/pcrel_norelax.s @@ -0,0 +1,42 @@ + .section .text +.L1: + # 32_pcrel + .4byte .L3-.L1 + .4byte .L3-.L1 +.L2: + # 64_pcrel + .8byte .L3-.L2 + .8byte .L3-.L2 + + .section sx +.L3: + # no relocation + .4byte .L3-.L4 + .8byte .L3-.L4 +.L4: + # add32+sub32 + .4byte .L4-.L5 + # add64+sub64 + .8byte .L4-.L5 + + .section sy +.L5: + # 32_pcrel + .4byte .L1-.L5 + .4byte .L2-.L5 + # 64_pcrel + .8byte .L1-.L5 + .8byte .L2-.L5 + + .section sz + # no relocation + .4byte .L1-.L2 + .4byte .L3-.L4 + # add32+sub32 + .4byte .L2-.L3 + + # no relocation + .8byte .L1-.L2 + .8byte .L3-.L4 + # add64+sub64 + .8byte .L2-.L3 diff --git a/gas/testsuite/gas/loongarch/pcrel_relax.d b/gas/testsuite/gas/loongarch/pcrel_relax.d new file mode 100644 index 00000000000..d6f875259be --- /dev/null +++ b/gas/testsuite/gas/loongarch/pcrel_relax.d @@ -0,0 +1,60 @@ +#as: +#objdump: -Dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +00000000.* <.L1>: +[ ]+... +[ ]+0:[ ]+R_LARCH_32_PCREL[ ]+.L3 +[ ]+4:[ ]+R_LARCH_ADD32[ ]+.L3 +[ ]+4:[ ]+R_LARCH_SUB32[ ]+.L1 + +0*00000008[ ]+<.L2>: +[ ]+... +[ ]+8:[ ]+R_LARCH_64_PCREL[ ]+.L3 +[ ]+10:[ ]+R_LARCH_ADD64[ ]+.L3 +[ ]+10:[ ]+R_LARCH_SUB64[ ]+.L2 + +Disassembly[ ]+of[ ]+section[ ]+sx: + +0*00000000[ ]+<.L3>: +[ ]+0:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+4:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+8:[ ]+ffffffff[ ]+.word[ ]+0xffffffff + +0*0000000c[ ]+<.L4>: +[ ]+... +[ ]+c:[ ]+R_LARCH_ADD32[ ]+.L4 +[ ]+c:[ ]+R_LARCH_SUB32[ ]+.L5 +[ ]+10:[ ]+R_LARCH_ADD64[ ]+.L4 +[ ]+10:[ ]+R_LARCH_SUB64[ ]+.L5 + +Disassembly[ ]+of[ ]+section[ ]+sy: + +0*00000000[ ]+<.L5>: +[ ]+... +[ ]+0:[ ]+R_LARCH_32_PCREL[ ]+.L1 +[ ]+4:[ ]+R_LARCH_32_PCREL[ ]+.L3\+0x4 +[ ]+8:[ ]+R_LARCH_64_PCREL[ ]+.L1\+0x8 +[ ]+10:[ ]+R_LARCH_64_PCREL[ ]+.L3\+0x10 + +Disassembly[ ]+of[ ]+section[ ]+sz: + +0*00000000[ ]+: +[ ]+0:[ ]+00000000[ ]+.word[ ]+0x00000000 +[ ]+0:[ ]+R_LARCH_ADD32[ ]+.L1 +[ ]+0:[ ]+R_LARCH_SUB32[ ]+.L2 +[ ]+4:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+... +[ ]+8:[ ]+R_LARCH_ADD32[ ]+.L3 +[ ]+8:[ ]+R_LARCH_SUB32[ ]+.L5 +[ ]+c:[ ]+R_LARCH_ADD64[ ]+.L1 +[ ]+c:[ ]+R_LARCH_SUB64[ ]+.L2 +[ ]+14:[ ]+fffffff4[ ]+.word[ ]+0xfffffff4 +[ ]+18:[ ]+ffffffff[ ]+.word[ ]+0xffffffff +[ ]+... +[ ]+1c:[ ]+R_LARCH_ADD64[ ]+.L3 +[ ]+1c:[ ]+R_LARCH_SUB64[ ]+.L5 diff --git a/gas/testsuite/gas/loongarch/pcrel_relax.s b/gas/testsuite/gas/loongarch/pcrel_relax.s new file mode 100644 index 00000000000..ded275fa72c --- /dev/null +++ b/gas/testsuite/gas/loongarch/pcrel_relax.s @@ -0,0 +1,46 @@ + .section .text +.L1: + # 32_pcrel + .4byte .L3-.L1 + # add32+sub32 + .4byte .L3-.L1 +.L2: + # 64_pcrel + .8byte .L3-.L2 + # add64+sub64 + .8byte .L3-.L2 + + .section sx +.L3: + # no relocation + .4byte .L3-.L4 + .8byte .L3-.L4 +.L4: + # add32+sub32 + .4byte .L4-.L5 + # add64+sub64 + .8byte .L4-.L5 + + .section sy +.L5: + # 32_pcrel + .4byte .L1-.L5 + .4byte .L3-.L5 + # 64_pcrel + .8byte .L1-.L5 + .8byte .L3-.L5 + + .section sz + # add32+sub32 + .4byte .L1-.L2 + # no relocation + .4byte .L3-.L4 + # add32+sub32 + .4byte .L3-.L5 + + #add64+sub64 + .8byte .L1-.L2 + # no relocation + .8byte .L3-.L4 + #add64+sub64 + .8byte .L3-.L5