]> Cypherpunks repositories - gostls13.git/commit
cmd/link, runtime: apply a delta to RODATA->DATA relocations
authorCherry Mui <cherryyz@google.com>
Sat, 21 Dec 2024 03:33:15 +0000 (22:33 -0500)
committerCherry Mui <cherryyz@google.com>
Mon, 23 Dec 2024 17:49:40 +0000 (09:49 -0800)
commitb9955f0ad952a22388eead15e3d15610a29e03a0
tree526a1aba7737728a179f7208b0c1699af5b84435
parenteef35e3bd989afcbf4141a570d933ff05b866504
cmd/link, runtime: apply a delta to RODATA->DATA relocations

On AIX, an R_ADDR relocation from an RODATA symbol to a DATA
symbol does not work, as the dynamic loader can change the address
of the data section, and it is not possible to apply a dynamic
relocation to RODATA. In order to get the correct address, we
apply the delta between unrelocated and relocated data section
addresses at run time. The linker saves both the unrelocated and
the relocated addresses, so we can compute the delta.

This is possible because RODATA symbols are generated by the
compiler and so we have full control of. On AIX, the only case
is the on-demand GC pointer masks from the type descriptors, for
very large types.

Perhaps there is a better way.

Fixes #70483.

Change-Id: I2664c0a813b38f7b146794cb1e73ccf5e238ca65
Reviewed-on: https://go-review.googlesource.com/c/go/+/638016
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/symtab.go
src/runtime/symtab.go
src/runtime/type.go