Skip to content

Commit

Permalink
cmd/internal/obj/loong64: add the PCALAU12I instruction for reloc use
Browse files Browse the repository at this point in the history
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 golang#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>
  • Loading branch information
xen0n authored and gopherbot committed Mar 16, 2023
1 parent f594a3e commit b4ac4b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cmd/internal/obj/loong64/a.out.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ const (
ALU12IW
ALU32ID
ALU52ID
APCALAU12I
APCADDU12I
AJIRL
ABGE
Expand Down
1 change: 1 addition & 0 deletions src/cmd/internal/obj/loong64/anames.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/cmd/internal/obj/loong64/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit b4ac4b4

Please sign in to comment.