From patchwork Tue Jul 19 13:08:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cheng X-Patchwork-Id: 55071 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 63CE03852768 for ; Tue, 19 Jul 2022 13:09:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id E82AE3858439 for ; Tue, 19 Jul 2022 13:09:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E82AE3858439 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 5.5.5 (unknown [10.2.5.5]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxD9HnrNZiAIYoAA--.35902S2; Tue, 19 Jul 2022 21:08:59 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 0/2] LoongArch: Modify the method of obtaining symbolic addresses. Date: Tue, 19 Jul 2022 21:08:50 +0800 Message-Id: <20220719130852.2011955-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf9DxD9HnrNZiAIYoAA--.35902S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw4fXrW8Xw47WF1xAw17trb_yoW8Zr4rp3 sruw43tFWkJr47uw1kt348Wwn8trZ7u347XFW3tr10ka17XryrZF1Syr15uFnru398AF1a vr1F9w4UZF1vy37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJw CI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUb3rc3UUUUU== X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xuchenghua@loongson.cn, Lulu Cheng , i@xen0n.name Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 1. The original LA macro instruction is split into two instructions to obtain the address of the symbol if enable '-mexplicit-relocs'. 2. Currently, '-mcmodel=' only supports 'normal' mode, because other mode behaviors are not yet determined. This function is gradually improved by the subsequent handling. 3. Modify the method that calls global functions. From 'la.global + jirl' to 'bl'. 4. Some R_LARCH_64 in section .eh_frame will to generate R_LARCH_NONE, we change ASM_PREFERRED_EH_DATA_FORMAT from 'WD_EH_PE_absptr' to 'WD_EH_PE_pcrel | DW_EH_PE_sdata4' then relocation to R_LARCH_32_PCREL from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation for R_LARCH_32_PCREL. This new symbol loading method not support by upstream binutils yet, this GCC port requires the following patches applied to binutils to build. https://sourceware.org/pipermail/binutils/2022-July/121849.html https://sourceware.org/pipermail/binutils/2022-July/121850.html https://sourceware.org/pipermail/binutils/2022-July/121851.html https://sourceware.org/pipermail/binutils/2022-July/121852.html https://sourceware.org/pipermail/binutils/2022-July/121853.html Lulu Cheng (2): LoongArch: Modify the method of obtaining symbolic addresses. LoongArch: Modify the definition of the ASM_PREFERRED_EH_DATA_FORMAT macro. .../config/loongarch/loongarch-common.cc | 1 + gcc/config/loongarch/constraints.md | 24 +- gcc/config/loongarch/genopts/loongarch.opt.in | 4 + gcc/config/loongarch/loongarch-protos.h | 9 +- gcc/config/loongarch/loongarch.cc | 660 +++++++++++++----- gcc/config/loongarch/loongarch.h | 4 +- gcc/config/loongarch/loongarch.md | 401 +++-------- gcc/config/loongarch/loongarch.opt | 4 + gcc/config/loongarch/predicates.md | 56 +- 9 files changed, 629 insertions(+), 534 deletions(-)