diff options
author | Aram H?v?rneanu <aram@mgk.ro> | 2014-07-02 21:04:10 +1000 |
---|---|---|
committer | Aram H?v?rneanu <aram@mgk.ro> | 2014-07-02 21:04:10 +1000 |
commit | 3d9435eece80a6811eac36716fdee006e64e1e39 (patch) | |
tree | b191584807212265c9f7d5d21c4667d9f484f794 /src/liblink/asm6.c | |
parent | b4eb43d41eb0e161b0b77e21e44f8788a6c85207 (diff) | |
download | go-3d9435eece80a6811eac36716fdee006e64e1e39.tar.gz |
liblink, runtime: preliminary support for plan9/amd64
A TLS slot is reserved by _rt0_.*_plan9 as an automatic and
its address (which is static on Plan 9) is saved in the
global _privates symbol. The startup linkage now is exactly
like that from Plan 9 libc, and the way we access g is
exactly as if we'd have used privalloc(2).
Aside from making the code more standard, this change
drastically simplifies it, both for 386 and for amd64, and
makes the Plan 9 code in liblink common for both 386 and
amd64.
The amd64 runtime code was cleared of nxm assumptions, and
now runs on the standard Plan 9 kernel.
Note handling fixes will follow in a separate CL.
LGTM=rsc
R=golang-codereviews, rsc, bradfitz, dave
CC=0intro, ality, golang-codereviews, jas, minux.ma, mischief
https://codereview.appspot.com/101510049
Committer: Dave Cheney <dave@cheney.net>
Diffstat (limited to 'src/liblink/asm6.c')
-rw-r--r-- | src/liblink/asm6.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/liblink/asm6.c b/src/liblink/asm6.c index 66afc7a12..751c97215 100644 --- a/src/liblink/asm6.c +++ b/src/liblink/asm6.c @@ -1901,7 +1901,6 @@ prefixof(Link *ctxt, Addr *a) case Hlinux: case Hnetbsd: case Hopenbsd: - case Hplan9: case Hsolaris: return 0x64; // FS case Hdarwin: @@ -3365,6 +3364,19 @@ mfound: default: sysfatal("unknown TLS base location for %s", headstr(ctxt->headtype)); + case Hplan9: + if(ctxt->plan9privates == nil) + ctxt->plan9privates = linklookup(ctxt, "_privates", 0); + memset(&pp.from, 0, sizeof pp.from); + pp.from.type = D_EXTERN; + pp.from.sym = ctxt->plan9privates; + pp.from.offset = 0; + pp.from.index = D_NONE; + ctxt->rexflag |= Pw; + *ctxt->andptr++ = 0x8B; + asmand(ctxt, &pp.from, &p->to); + break; + case Hsolaris: // TODO(rsc): Delete Hsolaris from list. Should not use this code. See progedit in obj6.c. // TLS base is 0(FS). pp.from = p->from; |