aboutsummaryrefslogtreecommitdiff
path: root/src/liblink/obj6.c
diff options
context:
space:
mode:
authorAram Hăvărneanu <aram@mgk.ro>2014-07-02 21:04:10 +1000
committerDave Cheney <dave@cheney.net>2014-07-02 21:04:10 +1000
commitdecd810945e22642df5db99a616af3cc5d53bf8d (patch)
tree6e00d4d3dd2f395c7ec89bf945481c81206325a2 /src/liblink/obj6.c
parentd7b678b2ca26928390078c29e3f71868e867a182 (diff)
downloadgo-decd810945e22642df5db99a616af3cc5d53bf8d.tar.xz
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://golang.org/cl/101510049
Diffstat (limited to 'src/liblink/obj6.c')
-rw-r--r--src/liblink/obj6.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/liblink/obj6.c b/src/liblink/obj6.c
index d83f847851..a8538c9ecf 100644
--- a/src/liblink/obj6.c
+++ b/src/liblink/obj6.c
@@ -103,7 +103,7 @@ static int
canuselocaltls(Link *ctxt)
{
switch(ctxt->headtype) {
-// case Hlinux:
+ case Hplan9:
case Hwindows:
return 0;
}
@@ -402,6 +402,10 @@ addstacksplit(Link *ctxt, LSym *cursym)
for(i=0; i<nelem(morename); i++)
ctxt->symmorestack[i] = linklookup(ctxt, morename[i], 0);
}
+
+ if(ctxt->headtype == Hplan9 && ctxt->plan9privates == nil)
+ ctxt->plan9privates = linklookup(ctxt, "_privates", 0);
+
ctxt->cursym = cursym;
if(cursym->text == nil || cursym->text->link == nil)