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

cmd/link: default to internal linking mode for PIE #35545

cherrymui opened this issue Nov 12, 2019 · 3 comments

cmd/link: default to internal linking mode for PIE #35545

cherrymui opened this issue Nov 12, 2019 · 3 comments


Copy link

@cherrymui cherrymui commented Nov 12, 2019

When using -buildmode=pie, we used to default to internal linking mode. Then we forced external linking because internal linking was found broken. Then we fixed internal linking, but still default to external linking.

As far as I know, internal linking PIE works reasonably well, at least on Linux/AMD64 and Linux/ARM64. We may want to change the default back to internal linking mode.

@cherrymui cherrymui added this to the Go1.15 milestone Nov 12, 2019
@andybons andybons added the NeedsFix label Nov 13, 2019
Copy link

@gopherbot gopherbot commented Nov 19, 2019

Change mentions this issue: cmd/link: Revert -buildmode=pie to internal linking

Copy link

@prattmic prattmic commented Dec 6, 2019

I saw this after filing #36028. I don't think internal linking should be enabled PIE until that is fixed, unless I'm mistaking something and it's not a common problem.

Regardless, I just sent to fix that issue.

Copy link

@gopherbot gopherbot commented Feb 24, 2020

Change mentions this issue: cmd/link: improve gap detection in TestPIESize

gopherbot pushed a commit that referenced this issue Feb 25, 2020
In CL 210180 we detect gaps between PT_LOAD segments and subtract
them from size calculation. The code there only works when
PT_LOAD segments are next to each other. But it is possible that
there are other segments in between (e.g. a GNU_RELRO segment).
Relax the gap detection to count gaps between PT_LOAD segments
regardless of whether they are next to each other.

Updates #36023.
Updates #35545.

Change-Id: I8b94506359fa649a4478acc742d86d4b16022dbc
Run-TryBot: Cherry Zhang <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Than McIntosh <>
Reviewed-by: Ian Lance Taylor <>
@gopherbot gopherbot closed this in b2696fd Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.