[go] cmd/link: simplify PE relocations mapping

0 views
Skip to first unread message

Quim Muntal (Gerrit)

unread,
Sep 17, 2025, 1:23:44 AM (yesterday) Sep 17
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, Cherry Mui, Go LUCI, golang-co...@googlegroups.com

Quim Muntal submitted the change

Change information

Commit message:
cmd/link: simplify PE relocations mapping

The code for mapping Windows PE relocations to Go relocations was
difficult to follow and contains some duplicated code. Also, it was
mapping IMAGE_REL_AMD64_ADDR32 to R_PCREL instead of R_ADDR.

This CL commit simplifies the code and fixes the mapping. I haven't been
able to coerce mingw-w64 to generate IMAGE_REL_AMD64_ADDR32 relocations,
so I haven't been able to test this change. However, the previous
implementation was clearly wrong.

While here, remove code supporting the unsupported windows/arm support.

Updates #71671
Updates #75485
Change-Id: Id0d6f352fa7d5df9e00509fcdf09ca0cb91ca524
Reviewed-by: Michael Knyszek <mkny...@google.com>
Reviewed-by: Cherry Mui <cher...@google.com>
Files:
  • M src/cmd/link/internal/loadpe/ldpe.go
Change size: M
Delta: 1 file changed, 37 insertions(+), 73 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Cherry Mui, +1 by Michael Knyszek
  • 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: Id0d6f352fa7d5df9e00509fcdf09ca0cb91ca524
Gerrit-Change-Number: 672155
Gerrit-PatchSet: 5
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>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages