]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/x86: position independent access to global data on 386 when -shared
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Tue, 17 Nov 2015 23:14:07 +0000 (12:14 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 18 Nov 2015 21:26:42 +0000 (21:26 +0000)
commitcb0393866a3da53e9455459b1daafcd278731afe
tree1d3eb63e5936c52bfa49539d8876437223b469fe
parent3c85e1b186a1b0c153678e3e85ff5819a430dd84
cmd/internal/obj/x86: position independent access to global data on 386 when -shared

This works by adding a call to __x86.get_pc_thunk.cx immediately before any
instruction that accesses global data and then assembling the instruction to
use the appropriate offset from CX instead of the absolute address. Some forms
cannot be assembled that way and are rewritten to load the address into CX
first.

-buildmode=pie works now, but is not yet tested.

Fixes #13201 (I think)

Change-Id: I32a8561e7fc9dd4ca6ae3b0e57ad78a6c50bf1f5
Reviewed-on: https://go-review.googlesource.com/17014
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/obj/x86/asm6.go
src/cmd/internal/obj/x86/obj6.go