-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go test -compiler gccgo produces duplicate symbol errors #7627
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
Labels
Milestone
Comments
Here is what I *think* is happening, Under -compiler gc, the _test.go files are combined with the normal files for the package under test and placed into a .a file in $WORK, then everything is linked together /home/dfc/go/pkg/tool/linux_amd64/6l -o $WORK/issue/a/_test/a.test -L $WORK/issue/a/_test -L $WORK -L /home/dfc/pkg/linux_amd64 -w -extld=clang $WORK/issue/a/_test/main.a $WORK/issue/a/_test/a.test you can see that -L $WORK/issue/a/_test comes before -L $WORK so all the symbols for issue/a will be taken from the temporary test .a file in $WORK/issue/a/_test. But, under -compiler gccgo we see gccgo -o $WORK/issue/a/_test/a.test $WORK/issue/a/_test/main.o -Wl,-( -m64 $WORK/issue/a/_test/issue/liba_test.a $WORK/issue/libb.a $WORK/issue/liba.a $WORK/issue/a/_test/issue/liba.a -Wl,-) specifically $WORK/issue/liba.a appears before $WORK/issue/a/_test/issue/liba.a so the linker lodas issue/liba.a but can't find all the symbols it needs, so falls through to _test/issue/liba.a which has the additional test related symbols, but also has symbols that were previously discovered in the previous liba.a. This is all just speculation, I don't know how /usr/bin/ld does it's symbol resolution, but it would make sense to defer opening a library until it's know that none of the previous libraries had all the symbols you needed. The solution would appear to be, make sure that _test/issue/liba.a comes first in the linking order as it does with -compiler gc |
https://golang.org/cl/80300043/ Owner changed to @davecheney. Status changed to Started. |
This issue was closed by revision 3ce1677. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Attachments:
The text was updated successfully, but these errors were encountered: