cmd/internal/ld: fix R_TLS handling now Xsym is not read from object … · golang/go@ccc76db (original) (raw)

Original file line number Diff line number Diff line change
@@ -372,6 +372,14 @@ func relocsym(s *LSym) {
372 372 }
373 373
374 374 case obj.R_TLS:
375 +if Linkmode == LinkExternal && Iself && HEADTYPE != obj.Hopenbsd {
376 +r.Done = 0
377 +r.Sym = Ctxt.Tlsg
378 +r.Xsym = Ctxt.Tlsg
379 +r.Xadd = r.Add
380 +o = r.Add
381 +break
382 + }
375 383 if Linkmode == LinkInternal && Iself && Thearch.Thechar == '5' {
376 384 // On ELF ARM, the thread pointer is 8 bytes before
377 385 // the start of the thread-local data block, so add 8