From 0fbf0955d4973cc188c38a8218563577845eccb2 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 19 Nov 2015 22:14:13 +1300 Subject: [PATCH] cmd/internal/obj/x86: still use (fake) local exec TLS mode on android/386 golang.org/cl/16383 broke android/386 because by a sort of confluence of hacks no TLS relocations were emitted at all when Flag_shared != 0. The hack in runtime/cgo works as well in a PIE executable as it does with a position dependent one, so the simplest fix is to still emit a R_TLS_LE reloc when goos == "android". A real fix is to use something more like the IE model code but loading the offset from %gs to the thread local storage from a global variable rather than from a location chosen by the system linker (this is how android/arm works). Issue #9327. Change-Id: I9fbfc890ec7fe191f80a595b6cf8e2a1fcbe3034 Reviewed-on: https://go-review.googlesource.com/17049 Reviewed-by: Hyang-Ah Hana Kim --- src/cmd/internal/obj/x86/asm6.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go index 04ef3b343f..ed728aa727 100644 --- a/src/cmd/internal/obj/x86/asm6.go +++ b/src/cmd/internal/obj/x86/asm6.go @@ -2536,7 +2536,7 @@ func vaddr(ctxt *obj.Link, p *obj.Prog, a *obj.Addr, r *obj.Reloc) int64 { log.Fatalf("reloc") } - if ctxt.Flag_shared == 0 { + if ctxt.Flag_shared == 0 || isAndroid { r.Type = obj.R_TLS_LE r.Siz = 4 r.Off = -1 // caller must fill in -- 2.48.1