Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: use %gs:0x30 for TLS on macOS #23617

Closed
rsc opened this issue Jan 30, 2018 · 6 comments
Closed

runtime: use %gs:0x30 for TLS on macOS #23617

rsc opened this issue Jan 30, 2018 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jan 30, 2018

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.

@rsc rsc added this to the Go1.11 milestone Jan 30, 2018
@rsc rsc self-assigned this Jan 30, 2018
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 30, 2018
@randall77
Copy link
Contributor

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.

@ianlancetaylor
Copy link
Contributor

Apple has committed that we can use the 0x30 offset for amd64, on the assumption that we will never link Go and Windows code together while running on Darwin.

I sent an e-mail asking about the other platforms.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/105975 mentions this issue: runtime: use fixed TLS offsets on darwin/amd64 and darwin/386

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/106156 mentions this issue: runtime: use fixed TLS offsets on darwin/amd64 and darwin/386

gopherbot pushed a commit that referenced this issue Apr 11, 2018
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 <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@toffaletti
Copy link

Any plans for this change to make it into 1.10.x?

@randall77
Copy link
Contributor

No. Is there a reason you want it?

aarzilli added a commit to aarzilli/delve that referenced this issue Apr 14, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 14, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 19, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 19, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 19, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 3, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 8, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 14, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 17, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 21, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 23, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 24, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 25, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue May 25, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
aarzilli added a commit to aarzilli/delve that referenced this issue Jun 11, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
derekparker pushed a commit to go-delve/delve that referenced this issue Jun 11, 2018
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617
@golang golang locked and limited conversation to collaborators Apr 11, 2019
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants