[go] cmd/link: internal linking support for windows/arm64

0 views
Skip to first unread message

Quim Muntal (Gerrit)

unread,
Oct 28, 2025, 1:57:18 AM (8 days ago) Oct 28
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, Go LUCI, Cherry Mui, Than McIntosh, golang-co...@googlegroups.com

Quim Muntal submitted the change with unreviewed changes

Unreviewed changes

7 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/cmd/link/internal/ld/data.go
Insertions: 2, Deletions: 2.

@@ -914,7 +914,7 @@
rel.AddUint8(0x90)
rel.AddUint8(0x90)
case sys.ARM64:
- // adrp x16, *addr
+ // adrp x16, addr
rel.AddUint32(ctxt.Arch, 0x90000010)
r, _ := rel.AddRel(objabi.R_ARM64_PCREL)
r.SetOff(int32(rel.Size() - 4))
@@ -928,7 +928,7 @@
r.SetSiz(4)
r.SetSym(targ)

- // br *addr
+ // br x17
rel.AddUint32(ctxt.Arch, 0xd61f0220)
}
} else if tplt >= 0 {
```
```
The name of the file: src/cmd/link/internal/arm64/asm.go
Insertions: 3, Deletions: 3.

@@ -1040,7 +1040,7 @@
}
o0 := (uint32((t>>12)&3) << 29) | (uint32((t>>12>>2)&0x7ffff) << 5)
if target.IsWindows() {
- val &= 0x9f00001f
+ val &^= 3<<29 | 0x7ffff<<5
}
return val | int64(o0), noExtReloc, isOk
} else if (val>>24)&0x9f == 0x91 {
@@ -1049,7 +1049,7 @@
t := ldr.SymAddr(rs) + r.Add() - ((ldr.SymValue(s) + int64(r.Off())) &^ 0xfff)
o1 := uint32(t&0xfff) << 10
if target.IsWindows() {
- val &= 0xffC003ff
+ val &^= 0xfff << 10
}
return val | int64(o1), noExtReloc, isOk
} else if (val>>24)&0x3b == 0x39 {
@@ -1066,7 +1066,7 @@
}
o1 := (uint32(t&0xfff) >> shift) << 10
if target.IsWindows() {
- val &= 0xffC003ff
+ val &^= 0xfff << 10
}
return val | int64(o1), noExtReloc, isOk
} else {
```

Change information

Commit message:
cmd/link: internal linking support for windows/arm64

The internal linker was missing some pieces to support windows/arm64.

Closes #75485
Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I5c18a47e63e09b8ae22c9b24832249b54f544b7e
Reviewed-by: Cherry Mui <cher...@google.com>
Reviewed-by: Michael Knyszek <mkny...@google.com>
Files:
  • M doc/next/5-toolchain.md
  • M src/cmd/dist/build.go
  • M src/cmd/dist/test.go
  • M src/cmd/link/internal/arm64/asm.go
  • M src/cmd/link/internal/ld/data.go
  • M src/cmd/link/internal/loadpe/ldpe.go
  • M src/internal/platform/supported.go
Change size: M
Delta: 7 files changed, 80 insertions(+), 21 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Michael Knyszek, +2 by Cherry Mui
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I5c18a47e63e09b8ae22c9b24832249b54f544b7e
Gerrit-Change-Number: 704295
Gerrit-PatchSet: 9
Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Than McIntosh <th...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages