go/misc
Ian Lance Taylor 30e29ee9b6 cmd/ld: emit TLS relocations during external linking
This CL was written by rsc.  I just tweaked 8l.

This CL adds TLS relocation to the ELF .o file we write during external linking,
so that the host linker (gcc) can decide the final location of m and g.

Similar relocations are not necessary on OS X because we use an alternate
program start-time mechanism to acquire thread-local storage.

Similar relocations are not necessary on ARM or Plan 9 or Windows
because external linking mode is not yet supported on those systems.

On almost all ELF systems, the references we use are like %fs:-0x4 or %gs:-0x4,
which we write in 6a/8a as -0x4(FS) or -0x4(GS). On Linux/ELF, however,
Xen's lack of support for this mode forced us long ago to use a two-instruction
sequence: first we load %gs:0x0 into a register r, and then we use -0x4(r).
(The ELF program loader arranges that %gs:0x0 contains a regular pointer to
that same memory location.) In order to relocate those -0x4(r) references,
the linker must know where they are. This CL adds the equivalent notation
-0x4(r)(GS*1) for this purpose: it assembles to the same encoding as -0x4(r)
but the (GS*1) indicates to the linker that this is one of those thread-local
references that needs relocation.

Thanks to Elias Naur for reminding me about this missing piece and
also for writing the test.

R=r
CC=golang-dev
https://golang.org/cl/7891047
2013-03-27 13:27:35 -07:00
..
arm arm: add gdb support to android launcher script 2010-07-30 10:35:07 +03:00
bash misc/bash: Completion for go tool. 2012-02-28 07:41:49 +11:00
bbedit misc/bbedit, misc/notepadplus: remove executable bits from files. 2013-03-12 14:29:25 -07:00
cgo cmd/ld: emit TLS relocations during external linking 2013-03-27 13:27:35 -07:00
chrome/gophertool gophertool: fix links 2012-10-22 01:05:21 +08:00
dashboard misc/dashboard: show correct dir name in README 2013-03-19 12:49:46 -07:00
dist misc/dist: fix Windows breakage 2013-03-18 08:56:38 +11:00
emacs misc/emacs: Derive mode from prog-mode if possible 2013-03-25 08:58:13 -07:00
fraise misc: update type + builtin lists found in editor support files 2011-01-19 23:07:49 -05:00
git misc/git: add gofmt git pre-commit hook 2012-11-15 19:58:49 +01:00
goplay cmd/godoc: use go/build to determine package and example files 2013-02-19 11:19:58 -08:00
IntelliJIDEA misc: syntax highlighting support on IntelliJ IDEA 2011-05-20 11:03:33 -07:00
kate misc/kate: fix multiline raw string syntax highlighting error. 2013-03-23 15:16:58 -07:00
notepadplus misc/bbedit, misc/notepadplus: remove executable bits from files. 2013-03-12 14:29:25 -07:00
swig misc/swig: remove old broken Makefile 2013-03-20 08:06:58 -07:00
vim misc/vim: make Godoc command work with "log.Print". 2013-03-26 17:39:46 +11:00
xcode misc/xcode: fix typos 2012-03-05 15:50:48 -08:00
zsh testing: change -test.benchtime to a flag.Duration. 2012-10-09 08:57:29 +11:00
benchcmp misc/benchcmp: show byte allocation statistics 2012-12-22 14:51:16 -05:00
pprof misc/pprof: fix address lookup regression on Linux 2013-03-13 09:40:38 -07:00