Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: use %gs:0x30 for TLS on macOS #23617
Per private email discussion with Anthony Chivetta of Apple, Go should stop guessing pthread offsets and instead hard-code 0x30 off %gs as the g register. That location is already reserved for WINE and Win64, so as long as we're not trying to run Win64 code linked into macOS binaries, all will be well.
Q: 0x30 for amd64? What about 386, arm, arm64?
Is there any way we can get Apple to commit this offset for Go? I understand it is currently reserved, but if they are willing to give it out to us they might also give it out to some other Foo project. Then a binary with both Go and Foo in it wouldn't work.
Fixes #23617 Note that this CL does not affect darwin/arm and darwin/arm64, still TBD what, if anything, needs to be done for those. This is a fix of CL 105975 which was reverted in CL 106155. Needed to use movl instead of movq for 386. Change-Id: I0db7f8087173869e60cc22c6c3124fa0a0739b46 Reviewed-on: https://go-review.googlesource.com/106156 Run-TryBot: Keith Randall <firstname.lastname@example.org> Reviewed-by: Ian Lance Taylor <email@example.com> Reviewed-by: Brad Fitzpatrick <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com>