From patchwork Thu Jul 21 06:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cheng X-Patchwork-Id: 55073 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 C2E773856084 for ; Thu, 21 Jul 2022 06:43:38 +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 208B73858D28 for ; Thu, 21 Jul 2022 06:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 208B73858D28 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 AQAAf9Dxf9N+9dhiwgssAA--.40495S2; Thu, 21 Jul 2022 14:43:15 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 0/3] LoongArch: Modify the method of obtaining symbolic addresses. Date: Thu, 21 Jul 2022 14:41:20 +0800 Message-Id: <20220721064123.2981805-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf9Dxf9N+9dhiwgssAA--.40495S2 X-Coremail-Antispam: 1UD129KBjvJXoWxWw4fur4fGw4UKw4UGFW7urg_yoW5uFWUp3 47Zr4YgFW8GrZ7Kw1kJa43Z39rArn7GrWa93WSqr109rW2qry3ZF18tr9rW3W3G3W5AFyF qF1S93WUWasFq37anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUka14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJw CI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvE x4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU9189UUUUU= X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, KAM_STOCKGEN, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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. The method that calls global functions from 'la.global + jirl' to 'bl' when build with '-fplt'. 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. [1]https://sourceware.org/pipermail/binutils/2022-July/121933.html [2]https://sourceware.org/pipermail/binutils/2022-July/121937.html [3]https://sourceware.org/pipermail/binutils/2022-July/121934.html [4]https://sourceware.org/pipermail/binutils/2022-July/121935.html [5]https://sourceware.org/pipermail/binutils/2022-July/121936.html [6]https://sourceware.org/pipermail/binutils/2022-July/121938.html [7]https://sourceware.org/pipermail/binutils/2022-July/121939.html Lulu Cheng (3): LoongArch: Subdivision symbol type, add SYMBOL_PCREL support. LoongArch: Support split symbol. 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 | 10 +- gcc/config/loongarch/loongarch.cc | 652 +++++++++++++----- gcc/config/loongarch/loongarch.h | 4 +- gcc/config/loongarch/loongarch.md | 401 +++-------- gcc/config/loongarch/loongarch.opt | 4 + gcc/config/loongarch/predicates.md | 56 +- .../gcc.target/loongarch/func-call-1.c | 32 + .../gcc.target/loongarch/func-call-2.c | 32 + .../gcc.target/loongarch/func-call-3.c | 32 + .../gcc.target/loongarch/func-call-4.c | 32 + .../gcc.target/loongarch/func-call-5.c | 33 + .../gcc.target/loongarch/func-call-6.c | 33 + .../gcc.target/loongarch/func-call-7.c | 34 + .../gcc.target/loongarch/func-call-8.c | 33 + .../loongarch/relocs-symbol-noaddend.c | 23 + 18 files changed, 905 insertions(+), 535 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-3.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-4.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-5.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-6.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-7.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-8.c create mode 100644 gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c