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

Comments

Projects
None yet
6 participants
@rsc
Copy link
Contributor

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 label Jan 30, 2018

@randall77

This comment has been minimized.

Copy link
Contributor

commented Mar 24, 2018

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

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2018

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

This comment has been minimized.

Copy link

commented Apr 9, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Apr 10, 2018

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

runtime: use fixed TLS offsets on darwin/amd64 and darwin/386
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

This comment has been minimized.

Copy link

commented Apr 11, 2018

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

@randall77

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2018

No. Is there a reason you want it?

aarzilli added a commit to aarzilli/delve that referenced this issue Apr 14, 2018

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
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

proc: correctly set G struct offset for 1.11
The offset of G changed in go1.11 from 0x8a0 to 0x30. See:
golang/go#23617

derekparker added a commit to go-delve/delve that referenced this issue Jun 11, 2018

proc: correctly set G struct offset for 1.11
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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.