| Message ID | 20251205064759.2102819-1-mengqinggang@loongson.cn |
|---|---|
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 658694C318BB for <patchwork@sourceware.org>; Fri, 5 Dec 2025 06:52:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 658694C318BB 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 7E98C4C3183D for <binutils@sourceware.org>; Fri, 5 Dec 2025 06:51:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E98C4C3183D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7E98C4C3183D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764917492; cv=none; b=TduBsqWduNWiikffYYi+ccwHCpg3Xqggfy+CvqWQUPsegx8sbW8Y8DU2xL0rLl9h66waYOUQiQpF861qPK+5F1q4xW9iEplESZL0A68toaZIYaCN+vwOSF/SoM2HxDsgnZtFpDVlwdcwGWJLsV0S4VeMqVJTqbASbhF7lMczrec= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764917492; c=relaxed/simple; bh=Y9fGTeIdFSF5inTD2fbQY+GuvSCa0Bkae5xg68yu0AQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=fWuOFA4Ozz7ekomV/9zp7tD8STq/5N0oFIVJptyk0EdIdifUVAhT6OQaRSxPAZ+yPcsFeGIqFQ7GHnfNgKQdU1YT7dKk1O/sL1XAg4kcbWF+jL0kSvRfT2Y8EmVpKECg/sFkTxcJL0yX3Qw+1UHL6NW3sMV0k+xUmB0NJbEHZcA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E98C4C3183D Received: from loongson.cn (unknown [10.2.6.7]) by gateway (Coremail) with SMTP id _____8CxbNLvgDJpzE0rAA--.28258S3; Fri, 05 Dec 2025 14:51:27 +0800 (CST) Received: from amd9754.. (unknown [10.2.6.7]) by front1 (Coremail) with SMTP id qMiowJDxQ+TrgDJpmsRFAQ--.59530S2; Fri, 05 Dec 2025 14:51:23 +0800 (CST) From: mengqinggang <mengqinggang@loongson.cn> To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, cailulu@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn, hejinyang@loongson.cn, c@jia.je, mengqinggang@loongson.cn Subject: [PATCH v3 00/12] Add support for LoongArch32 in Binutils Date: Fri, 5 Dec 2025 14:47:47 +0800 Message-Id: <20251205064759.2102819-1-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qMiowJDxQ+TrgDJpmsRFAQ--.59530S2 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Add support for LoongArch32 in Binutils
|
|
Message
mengqinggang
Dec. 5, 2025, 6:47 a.m. UTC
Add support for LoongArch32 (LA32) and LoongArch32 Reduced (LA32R).
Add some new relocations for LA32 and LA32R.
The discussion about relocations is here[1].
The gcc, glibc and kernel patches is here[2] [3] [4].
The binutils, gcc and glibc source code are also here[5] [6] [7].
A LA32 linux system based on qemu-user is here[8].
[1] https://github.com/loongson/la-abi-specs/pull/16
[2] https://sourceware.org/pipermail/gcc-patches/2025-November/702128.html
[3] https://sourceware.org/pipermail/libc-alpha/2025-December/173146.html
[4] https://lore.kernel.org/loongarch/20251127154832.137925-1-chenhuacai@loongson.cn/
[5] https://github.com/cloudspurs/binutils/tree/la32
[6] https://github.com/cloudspurs/gcc/tree/la32
[7] https://github.com/cloudspurs/glibc/tree/la32
[8] https://github.com/sunhaiyong1978/CLFS-for-LoongArch32/blob/main/Qemu_For_LoongArch32-Simple.md
v2 -> v3:
- Add call/tail, call/tail can expand to call36/tail36 or call30/tail30 by
-mabi option.
- Add tests about relocations, tls type transition, got relaxation and call30
relaxation.
- Modify some comments based on Xuerui's suggestions.
v1 -> v2:
- Add some new relocations for LA32 and LA32R.
- Add tls type transition and got relaxation.
v2: https://sourceware.org/pipermail/binutils/2025-December/146091.html
v1: https://sourceware.org/pipermail/binutils/2025-June/141697.html
Jiajie Chen (1):
LoongArch: Change DWARF2_CIE_DATA_ALIGNMENT to -4 for loongarch32
Lulu Cai (1):
LoongArch32: Fix and add testcases
mengqinggang (10):
LoongArch: Enable loongarch_elf64_vec loongarch64_pei_vec on LA32
target
LoongArch: Add R_LARCH_TLS_LE_ADD_R relocation support for add.w
LoongArch: Enable all instructions by default on LA32 like LA64
LoongArch: Add LA32 and LA32R relocations
LoongArch: Add processing for LA32/LA32R relocations
LoongArch: LA32 macros support
LoongArch: LA32R macros expand
LoongArch: Add linker relaxation support for R_LARCH_CALL30
LoongArch: Add support for tls type transition on LA32
LoongArch: Add linker relaxation for got_pcadd_hi20 and got_pcadd_lo12
bfd/bfd-in2.h | 13 +
bfd/config.bfd | 2 +-
bfd/elfnn-loongarch.c | 553 +++++++++++++++---
bfd/elfxx-loongarch.c | 229 ++++++++
bfd/libbfd.h | 13 +
bfd/reloc.c | 27 +
gas/config/tc-loongarch.c | 174 ++++--
gas/config/tc-loongarch.h | 3 +-
gas/testsuite/gas/loongarch/macro_op_32.d | 72 ++-
gas/testsuite/gas/loongarch/relocs_32.d | 49 ++
gas/testsuite/gas/loongarch/relocs_32.s | 37 ++
include/elf/loongarch.h | 35 ++
include/opcode/loongarch.h | 4 +
ld/testsuite/ld-loongarch-elf/desc-ie.d | 9 +-
ld/testsuite/ld-loongarch-elf/disas-jirl-32.d | 14 +-
ld/testsuite/ld-loongarch-elf/la32.d | 15 +
ld/testsuite/ld-loongarch-elf/la32.s | 14 +
.../ld-loongarch-elf/ld-loongarch-elf.exp | 4 +
ld/testsuite/ld-loongarch-elf/macro_op_32.d | 72 ++-
ld/testsuite/ld-loongarch-elf/pic.exp | 4 +-
opcodes/loongarch-opc.c | 78 ++-
21 files changed, 1189 insertions(+), 232 deletions(-)
create mode 100644 ld/testsuite/ld-loongarch-elf/la32.d
create mode 100644 ld/testsuite/ld-loongarch-elf/la32.s