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/go: rpath should only be used when linking shared objects or executables #12115
Comments
It's also possible that this is just a symptom of the cgo tool indiscriminately applying LDFLAGS at different parts of the build process and the test itself is "correct". I haven't investigated further yet. |
So after further investigation, I've come to the conclusion that the real issue is not so much the test, as the fact that there seems to be no way to control when and how LDFLAGS are applied during the build process. Some flags should only be applied when performing the linking step for a shared library or executable, etc. In other contexts, they're either invalid, or meaningless to apply (so should not be specified). Go already manipulates the linker flags used depending on context, so perhaps something like this is sufficient:
However, it seems like there's a larger issue -- namely, that Go should likely offer finer control over when LDFLAGS are applied. I welcome any feedback or suggestions others might have. |
CL https://golang.org/cl/14674 mentions this issue. |
The TestCgoHandlesWlORIGIN test found in src/cmd/go/go_test.go fails on Solaris:
Relocatable objects, which come from the compiler, or which are created with 'ld -r', aren't loadable
objects on their own. It doesn't make sense to give such a "non-final" object a runpath, so ld(1) on Solaris exits with an error message.
If this test were reworked for say, an executable or a shared library, then that would make more sense.
The text was updated successfully, but these errors were encountered: