]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add the PCALAU12I instruction for reloc use
authorWANG Xuerui <git@xen0n.name>
Sat, 3 Dec 2022 12:57:52 +0000 (20:57 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 16 Mar 2023 17:24:42 +0000 (17:24 +0000)
The LoongArch ELF psABI v2.00 revamped the relocation design, largely
moving to using the `pcalau12i + addi/ld/st` pair for PC-relative
addressing within +/- 32 bits. The "pcala" in `pcalau12i` stands for
"PC-aligned add"; the instruction's semantics happen to coincide with
arm64's `adrp`.

Add support for emitting this instruction as part of the relevant
addressing ops, for use with new reloc types later.

Updates #58784

Change-Id: Ic1747cd9745aad0d1abb9bd78400cd5ff5978bc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/455016
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/internal/obj/loong64/a.out.go
src/cmd/internal/obj/loong64/anames.go
src/cmd/internal/obj/loong64/asm.go

index 10cf3966693726fbe43f3334b3c7f1040b40ea1d..e7ac592b8b23802246770729c0c2c77d7b23b374 100644 (file)
@@ -265,6 +265,7 @@ const (
        ALU12IW
        ALU32ID
        ALU52ID
+       APCALAU12I
        APCADDU12I
        AJIRL
        ABGE
index eb13da20c3f61be1cca76771f81e487754695daa..f61756e7a809391dd8df90c7c1067397cb40835b 100644 (file)
@@ -33,6 +33,7 @@ var Anames = []string{
        "LU12IW",
        "LU32ID",
        "LU52ID",
+       "PCALAU12I",
        "PCADDU12I",
        "JIRL",
        "BGE",
index 02e44ee0a159888125ea59770175684949cfdb88..f4311c4c072b16c332d164b40f6f9919d2020ada 100644 (file)
@@ -1847,6 +1847,8 @@ func (c *ctxt0) opir(a obj.As) uint32 {
                return 0x0a << 25
        case ALU32ID:
                return 0x0b << 25
+       case APCALAU12I:
+               return 0x0d << 25
        case APCADDU12I:
                return 0x0e << 25
        }