-
Notifications
You must be signed in to change notification settings - Fork 18.1k
cmd/go: when compiling with gccgo uses go tool's ReleaseTags, not gccgo's #8851
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
Comments
Here is a fairly terrible patch (which is why it's in a pastebin and not a CL): http://paste.ubuntu.com/8475820/ It seems to work. Does this approach have any merit? It would make using -compiler gccgo to cross compile basically impossible, not sure what to do there (I mean, a correct fix might be for gccgo to grow a "-dumpbuildcontextinfo" flag?) |
That would certainly be simpler for the implementation, but it puts a significant burden on the user to keep track of which versions of Go the compiler supports, and supply the correct set of tags at every invocation. I would also consider it to be a regression in functionality; at least, at the moment, the set of release tags is roughly correct. I would much prefer if the "go" tool obtained this information automatically from the compiler. I propose that "go" request a set of compiler tags from "gccgo" toolchains by executing "$GCCGO -dumpgotags" and reading the tags from stdout. For backwards compatibility with existing versions of gccgo/llgo, the "go" tool's built-in set of compiler tags would continue to be used if the exit status is non-zero. https://golang.org/cl/167080043 implements this, and I will mail it after the go1.4 release. |
https://golang.org/cl/148770043/ is another issue that came up as a result of this version skew. |
Why do gccgo and llgo insist on trying to use a gc-toolchain-compiled go command in the first place? If you are using those compilers you should be using a go command built by them, and then the release tags will be right. All the complexity here seems misguided. |
Well indeed, that's become both clearer and easier over the last few months, so I think this issue can be closed. |
If users should always use a "go" tool built by the corresponding compiler, does the -compiler flag have any use still? |
I talked to @ianlancetaylor about this, and he pointed out that it is convenient for users to have one go command in their binary and be able to use the -compiler flag to flip between them for building their own code (the go command doesn't know anything about the gccgo standard library; this is only about $GOPATH). Given that, I do believe that as long as we have the -compiler we might as well get the release tags right. Ian and I talked about having a $GCCGOTAGS, but on reflection I don't think that's quite right either. Can we give gccgo and llgo the same option that means "print the Go release tags to use" and then just ask them, at roughly the same time we consult $GCCGO? This is actually close to what comment 2 suggested, but a built-in option seems much better than compiling and running a whole Go program. |
Too late for Go 1.5. |
There are other issues or missing function related to the use of the -compiler option on the go tool.
Seems like it would be better just to drop support for the -compiler option. If that was done then copies of the go tools for alternate compilers could be provided with distinct names, something like go.gccgo and go.llgo so it was clear which ones were being used. |
Does #28221 help with this issue? |
Release tags are handled by cmd/go. The The So, no, the Currently gccgo does not implement anything like the |
The text was updated successfully, but these errors were encountered: