diff --git a/src/cmd/internal/ld/data.go b/src/cmd/internal/ld/data.go index 13a4019888c..5a0ac9e7df3 100644 --- a/src/cmd/internal/ld/data.go +++ b/src/cmd/internal/ld/data.go @@ -372,6 +372,14 @@ func relocsym(s *LSym) { } case obj.R_TLS: + if Linkmode == LinkExternal && Iself && HEADTYPE != obj.Hopenbsd { + r.Done = 0 + r.Sym = Ctxt.Tlsg + r.Xsym = Ctxt.Tlsg + r.Xadd = r.Add + o = r.Add + break + } if Linkmode == LinkInternal && Iself && Thearch.Thechar == '5' { // On ELF ARM, the thread pointer is 8 bytes before // the start of the thread-local data block, so add 8