cmd/8l, cmd/internal/ld, cmd/internal/obj/x86: stop incorrectly using the term "inital exec"

The long comment block in obj6.go:progedit talked about the two code sequences
for accessing g as "local exec" and "initial exec", but really they are both forms
of local exec. This stuff is confusing enough without using the wrong words for
things, so rewrite it to talk about 2-instruction and 1-instruction sequences.
Unfortunately the confusion has made it into code, with the R_TLS_IE relocation
now doing double duty as meaning actual initial exec when externally linking and
boring old local exec when linking internally (half of this is my fault). So this
stops using R_TLS_IE in the local exec case. There is a chance this might break
plan9 or windows, but I don't think so. Next step is working out what the heck is
going on on ARM...

Change-Id: I09da4388210cf49dbc99fd25f5172bbe517cee57
Reviewed-on: https://go-review.googlesource.com/9273
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-04-23 21:53:48 +12:00 committed by Ian Lance Taylor
parent ada8cdb9f6
commit 264858c46e
5 changed files with 50 additions and 31 deletions

View file

@ -380,8 +380,23 @@ const (
R_CALLPOWER
R_CONST
R_PCREL
// R_TLS (only used on arm currently, and not on android and darwin where tlsg is
// a regular variable) resolves to data needed to access the thread-local g. It is
// interpreted differently depending on toolchain flags to implement either the
// "local exec" or "inital exec" model for tls access.
// TODO(mwhudson): change to use R_TLS_LE or R_TLS_IE as appropriate, not having
// R_TLS do double duty.
R_TLS
// R_TLS_LE (only used on 386 and amd64 currently) resolves to the offset of the
// thread-local g from the thread local base and is used to implement the "local
// exec" model for tls access (r.Sym is not set by the compiler for this case but
// is set to Tlsg in the linker when externally linking).
R_TLS_LE
// R_TLS_IE (only used on 386 and amd64 currently) resolves to the PC-relative
// offset to a GOT slot containing the offset the thread-local g from the thread
// local base and is used to implemented the "initial exec" model for tls access
// (r.Sym is not set by the compiler for this case but is set to Tlsg in the
// linker when externally linking).
R_TLS_IE
R_GOTOFF
R_PLT0