From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 1F7F4385140A for ; Thu, 21 Jul 2022 01:38:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F7F4385140A 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 AQAAf9DxL9IJrthi4bErAA--.40628S2; Thu, 21 Jul 2022 09:38:21 +0800 (CST) From: liuzhensong To: binutils@sourceware.org Cc: xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, xuchenghua@loongson.cn, mengqinggang@loongson.cn, huangpei@loongson.cn, chenglulu@loongson.cn, caiyinyu@loongson.cn, liuzhensong Subject: [PATCH v2 0/6] Add new relocations for LoongArch. Date: Thu, 21 Jul 2022 09:37:46 +0800 Message-Id: <20220721013751.466014-1-liuzhensong@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9DxL9IJrthi4bErAA--.40628S2 X-Coremail-Antispam: 1UD129KBjvJXoWxtF47KrWUGrWDWw13Kr1rJFb_yoWxuF1Dp3 W7Zr1FyF1xAFnrWFykGay5XryDXa97GFWa9a4SqF1I9rZavry8Zw10yrZxXFW3J3y5J34r Z34Fvw15WF4Dtr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9014x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxV W8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xf McIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7 v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF 7I0E8cxan2IY04v7MxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbV WUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF 67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42 IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1U MIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIda VFxhVjvjDU0xZFpf9x0JUdHUDUUUUU= X-CM-SenderInfo: holx6xphqv003j6o00pqjv00gofq/ X-Spam-Status: No, score=-7.0 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: 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: , X-List-Received-Date: Thu, 21 Jul 2022 01:38:28 -0000 This is the v2 version of patches to support new relocations for LoongArch. The new reloc types docnments are on: https://github.com/loongson/LoongArch-Documentation/pull/57/files The testsuite status: === binutils Summary === # of expected passes 241 # of unsupported tests 6 === gas Summary === # of expected passes 270 # of unsupported tests 7 === ld Summary === # of expected passes 1457 # of expected failures 11 # of untested testcases 1 # of unsupported tests 154 The patch set changelog: v1 -> v2 1. Rename some relocations. 2. Fix bug caused by a pointer point to global ifunc. 3. Fix bug in relocation R_LARCH_SOP_PUSH_GPREL. 3. Change some comments. 4. Add testcases. liuzhensong (6): bfd: Add supported for LoongArch new relocations. LoongArch:opcodes: Add new reloc types. LoongArch: gas: Add new reloc types. LoongArch: Move ifunc info to rela.dyn from rela.plt. bfd: Delete R_LARCH_NONE from dyn info of LoongArch. LoongArch: Add testcases for new relocate types. bfd/bfd-in2.h | 37 + bfd/elfnn-loongarch.c | 1554 ++++++++++++----- bfd/elfxx-loongarch.c | 1371 +++++++++++---- bfd/elfxx-loongarch.h | 4 + bfd/libbfd.h | 37 + bfd/reloc.c | 82 + binutils/readelf.c | 2 + gas/config/loongarch-lex.h | 3 + gas/config/loongarch-parse.y | 72 +- gas/config/tc-loongarch.c | 140 +- gas/config/tc-loongarch.h | 7 +- gas/testsuite/gas/all/gas.exp | 4 +- gas/testsuite/gas/loongarch/jmp_op.d | 82 +- gas/testsuite/gas/loongarch/jmp_op.s | 38 +- gas/testsuite/gas/loongarch/macro_op.d | 778 +-------- gas/testsuite/gas/loongarch/macro_op.s | 44 +- gas/testsuite/gas/loongarch/macro_op_32.d | 55 + gas/testsuite/gas/loongarch/macro_op_32.s | 16 + .../gas/loongarch/macro_op_large_abs.d | 77 + .../gas/loongarch/macro_op_large_abs.s | 9 + .../gas/loongarch/macro_op_large_pc.d | 77 + .../gas/loongarch/macro_op_large_pc.s | 9 + gas/testsuite/gas/loongarch/reloc.d | 167 ++ gas/testsuite/gas/loongarch/reloc.s | 144 ++ include/elf/loongarch.h | 139 ++ ld/testsuite/ld-elf/eh5.d | 2 +- ld/testsuite/ld-elf/pr26936.d | 2 +- ld/testsuite/ld-elf/shared.exp | 6 +- ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c | 23 + .../ld-loongarch-elf/attr-ifunc-4.out | 1 + ld/testsuite/ld-loongarch-elf/disas-jirl-32.d | 18 +- ld/testsuite/ld-loongarch-elf/disas-jirl.d | 19 +- ld/testsuite/ld-loongarch-elf/ifunc.exp | 34 + ld/testsuite/ld-loongarch-elf/jmp_op.d | 84 +- ld/testsuite/ld-loongarch-elf/jmp_op.s | 42 +- .../ld-loongarch-elf/libnopic-global.s | 113 ++ ld/testsuite/ld-loongarch-elf/macro_op.d | 883 ++-------- ld/testsuite/ld-loongarch-elf/macro_op.s | 57 +- ld/testsuite/ld-loongarch-elf/macro_op_32.d | 768 +------- ld/testsuite/ld-loongarch-elf/macro_op_32.s | 43 +- .../ld-loongarch-elf/nopic-global-so.rd | 5 + .../ld-loongarch-elf/nopic-global-so.sd | 10 + .../ld-loongarch-elf/nopic-global.out | 1 + ld/testsuite/ld-loongarch-elf/nopic-global.s | 373 ++++ ld/testsuite/ld-loongarch-elf/nopic-global.sd | 5 + ld/testsuite/ld-loongarch-elf/nopic-global.xd | 3 + ld/testsuite/ld-loongarch-elf/nopic-local.out | 1 + ld/testsuite/ld-loongarch-elf/nopic-local.rd | 0 ld/testsuite/ld-loongarch-elf/nopic-local.s | 383 ++++ ld/testsuite/ld-loongarch-elf/nopic-local.sd | 5 + ld/testsuite/ld-loongarch-elf/nopic-local.xd | 3 + .../ld-loongarch-elf/nopic-weak-global-so.rd | 5 + .../ld-loongarch-elf/nopic-weak-global-so.sd | 10 + .../ld-loongarch-elf/nopic-weak-global.out | 1 + .../ld-loongarch-elf/nopic-weak-global.s | 374 ++++ .../ld-loongarch-elf/nopic-weak-global.sd | 5 + .../ld-loongarch-elf/nopic-weak-global.xd | 3 + .../ld-loongarch-elf/nopic-weak-local.out | 1 + .../ld-loongarch-elf/nopic-weak-local.rd | 0 .../ld-loongarch-elf/nopic-weak-local.s | 383 ++++ .../ld-loongarch-elf/nopic-weak-local.sd | 5 + .../ld-loongarch-elf/nopic-weak-local.xd | 3 + ld/testsuite/ld-loongarch-elf/pic.exp | 202 +++ ld/testsuite/ld-loongarch-elf/pic.ld | 18 + opcodes/loongarch-opc.c | 412 +++-- 65 files changed, 5773 insertions(+), 3481 deletions(-) create mode 100644 gas/testsuite/gas/loongarch/macro_op_32.d create mode 100644 gas/testsuite/gas/loongarch/macro_op_32.s create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_abs.d create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_abs.s create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_pc.d create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_pc.s create mode 100644 gas/testsuite/gas/loongarch/reloc.d create mode 100644 gas/testsuite/gas/loongarch/reloc.s create mode 100644 ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c create mode 100644 ld/testsuite/ld-loongarch-elf/attr-ifunc-4.out create mode 100644 ld/testsuite/ld-loongarch-elf/ifunc.exp create mode 100644 ld/testsuite/ld-loongarch-elf/libnopic-global.s create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global-so.rd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global-so.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.out create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.s create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.xd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.out create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.rd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.s create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.xd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.rd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.out create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.s create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.xd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.out create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.rd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.s create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.sd create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.xd create mode 100644 ld/testsuite/ld-loongarch-elf/pic.exp create mode 100644 ld/testsuite/ld-loongarch-elf/pic.ld -- 2.31.1