]> Cypherpunks repositories - gostls13.git/commit
cmd/link: also apply R_ADDR relocation statically when internal linking PIE
authorCherry Zhang <cherryyz@google.com>
Tue, 11 Feb 2020 23:26:38 +0000 (18:26 -0500)
committerCherry Zhang <cherryyz@google.com>
Fri, 21 Feb 2020 22:30:06 +0000 (22:30 +0000)
commitd532d5f0fade2630612a5bdb0ac3f95824266ad5
tree356638aa8c13621f1ec39190cdb636855b5bdba8
parent240498d63551d0a58a71d5ada457c73a71983a7c
cmd/link: also apply R_ADDR relocation statically when internal linking PIE

When internal linking PIE, R_ADDR relocations cannot be resolved
statically so we generate dynamic relocations for it. We don't
apply the relocations statically, so the bytes in the file are
left unset (likely zero). This makes some tool that examines the
file statically, e.g. go version, to fail to find the referenced
addresses.

This CL makes the linker also apply the relocations to the file
content, so it holds the correct offsets and so can be examined
statically.

Fixes #37173.

Change-Id: Ia5c6b661f1a91a232843ca4224264bfd7a5509eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/219199
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/testdata/script/version.txt
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/arm64/asm.go