diff options
| author | Shenghou Ma <minux@golang.org> | 2015-02-06 02:05:30 -0500 |
|---|---|---|
| committer | Minux Ma <minux@golang.org> | 2015-02-09 22:14:06 +0000 |
| commit | 06611434479daf7d27bd2cd69d10be7d4cb5cd61 (patch) | |
| tree | 90328b891100524a25de75cf446b734629f51c90 /src/liblink | |
| parent | 04ce9dbf355a5d1b2e0b979d02f16ef2bf83833f (diff) | |
| download | go-06611434479daf7d27bd2cd69d10be7d4cb5cd61.tar.xz | |
liblink, runtime: move all references to runtime.tlsg to tls_arm.s
CL 2118 makes the assumption that all references to runtime.tlsg
should be accompanied by a declaration of runtime.tlsg if its type
should be a normal variable, instead of a placeholder for TLS
relocation.
Because if runtime.tlsg is not declared by the runtime package,
the type of runtime.tlsg will be zero, so fix the check in liblink
to look for 0 instead of STLSBSS (the type will be initialized by
cmd/ld, but cmd/ld doesn't run during assembly).
Change-Id: I691ac5c3faea902f8b9a0b963e781b22e7b269a7
Reviewed-on: https://go-review.googlesource.com/4030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/liblink')
| -rw-r--r-- | src/liblink/asm5.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/liblink/asm5.c b/src/liblink/asm5.c index 7b4ac47e85..3947a571e5 100644 --- a/src/liblink/asm5.c +++ b/src/liblink/asm5.c @@ -1638,9 +1638,11 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na // runtime.tlsg is special. // Its "address" is the offset from the TLS thread pointer // to the thread-local g and m pointers. - // Emit a TLS relocation instead of a standard one if it's - // typed STLSBSS. - if(rel->sym == ctxt->tlsg && ctxt->tlsg->type == STLSBSS) { + // Emit a TLS relocation instead of a standard one if its + // type is not explicitly set by runtime. This assumes that + // all references to runtime.tlsg should be accompanied with + // its type declaration if necessary. + if(rel->sym == ctxt->tlsg && ctxt->tlsg->type == 0) { rel->type = R_TLS; if(ctxt->flag_shared) rel->add += ctxt->pc - p->pcrel->pc - 8 - rel->siz; |
