From f8952d67ef4f570f6d93753ed06ab06788cf00f8 Mon Sep 17 00:00:00 2001 From: Yang Yujie Date: Thu, 4 Nov 2021 17:20:02 +0800 Subject: [PATCH] Fix toolchain conventions and psABI document. --- docs/LoongArch-ELF-ABI-CN.adoc | 40 ++++++++----------- docs/LoongArch-ELF-ABI-EN.adoc | 41 ++++++++------------ docs/LoongArch-toolchain-conventions-CN.adoc | 27 ++++++------- docs/LoongArch-toolchain-conventions-EN.adoc | 29 +++++++------- images/compiler-isa-config-model-EN.svg | 2 +- 5 files changed, 63 insertions(+), 76 deletions(-) diff --git a/docs/LoongArch-ELF-ABI-CN.adoc b/docs/LoongArch-ELF-ABI-CN.adoc index 9180411..6276a6e 100644 --- a/docs/LoongArch-ELF-ABI-CN.adoc +++ b/docs/LoongArch-ELF-ABI-CN.adoc @@ -103,7 +103,7 @@ v1.00 == C 语言数据类型规格 -.lp64 数据模型 (对应基础 ABI 类型:`lp64d` `lp64f` `lp64s`) +.LP64 数据模型 (对应基础 ABI 类型:`lp64d` `lp64f` `lp64s`) [%header,cols="3,^1,^1"] |=== |标量类型 @@ -139,7 +139,7 @@ v1.00 |8 |=== -.ilp32 数据模型 (对应基础 ABI 类型:`ilp32d` `ilp32f` `ilp32s`) +.ILP32 数据模型 (对应基础 ABI 类型:`ilp32d` `ilp32f` `ilp32s`) [%header,cols="3,^1,^1"] |=== |标量类型 @@ -226,32 +226,32 @@ v1.00 |lp64d |`0x3` |使用 64 位通用寄存器,64位浮点寄存器和栈传参, -数据模型为 "lp64"(`long` 和指针类型宽度为64位,`int` 为32位) +数据模型为 LP64(`long` 和指针类型宽度为64位,`int` 为32位) |lp64f |`0x2` |使用 64 位通用寄存器,32位浮点寄存器和栈传参, -数据模型为 "lp64"(`long` 和指针类型宽度为64位,`int` 为32位) +数据模型为 LP64(`long` 和指针类型宽度为64位,`int` 为32位) |lp64s |`0x1` |使用 64 位通用寄存器和栈传参, -数据模型为 "lp64"(`long` 和指针类型宽度为64位,`int` 为32位) +数据模型为 LP64(`long` 和指针类型宽度为64位,`int` 为32位) |ilp32d |`0x7` |使用 32 位通用寄存器,64位浮点寄存器和栈传参, -数据模型为 "ilp32"(`int`,`long` 和指针类型宽度为32位) +数据模型为 ILP32(`int`,`long` 和指针类型宽度为32位) |ilp32f |`0x6` |使用 32 位通用寄存器,32位浮点寄存器和栈传参, -数据模型为 "ilp32"(`int`,`long` 和指针类型宽度为32位) +数据模型为 ILP32(`int`,`long` 和指针类型宽度为32位) |ilp32s |`0x5` |使用 32 位通用寄存器和栈传参, -数据模型为 "ilp32"(`int`,`long` 和指针类型宽度为32位) +数据模型为 ILP32(`int`,`long` 和指针类型宽度为32位) | |`0x4` `0x0` @@ -275,31 +275,26 @@ v1.00 |=== [[abi-versioning]] -`e_flags[7:6]` 标记了 ELF 目标文件使用的 ABI 版本, -它和动态链接器标准文件名 (`ld-*.so`) 的版本后缀一一对应。 +`e_flags[7:6]` 标记了 ELF 目标文件使用的 ABI 版本。 .ABI 版本标记 -[%header,cols="2,^1,^5,^1"] +[%header,cols="2,^1,^5"] |=== |ABI 版本 |枚举值 |描述 -|动态链接器版本后缀 |`v0` |`0x0` |支持具有栈操作语义的重定位类型 -|`.0` |`v1` |`0x1` |按需保留 -|`.1` | |`0x2` `0x3` |保留值 -|`.2` `.3` |=== @@ -610,28 +605,25 @@ v1.00 |lp64d |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64d.so. +|/lib64/ld-linux-loongarch-lp64d.so.1 |lp64f |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64f.so. +|/lib64/ld-linux-loongarch-lp64f.so.1 |lp64s |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64s.so. +|/lib64/ld-linux-loongarch-lp64s.so.1 |ilp32d |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32d.so. +|/lib32/ld-linux-loongarch-ilp32d.so.1 |ilp32f |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32f.so. +|/lib32/ld-linux-loongarch-ilp32f.so.1 |ilp32s |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32s.so. +|/lib32/ld-linux-loongarch-ilp32s.so.1 |=== - -表中 `` 与 ELF文件编码的 `e_flags[7:6]` 一一对应, -参见 <> 。 diff --git a/docs/LoongArch-ELF-ABI-EN.adoc b/docs/LoongArch-ELF-ABI-EN.adoc index 873a57c..b3279ec 100644 --- a/docs/LoongArch-ELF-ABI-EN.adoc +++ b/docs/LoongArch-ELF-ABI-EN.adoc @@ -102,7 +102,7 @@ Static registers are also known as callee-saved registers. == Type Size and Alignment -.lp64 Data Model (base ABI types: `lp64d` `lp64f` `lp64s`) +.LP64 Data Model (base ABI types: `lp64d` `lp64f` `lp64s`) [%header,cols="3,^1,^1"] |=== |Scalar type @@ -138,7 +138,7 @@ Static registers are also known as callee-saved registers. |8 |=== -.ilp32 Data Model (base ABI types: `ilp32d` `ilp32f` `ilp32s`) +.ILP32 Data Model (base ABI types: `ilp32d` `ilp32f` `ilp32s`) [%header,cols="3,^1,^1"] |=== |Scalar type @@ -223,32 +223,32 @@ The ABI type of an ELF object is uniquely identified by `e_flags[7:0]` in its he |lp64d |`0x3` |Uses 64-bit GPRs, 64-bit FPRs and the stack for parameter passing. -Data model is "lp64", where `long` and pointers are 64-bit while `int` is 32-bit. +Data model is LP64, where `long` and pointers are 64-bit while `int` is 32-bit. |lp64f |`0x2` |Uses 64-bit GPRs, 32-bit FPRs and the stack for parameter passing. -Data model is "lp64", where `long` and pointers are 64-bit while `int` is 32-bit. +Data model is LP64, where `long` and pointers are 64-bit while `int` is 32-bit. |lp64s |`0x1` |Uses 64-bit GPRs and the stack for parameter passing. -Data model is "lp64", where `long` and pointers are 64-bit while `int` is 32-bit. +Data model is LP64, where `long` and pointers are 64-bit while `int` is 32-bit. |ilp32d |`0x7` |Uses 32-bit GPRs, 64-bit FPRs and the stack for parameter passing. -Data model is "ilp32", where `int`, `long` and pointers are 32-bit. +Data model is ILP32, where `int`, `long` and pointers are 32-bit. |ilp32f |`0x6` |Uses 32-bit GPRs, 32-bit FPRs and the stack for parameter passing. -Data model is "ilp32", where `int`, `long` and pointers are 32-bit. +Data model is ILP32, where `int`, `long` and pointers are 32-bit. |ilp32s |`0x5` |Uses 32-bit GPRs and the stack for parameter passing. -Data model is "ilp32", where `int`, `long` and pointers are 32-bit. +Data model is ILP32, where `int`, `long` and pointers are 32-bit. | |`0x4` `0x0` @@ -272,32 +272,26 @@ Data model is "ilp32", where `int`, `long` and pointers are 32-bit. |=== [[abi-versioning]] -`e_flags[7:6]` marks the ABI version of an ELF object, -it also corresponds to the version suffix of standard -program interpreters (`ld-*.so`). +`e_flags[7:6]` marks the ABI version of an ELF object. .ABI Version -[%header,cols="2,^1,^5,^1"] +[%header,cols="2,^1,^5"] |=== |ABI version |Value |Description -|Suffix of program interpreter filenames |`v0` |`0x0` |Stack operands base relocation type. -|`.0` |`v1` |`0x1` |Another relocation type IF needed. -|`.1` | |`0x2` `0x3` |Reserved. -|`.2` `.3` |=== @@ -608,28 +602,25 @@ with check 32-bit unsigned overflow |lp64d |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64d.so. +|/lib64/ld-linux-loongarch-lp64d.so.1 |lp64f |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64f.so. +|/lib64/ld-linux-loongarch-lp64f.so.1 |lp64s |default |Linux, Glibc -|/lib64/ld-linux-loongarch-lp64s.so. +|/lib64/ld-linux-loongarch-lp64s.so.1 |ilp64d |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32d.so. +|/lib32/ld-linux-loongarch-ilp32d.so.1 |ilp64f |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32f.so. +|/lib32/ld-linux-loongarch-ilp32f.so.1 |ilp64s |default |Linux, Glibc -|/lib32/ld-linux-loongarch-ilp32s.so. +|/lib32/ld-linux-loongarch-ilp32s.so.1 |=== - -Note: Each ABI version listed in <> corresponds -to a unique ``. diff --git a/docs/LoongArch-toolchain-conventions-CN.adoc b/docs/LoongArch-toolchain-conventions-CN.adoc index e0d2cc1..2b32a47 100644 --- a/docs/LoongArch-toolchain-conventions-CN.adoc +++ b/docs/LoongArch-toolchain-conventions-CN.adoc @@ -4,6 +4,7 @@ v1.00 :docinfodir: ../themes :docinfo: shared :doctype: book +:imagesdir: ../images :toc: left :toc-title: 目录 :scripts: cjk @@ -167,12 +168,12 @@ v1.00 定义的指令集架构 [%header,cols="^1,^1,^1"] |=== |标准名称 |数据模型 |可用于传参、返回的通用/浮点寄存器宽度 -|`lp64d` |lp64 |64 / 64 -|`lp64f` |lp64 |64 / 32 -|`lp64s` |lp64 |64 / (无) -|`ilp32d` |ilp32 |32 / 64 -|`ilp32f` |ilp32 |32 / 32 -|`ilp32s` |ilp32 |32 / (无) +|`lp64d` |LP64 |64 / 64 +|`lp64f` |LP64 |64 / 32 +|`lp64s` |LP64 |64 / (无) +|`ilp32d` |ILP32 |32 / 64 +|`ilp32f` |ILP32 |32 / 32 +|`ilp32s` |ILP32 |32 / (无) |=== 下表列举了全体 ABI 扩展特性类型及其相关命令行选项,除 `default` 必须实现之外, @@ -199,7 +200,7 @@ v1.00 定义的指令集架构 原则上,实际配置的目标架构不应该对目标 ABI 的确定造成影响, 除非构建时配置或命令行选项对 ABI 的约束导致实现它所需的指令集特性 -超出了编译选项对 ISA 配置的约束范围。此时编译器应报错退出。 +超出了编译选项对 ISA 配置的约束范围。此时编译器可选择报错退出。 当编译选项不能唯一确定目标架构时, 在选择默认值之前,编译器应根据下表,从命令行显式给出的 ABI 配置 @@ -277,7 +278,7 @@ v1.00 定义的指令集架构 |`` 字符串 |含义 |`f64` |基础 ABI 使用 64 位浮点寄存器传参 (`lp64d` `ilp32d`) |`f32` |基础 ABI 使用 32 位浮点寄存器传参 (`lp64f` `ilp32f`) -|`sfp` |基础 ABI 不使用浮点寄存器传参 (`lp64s` `ilp32s`) +|`sf` |基础 ABI 不使用浮点寄存器传参 (`lp64s` `ilp32s`) |=== .Multiarch `os` 字段,`` 后缀标记及其对应的 ABI 扩展特性 @@ -304,7 +305,7 @@ v1.00 定义的指令集架构 |`lp64s` / `default` |GNU/Linux -|`loongarch64-linux-gnusfp` +|`loongarch64-linux-gnusf` |`ilp32d` / `default` |GNU/Linux @@ -316,7 +317,7 @@ v1.00 定义的指令集架构 |`ilp32s` / `default` |GNU/Linux -|`loongarch32-linux-gnusfp` +|`loongarch32-linux-gnusf` |=== @@ -343,15 +344,15 @@ v1.00 定义的指令集架构 |`_LOONGARCH_ARCH` |`"loongarch64"` `"la464"` -|相当于 `--with-arch` / `-march` 指定的目标 CPU 名称 +|`-march` 指定的目标 CPU 名称,若未指定则为默认值 |`_LOONGARCH_TUNE` |`"loongarch64"` `"la464"` -|相当于 `-mtune` 指定的目标 CPU 名称 +|`-mtune` 指定的目标 CPU 名称,若未指定则为默认值 |`__loongarch_lp64` |(无) -|ABI 使用 64 位通用寄存器传参,采用 `lp64` 数据模型 +|ABI 使用 64 位通用寄存器传参,采用 LP64 数据模型 |`__loongarch_hard_float` |(无) diff --git a/docs/LoongArch-toolchain-conventions-EN.adoc b/docs/LoongArch-toolchain-conventions-EN.adoc index 3fbc491..b352389 100644 --- a/docs/LoongArch-toolchain-conventions-EN.adoc +++ b/docs/LoongArch-toolchain-conventions-EN.adoc @@ -4,6 +4,7 @@ v1.00 :docinfodir: ../themes :docinfo: shared :doctype: book +:imagesdir: ../images :toc: left __Note: In this document, the terms "architecture", "instruction set architecture" and "ISA" @@ -186,12 +187,12 @@ implemented target ISA variants. |=== |Standard name |Data model |Bit-width of argument / return value GPRs / FPRs -|`lp64d` |lp64 |64 / 64 -|`lp64f` |lp64 |64 / 32 -|`lp64s` |lp64 |64 / (none) -|`ilp32d` |ilp32 |32 / 64 -|`ilp32f` |ilp32 |32 / 32 -|`ilp32s` |ilp32 |32 / (none) +|`lp64d` |LP64 |64 / 64 +|`lp64f` |LP64 |64 / 32 +|`lp64s` |LP64 |64 / (none) +|`ilp32d` |ILP32 |32 / 64 +|`ilp32f` |ILP32 |32 / 32 +|`ilp32s` |ILP32 |32 / (none) |=== The following table lists all ABI extension types and @@ -221,8 +222,8 @@ the command line. The build-time default ABI should be selected. In principle, the configured target ISA should not affect the decision of the target ABI. When certain ISA feature requirement that comes from the ABI breaks the explicit (i.e. from the compiler options) -constraints on the target ISA, the compiler should abort with an error -message to complain about the conflict. +constraints on the target ISA, the compiler can choose to abort with +an error message to complain about the conflict. When the target ISA configuration cannot be uniquely decided from the given compiler options, the compiler should first try inferring the @@ -295,7 +296,7 @@ specifier, respectively. |`` |Description |`f64` |The base ABI uses 64-bit FPRs for parameter passing. (`lp64d` `ilp32d`) |`f32` |The base ABI uses 32-bit FPRs for parameter passing. (`lp64f` `ilp32f`) -|`sfp` |The base ABI uses no FPR for parameter passing. (`lp64s` `ilp32s`) +|`sf` |The base ABI uses no FPR for parameter passing. (`lp64s` `ilp32s`) |=== .List of possible `` @@ -326,7 +327,7 @@ multiple multiarch specifiers for one OS / ABI combination.)__ |`lp64s` / `default` |GNU/Linux -|`loongarch64-linux-gnusfp` +|`loongarch64-linux-gnusf` |`ilp32d` / `default` |GNU/Linux @@ -338,7 +339,7 @@ multiple multiarch specifiers for one OS / ABI combination.)__ |`ilp32s` / `default` |GNU/Linux -|`loongarch32-linux-gnusfp` +|`loongarch32-linux-gnusf` |=== == C/C++ Preprocessor Definitions @@ -364,15 +365,17 @@ multiple multiarch specifiers for one OS / ABI combination.)__ |`_LOONGARCH_ARCH` |`"loongarch64"` `"la464"` -|Processor model as specified by `--with-arch` / `-march`. +|Processor model as specified by `-march`. +If `-march` is not present, the build-time default should be used. |`_LOONGARCH_TUNE` |`"loongarch64"` `"la464"` |Processor model as specified by `-mtune`. +If `-mtune` is not present, the build-time default should be used. |`__loongarch_lp64` |(none) -|Defined if integer ABI type is `lp64`. +|Defined if ABI uses the LP64 data model and 64-bit GPRs for parameter passing. |`__loongarch_hard_float` |(none) diff --git a/images/compiler-isa-config-model-EN.svg b/images/compiler-isa-config-model-EN.svg index 1f19ca4..ab96ddd 100644 --- a/images/compiler-isa-config-model-EN.svg +++ b/images/compiler-isa-config-model-EN.svg @@ -820,7 +820,7 @@ style="stroke-width:0.079375" y="106.24174" x="112.1204" - sodipodi:role="line">extended options that alters the range of enable ISAextended options that alters the range of enabled ISA