-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Go and llvm > 14.0.0 #183
Comments
I have not had time to look into this. If you can reproduce this outside of bazel with a simple example, maybe file a bug with the Go team. I can look into this more if it is only happening when using this toolchain. |
To add context, the errors I'm seeing are only on Linux and happen at runtime when running go_tests that have cgo dependencies. The error messages are like:
And I'm seeing this with LLVM 15.0.6. |
Looks like maybe the problem is Is there any code in this repo that controls that flag? |
I think I would need an example cgo program compiled with LLVM 15.0.6 that runs to completion when not using this bazel toolchain configuration, but crashes when we use it. I can backtrack from there to see what we are doing different in this toolchain. |
Looks like with Go 1.20, even LLVM 14 is not working. I was also able to reproduce the original issue with LLVM 15. I will try to look into this at some point. |
Was able to give a little bit of time today to this. I suspect this is because we use LLD and not gold. When I switched to gold in this repo, the Go targets worked fine. I will work on this a little more to ensure we make it easy for people to opt out of LLD. |
A few more hints. LLD in general is fine, but not with Was able to reproduce the crashes on a pristine rules_go repo with:
|
c217c03 shows that |
thanks @siddharthab ! I tried real quick and thinks run a lot better. I am happy to use the workaround. |
If someone can repro this without bazel (just with the |
Standard Go toolchain works fine with -fPIC and -pie and LLD. I am going to open an issue in rules_go because I think it has to do with how they make stdlib. |
OK so if we are forcing PIC, then linkmode needs to be set as "pie" in the go_binary target to set the other flags correctly. I think it makes sense. I think it may be a coincidence that this problem does not happen with gold. I submitted bazel-contrib/rules_go#3691 with more details, but I don't think there is much to do here. I will now check why rules_go is picking up -pie from this toolchain to add to -extldflags. |
Alright, I have the full story now. LLVM switched to always building with PIE, starting with v15; gcc had been doing it for some time. Go toolchain, knowing this, actively provides the But to check if the flag is accepted by the linker, it first runs a dummy linker command in a temporary directory. Which means relative paths to the linker will not work. This will be a problem for any hermetic toolchain like ours. Sent bazel-contrib/rules_go#3692 for supporting Go versions older than 1.21. |
Hi all,
I was curious about the comment here: https://github.com/grailbio/bazel-toolchain/blob/master/tests/WORKSPACE#L60
I've been hitting this w/
15.0.6
and getting hard crashes in simple-ish go programs. Do you know what the issue is and why >14.0.0
doesn't work?The text was updated successfully, but these errors were encountered: