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: provide a way to always use external linking if cgo is used #43525

Open
mwhudson opened this issue Jan 5, 2021 · 3 comments
Open

cmd/link: provide a way to always use external linking if cgo is used #43525

mwhudson opened this issue Jan 5, 2021 · 3 comments

Comments

@mwhudson
Copy link
Contributor

@mwhudson mwhudson commented Jan 5, 2021

This came up as a potential solution for #43505 but I've wanted it for other reasons too (mostly because of other tools like patchelf that rely on implementation details of more common linkers): I would like a way to always use external linking if cgo is used, or to put it another way, never use internal linking to generate a dynamically linked binary. -linkmode and GO_EXTLINK_ENABLED control aspects of this behaviour but can't be used to get what I want.

@toothrot
Copy link
Contributor

@toothrot toothrot commented Jan 8, 2021

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jan 11, 2021

Could you explain why -linkmode=external doesn't do what you want? It will use external linking even if cgo is not used, but that doesn't seem a big problem.

@mwhudson
Copy link
Contributor Author

@mwhudson mwhudson commented Jan 11, 2021

If you always external link, you always get a dynamic executable. I wouldn't mind that, but I thinks some other people might.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants