]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: fix darwin build
authorRuss Cox <rsc@golang.org>
Wed, 14 Aug 2013 16:57:05 +0000 (12:57 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 14 Aug 2013 16:57:05 +0000 (12:57 -0400)
The TLS block on Darwin is not the same as on ELF.

TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12741044

src/cmd/dist/buildruntime.c
src/cmd/ld/data.c
src/cmd/ld/lib.c

index 287ec86f580877f50249cb5ac976c0259fc63d86..62ec8b60e5df62c308c1a6aff0ccc4551b2f1984 100644 (file)
@@ -166,17 +166,16 @@ static struct {
        // If the linker is not outputting a shared library, it will reduce
        // the TLS accessors to the local exec model, effectively removing
        // get_tls().
-       {"amd64", "",
-               "// The offsets 0 and 8 are known to:\n"
-               "//     ../../cmd/6l/pass.c:/D_GS\n"
-               "//     cgo/gcc_linux_amd64.c:/^threadentry\n"
-               "//     cgo/gcc_darwin_amd64.c:/^threadentry\n"
-               "//\n"
+       {"amd64", "linux",
                "#define        get_tls(r) MOVQ runtime·tlsgm(SB), r\n"
                "#define        g(r) 0(r)(GS*1)\n"
                "#define        m(r) 8(r)(GS*1)\n"
        },
-       
+       {"amd64", "",
+               "#define get_tls(r)\n"
+               "#define g(r) 0(GS)\n"
+               "#define m(r) 8(GS)\n"
+       },      
        {"arm", "",
        "#define        LR      R14\n"
        },
index db2ac0f460ee1ddf9d4f84c269f6f03bc0fe9c51..a1c31128aae25ddbfe1ba64c48a51ff677ac4a38 100644 (file)
@@ -1212,7 +1212,7 @@ dodata(void)
                diag("data or bss segment too large");
        }
        
-       if(iself && linkmode == LinkExternal && s != nil && s->type == STLSBSS && HEADTYPE != Hopenbsd) {
+       if(iself && linkmode == LinkExternal && s != nil && s->type == STLSBSS && iself && HEADTYPE != Hopenbsd) {
                sect = addsection(&segdata, ".tbss", 06);
                sect->align = PtrSize;
                sect->vaddr = 0;
index 5eab2c70f8464f6a8136393594493798de133388..3e8d49adaf4a0211a10f4a01fdcf9e6fa9fd1027 100644 (file)
@@ -360,16 +360,17 @@ loadlib(void)
                                } else
                                        s->type = 0;
                        }
-       } 
+       }
+       
        gmsym = lookup("runtime.tlsgm", 0);
        gmsym->type = STLSBSS;
        gmsym->size = 2*PtrSize;
        gmsym->hide = 1;
-       if(linkmode == LinkExternal)
+       if(linkmode == LinkExternal && iself && HEADTYPE != Hopenbsd)
                gmsym->reachable = 1;
        else
                gmsym->reachable = 0;
-       
+
        // Now that we know the link mode, trim the dynexp list.
        x = CgoExportDynamic;
        if(linkmode == LinkExternal)