]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: always mark tlsg STLSBSS
authorDavid Crawshaw <crawshaw@golang.org>
Fri, 13 Feb 2015 19:52:07 +0000 (14:52 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 13 Feb 2015 21:27:21 +0000 (21:27 +0000)
Android apps build again.

Defining TLSG in runtime/tls_arm.s gives it the type SNOPTRBSS, so its
type was never being set when GOOS=android. I considered modifying the
if statement, but I no longer understand the intention of the original
change (in d738c6b0cad). We were always setting it before, what
platform is this not valid for?

Fixes #9829

Change-Id: I3eaa4a9590893eff67695797eb22547a170cdbcd
Reviewed-on: https://go-review.googlesource.com/4834
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

src/cmd/ld/lib.c

index 72c903b4d2c229d64d571bf885a7b0c24d4bd67c..200c96da9665d36ae7882aacbcb630adb6fd01a0 100644 (file)
@@ -269,11 +269,13 @@ loadlib(void)
        
        tlsg = linklookup(ctxt, "runtime.tlsg", 0);
        // For most ports, runtime.tlsg is a placeholder symbol for TLS
-       // relocation. However, the Android and Darwin ports need it to
-       // be a real variable. Instead of hard-coding which platforms
-       // need it to be a real variable, we set the type to STLSBSS only
-       // when the runtime has not declared its type already.
-       if(tlsg->type == 0)
+       // relocation. However, the Android and Darwin arm ports need it
+       // to be a real variable.
+       //
+       // TODO(crawshaw): android should require leaving the tlsg->type
+       // alone (as the runtime-provided SNOPTRBSS) just like darwin/arm.
+       // But some other part of the linker is expecting STLSBSS.
+       if (!(strcmp(goos, "darwin") == 0 && thearch.thechar == '5'))
                tlsg->type = STLSBSS;
        tlsg->size = thearch.ptrsize;
        tlsg->hide = 1;