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
misc/cgo/testtls: skip test if C toolchain exhibits known TLS bugs #24758
Comments
cc @FiloSottile Thanks for filing bugs for the flaky tests, @mvdan. Hope we get back to a stable dashboard soon. |
This is not my kind of TLS ;) it's Thread Local Storage. |
Hahaha. Oops. :P |
The faulting PC, 0xe56e4, is in C code getTLS:
Here, we just loaded R3=0x1c from the constant pool. The faulting address is 0x1b, which means R0=-1, which means __tls_get_addr returned -1. I haven't looked into what could cause it. Maybe the TLS was not initialized correctly? |
Wow — the last non-trivial change to this test was for issue #6992 back in 2014! |
@cherrymui, do you know who the right person to look into this further would be? |
I'll look into this (as soon as I can, maybe not this week though). |
First, I spent some time rediscovered what I found last year (#24758 (comment)). I should have read all the comments first... Then, by attaching strace I found that when the test passes the TLS accesses are made on the main thread, whereas when it fails the TLS accesses are made on a non-main thread. (at least for all the runs I investigated.) If I change the test so that it always run on a non-main thread, it fails 100%. The same change works fine on Linux/AMD64. On all the test logs, the failed one is the one with static linking (https://go.googlesource.com/go/+/refs/tags/go1.13/src/cmd/dist/test.go#1072). Here, we build the C code with The following C program fails on ARM but works fine on AMD64:
So, it seems that BTW, if would be easier if the builder has gdb installed. Could we install gdb there? |
Change https://golang.org/cl/196378 mentions this issue: |
Maybe we could work around this by letting the go command scan ldflags, and if it is linking statically on ARM, force recompiling all the C code in non-PIC mode? |
@cherrymui, would you say this is a bug in the C compiler? If so, should we try upgrading the C compiler on the Or, could we have |
Yeah, I think this is a bug in the C toolchain, probably either the linker or glibc. The compiler seems ok. I looked at the source code of glibc and the linker (gold) at tip, and I didn't see anything changed that might fix this. I doubt upgrading the C toolchain would help. |
Some recent occurences:
https://build.golang.org/log/b7e1728e48a73089be64d42ea3b7e581eeae029c
https://build.golang.org/log/56a9b6b774c15433baff5b11a2f2eeb8aaa936a1
The text was updated successfully, but these errors were encountered: