This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/68802] seg fault when non-main thread calls std::current_exception ARMv7-A
- From: "cbaylis at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Mar 2016 16:20:18 +0000
- Subject: [Bug target/68802] seg fault when non-main thread calls std::current_exception ARMv7-A
- Auto-submitted: auto-generated
- References: <bug-68802-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68802
cbaylis at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from cbaylis at gcc dot gnu.org ---
I managed to look into this in more detail with a colleague. The segfault
happens because the implementation of __tls_get_addr in glibc returns an
invalid pointer. This seems to be a problem with static linking only, and
dynamic linking will avoid the problem.
A slightly simplified test case (without the exception handling) is:
#include <cstdio>
#include <thread>
__thread int __attribute__ ((tls_model ("global-dynamic"))) x = 10;
class Thread {
public:
void operator()(){
fprintf(stderr, "testing (%i) ...\n", x);
}
};
int main(void){
Thread t;
std::thread th(std::ref(t));
th.join();
return 0;
}
If you install a copy of jessie filesystem somewhere on your build machine, you
should be able to compile and link against the libraries on that version using
--sysroot=/path/to/fs. This should allow you to create dynamically linked
binaries which work on your target
I've created a glibc bug for this
https://sourceware.org/bugzilla/show_bug.cgi?id=19826.
Since I don't think this is a bug in gcc, I'll close this bug.