From d9b56c66b6644c6ce7dcc304590503e42b9b955b Mon Sep 17 00:00:00 2001 From: mengqinggang Date: Tue, 22 Nov 2022 19:28:40 +0800 Subject: [PATCH] Add relaxation relocations --- docs/LoongArch-ELF-ABI-CN.adoc | 40 ++++++++++++++++++++++++++++++++++ docs/LoongArch-ELF-ABI-EN.adoc | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/docs/LoongArch-ELF-ABI-CN.adoc b/docs/LoongArch-ELF-ABI-CN.adoc index c5d948e..a2b5207 100644 --- a/docs/LoongArch-ELF-ABI-CN.adoc +++ b/docs/LoongArch-ELF-ABI-CN.adoc @@ -847,6 +847,46 @@ v2.01 |R_LARCH_RELAX |在相同的地址和其它重定位成对使用,标识指令可能被修改或删除(relaxed)。 | + +|101 +|R_LARCH_DELETE +|指令在链接时被删除。 +| + +|102 +|R_LARCH_ALIGN +|对齐声明,重定位加数表示 NOP 指令在重定位位置所占用的字节数,对齐边界向上舍入到大于重定位加数的最小的 2 的 n 次幂。 +| + +|103 +|R_LARCH_PCREL20_S2 +|22 位相对 PC 偏移 +|`+(*(uint32_t *) PC) [24 ... 5] = (S + A - PC) [21 ... 2]+` + +|104 +|R_LARCH_CFA +|Canonical Frame Address +| + +|105 +|R_LARCH_ADD6 +|6 位原地加法 +| + +|106 +|R_LARCH_SUB6 +|6 位原地减法 +| + +|107 +|R_LARCH_ADD_ULEB128 +|ULEB128 原地加法 +| + +|108 +|R_LARCH_SUB_ULEB128 +|ULEB128 原地减法 +| |=== diff --git a/docs/LoongArch-ELF-ABI-EN.adoc b/docs/LoongArch-ELF-ABI-EN.adoc index d77ecca..4e718e2 100644 --- a/docs/LoongArch-ELF-ABI-EN.adoc +++ b/docs/LoongArch-ELF-ABI-EN.adoc @@ -850,6 +850,46 @@ with check 28-bit signed overflow and 4-bit aligned |R_LARCH_RELAX |Instruction can be relaxed, paired with a normal relocation at the same address | + +|101 +|R_LARCH_DELETE +|The instruction should be deleted at link time. +| + +|102 +|R_LARCH_ALIGN +|Alignment statement. The addend indicates the number of bytes occupied by nop instructions at the relocation offset. The alignment boundary is specified by the addend rounded up to the next power of two. +| + +|103 +|R_LARCH_PCREL20_S2 +|22 bits PC-relative offset +|`+(*(uint32_t *) PC) [24 ... 5] = (S + A - PC) [21 ... 2]+` + +|104 +|R_LARCH_CFA +|Canonical Frame Address +| + +|105 +|R_LARCH_ADD6 +|6-bit in-place addition +| + +|106 +|R_LARCH_SUB6 +|6-bit in-place subtraction +| + +|107 +|R_LARCH_ADD_ULEB128 +|ULEB128 in-place addition +| + +|108 +|R_LARCH_SUB_ULEB128 +|ULEB128 in-place subtraction +| |===