This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/68802] seg fault when non-main thread calls std::current_exception ARMv7-A


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]