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/race: eliminate dependency on cmd/cgo #6508

Open
dvyukov opened this issue Sep 28, 2013 · 7 comments

Comments

@dvyukov
Copy link
Member

commented Sep 28, 2013

There is a circular dependency between runtime/race and cmd/cgo in -race build.
Everything depends on runtime/race, but runtime/race is a cgo package.
Currently it's resolved by a hack in go tool:

    // If we are not doing a cross-build, then record the binary we'll
    // generate for cgo as a dependency of the build of any package
    // using cgo, to make sure we do not overwrite the binary while
    // a package is using it.  If this is a cross-build, then the cgo we
    // are writing is not the cgo we need to use.
    if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace {

We pretend that packages do not depend on cmd/cgo. But as the result we can overwrite
cmd/cgo binary while it is used.

A better solution is to make runtime/race to be not dependent on cmd/cgo.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 1:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 2:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 3:

Labels changed: added repo-main.

@dvyukov

This comment has been minimized.

Copy link
Member Author

commented Mar 6, 2014

Comment 4:

This issue was updated by revision a1695d2.

Update issue #6688
R=iant, rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/55100044
@odeke-em

This comment has been minimized.

Copy link
Member

commented Dec 23, 2017

Gentle ping @dvyukov @ianlancetaylor how are we doing here? Is this issue still a concern? Could I be of help here with your guidance?

@dvyukov

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2017

This is still an issue. Fixing it will require wiping all dependencies on libc from race runtime. I've removed the main one -- on malloc/free -- some time ago, but there are still some minor ones.
If we eliminate dependency on libc/cgo, it will also allow using -race without enabling cgo, which would be nice as well.
But nobody actively complained about this as far as I know, so this was never high on my list.

@odeke-em

This comment has been minimized.

Copy link
Member

commented Dec 23, 2017

Gotcha gotcha, thanks @dvyukov! Oh right, you opened #9918 which is still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.