]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: when dynamic linking, reject code that uses a clobbered R15
authorKeith Randall <khr@golang.org>
Wed, 13 Jan 2021 23:45:28 +0000 (15:45 -0800)
committerKeith Randall <khr@golang.org>
Tue, 16 Mar 2021 21:18:43 +0000 (21:18 +0000)
commitc870e863298a44ead08e0b797d62ea74d7b7c971
tree6b11ed84c5443f6a9e36bcc920930bf7cfb12a69
parent72d98df88e3cbbbe482f7d421c6fd5cbd84423b4
cmd/asm: when dynamic linking, reject code that uses a clobbered R15

The assember uses R15 as scratch space when assembling global variable
references in dynamically linked code. If the assembly code uses the
clobbered value of R15, report an error. The user is probably expecting
some other value in that register.

Getting rid of the R15 use isn't very practical (we could save a
register to a field in the G maybe, but that gets cumbersome).

Fixes #43661

Change-Id: I43f848a3d8b8a28931ec733386b85e6e9a42d8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/283474
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/asm/internal/asm/endtoend_test.go
src/cmd/asm/internal/asm/testdata/amd64dynlinkerror.s [new file with mode: 0644]
src/cmd/internal/obj/link.go
src/cmd/internal/obj/plist.go
src/cmd/internal/obj/x86/obj6.go