From patchwork Fri May 26 07:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengqinggang X-Patchwork-Id: 99387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp296670vqr; Fri, 26 May 2023 00:58:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60VYgK4cfA0YWeVm4Gu+1bGQABUfcE8uRJ7SGC9aR76AZwECe7rDxDL5I03uaanK/hQ3rT X-Received: by 2002:a17:907:1b1b:b0:973:9492:bcd6 with SMTP id mp27-20020a1709071b1b00b009739492bcd6mr1542102ejc.38.1685087895203; Fri, 26 May 2023 00:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685087895; cv=none; d=google.com; s=arc-20160816; b=I3r6NPCdiJUbL6fCL+MIIiHqR4uDuuZRq19u4Yf+YyzdMzXcgmPDfeyL1T7G890nsY 60Rv6PVTRU2z9eik8xb9iG2cOvSPy132kav4GklldABxKUeWc6wrpTRZmuIjYHAZPHoj L9j+lTG94sUliv9izlh9oV+lSR94sjcY0D/m/opSRWg0ht/akNDkX6MhhvuUuG1A9Jo7 G8zGIYrnk3sySn+obw0/i7agwW3k7587v/fbwOQXKZEpXqDvZfL7rSGbNCZMCxS32cH3 LA6Wmbmqdd8PaoQ7dsN+7uaQ6tb+kfVd8s+2HVDzEGBQwbZQU7iq+5qjNLFWCGUnDGAj riXQ== 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=4I8kDrANcHjRyx1p/1FCfBqXj5Zp+QE1/NuoIXTLJqY=; b=h4BzV8mFjldCdKD8xBOxZwPSf80SSOwRuo9N9DSbY0G+Ab/6WmuTWF4Q1J6vYZrnkw GqgGOPFEZ5WO4U0jt3k6gnCTO7YjoUE5WKOzojeP+l9ePlUCw7gkWGgfRcCgODwV+c8b heZC5+LZ1gea3wfHCX/c9NcfbbDd5Vob+b8z01clrv3/j3iptuemlUrVo+LDUK6fpGGv BhUOaKFsY7coS7yeyfwjyozmt00/geY6Vp/C3yN1nbT59ICDQZQvg6hesp8u4jXKdWbt gWsgzFq03boY5VHfJXk4ealAxrJtt3nFx8IA2VK1zO7p4derqKtiyWLJc1NxJ2QJGB6y EFeQ== 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 sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ml21-20020a170906cc1500b0096f6e3fe0b3si1267797ejb.327.2023.05.26.00.58.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:58:15 -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 D54223844B55 for ; Fri, 26 May 2023 07:45:53 +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 B9D6F3815FEA for ; Fri, 26 May 2023 07:38:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B9D6F3815FEA 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 _____8AxyfEGYnBkAFwBAA--.3648S3; Fri, 26 May 2023 15:38:46 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxqjr8YXBkQjJ5AA--.4193S3; Fri, 26 May 2023 15:38:45 +0800 (CST) From: mengqinggang To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, changjiachen@stu.xupt.edu.cn, mengqinggang Subject: [PATCH v5 1/6] LoongArch: include: Add support for linker relaxation. Date: Fri, 26 May 2023 15:38:28 +0800 Message-Id: <20230526073833.3933735-2-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230526073833.3933735-1-mengqinggang@loongson.cn> References: <20230526073833.3933735-1-mengqinggang@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Cxqjr8YXBkQjJ5AA--.4193S3 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7KrW5Wr45CF1xuw4fXr1kZrb_yoW8Ar13pF 9xAw45CFWFkFsrur9Yv34fArs3Z3yxKFW2qFyfZa10krsrJryUXr48CF1DAFW2qws0qrWa vryfWw15WF95trUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU82g43UUUUU== X-Spam-Status: No, score=-12.2 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766942724854721484?= X-GMAIL-MSGID: =?utf-8?q?1766942724854721484?= Add relocs and gas LARCH_opts.relax option. include/ChangeLog: * elf/loongarch.h: Add relocs. * opcode/loongarch.h: Add LARCH_opts.relax and macro LARCH_NOP. --- include/elf/loongarch.h | 20 ++++++++++++++++++++ include/opcode/loongarch.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h index ba0075d1066..71ab34f2cef 100644 --- a/include/elf/loongarch.h +++ b/include/elf/loongarch.h @@ -229,6 +229,26 @@ RELOC_NUMBER (R_LARCH_32_PCREL, 99) /* RELAX. */ RELOC_NUMBER (R_LARCH_RELAX, 100) +/* relax delete. */ +RELOC_NUMBER (R_LARCH_DELETE, 101) + +/* relax align. */ +RELOC_NUMBER (R_LARCH_ALIGN, 102) + +/* pcaddi. */ +RELOC_NUMBER (R_LARCH_PCREL20_S2, 103) + +/* cfa. */ +RELOC_NUMBER (R_LARCH_CFA, 104) + +/* DW_CFA_advance_loc. */ +RELOC_NUMBER (R_LARCH_ADD6, 105) +RELOC_NUMBER (R_LARCH_SUB6, 106) + +/* unsigned leb128. */ +RELOC_NUMBER (R_LARCH_ADD_ULEB128, 107) +RELOC_NUMBER (R_LARCH_SUB_ULEB128, 108) + END_RELOC_NUMBERS (R_LARCH_count) /* Processor specific flags for the ELF header e_flags field. */ diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index 548732e5c70..004bb6561ef 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -28,6 +28,8 @@ extern "C" { #endif + #define LARCH_NOP 0x03400000 + typedef uint32_t insn_t; struct loongarch_opcode @@ -228,6 +230,7 @@ dec2 : [1-9][0-9]? #define ase_gpcr isa.use_la_global_with_pcrel #define ase_gabs isa.use_la_global_with_abs + int relax; } LARCH_opts; extern size_t loongarch_insn_length (insn_t insn);