From patchwork Mon May 22 01:34:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengqinggang X-Patchwork-Id: 96951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1144305vqo; Sun, 21 May 2023 18:35:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Cz8KEoOngTz3QVH/8tCtiWUVfzrcIB5GFx7xtMqy4j2LOfbtMzpbLMN5rk7ACcmF3sl/O X-Received: by 2002:a17:906:ee8d:b0:966:7a0a:28ae with SMTP id wt13-20020a170906ee8d00b009667a0a28aemr8341242ejb.22.1684719308403; Sun, 21 May 2023 18:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684719308; cv=none; d=google.com; s=arc-20160816; b=aFxXWIHpnNqDKlytURg/3Wq2co+wp7lBnHaQfiPjF3naQp9IRulYIjZTYauSJxAmsl I5vLc/wrGYnKGdWORJwhPhKVpR8NOZ64mHQ6LT1ZJY0cYo/4cjQarbo5gK5Vnwo3dSjh xY/YP3CSsc7KJ0RPa3uDFcpI9neHA8Mci9RQhzSqGv4gHN+TF/QmP4G0FZ5CGQ4y6+fW AXX41DVeWXoH1me85LcYyrKLdk8DMh832/mL5vPJIdt0zTM1MRwcuoZG4VvXo9wR/lLj dgVQG1q6dsuMvO8qyokFpmWmxzmdI2i5khrNVhyiIw+FLfchD18G4vBl4ofH1cvs0itf m9zQ== 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=SeVmtIP7RYFPi6ItEC6lYXoX2eRRJITqxYdur3WkLxCo2/cs2+VzXnMpAkdWvihcX6 no2iiPsMR7XBGyTcDPnxHFZt+0syKLA5v7Qen8CdGc3eYVsqS3OPib1dOCa4djES3x5S KXRithQ0RD2HPfUdcNXqQXKodqbmLQcPRZ9BUeyzZobId9rRKQM3UGconV+oHIP0BWBQ Ms8JM3w5Sf+eRUs87Z3W5bSFD37SjYa7QyA0GUky7NguOHVAj6fQv78FFYL5PvQZ84e+ mnHmDyThbwSsra24k338gXr3se1MLeiGXPLlKHNmGf4s20bXuLM511oOwdGAiw5BAuP5 vjGw== 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w10-20020a170906130a00b00953604e9232si3605724ejb.957.2023.05.21.18.35.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 May 2023 18:35:08 -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 A54383858C50 for ; Mon, 22 May 2023 01:35:03 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id BD7453858D35 for ; Mon, 22 May 2023 01:34:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD7453858D35 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 _____8DxDevAxmpkZsYKAA--.18742S3; Mon, 22 May 2023 09:34:56 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxMMi0xmpkzF5uAA--.53821S3; Mon, 22 May 2023 09:34:56 +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, mengqinggang Subject: [PATCH v4 1/6] LoongArch: include: Add support for linker relaxation. Date: Mon, 22 May 2023 09:34:36 +0800 Message-Id: <20230522013441.3074776-2-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230522013441.3074776-1-mengqinggang@loongson.cn> References: <20230522013441.3074776-1-mengqinggang@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxMMi0xmpkzF5uAA--.53821S3 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7KrW5Wr45CF1xuw4fXr1kZrb_yoW8Ar13pF 9xAw45CFWFkFsrur9Yv34fArs3Z3yxKFW2qFyfZa10krsrJryUXr48CF1DAFW2qws0qrWa vryfWw15WF95trUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2AI xVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0 rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r 4UYxBIdaVFxhVjvjDU0xZFpf9x07UMpBfUUUUU= X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_SBL_CSS, SPF_HELO_PASS, 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?1766556233942828914?= X-GMAIL-MSGID: =?utf-8?q?1766556233942828914?= 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);