Add the 'akaros' threading model to gcc (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 6 Mar 2017 21:47:14 +0000 (16:47 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 3 May 2017 16:13:02 +0000 (12:13 -0400)
commitfc8f506c206ffe82c2c4b9e589670a8404616695
tree8c6b2210f8fbbd3901876e178cefcfc5e3c8a244
parent33b167a8a4433500252d0508af574db33bc9e307
Add the 'akaros' threading model to gcc (XCC)

Gcc has a bunch of callbacks for basic thread operations.  These are used
internally for C++ operations.  For instance, shared_ptrs use a reference
count.  Whether or not that refcount needs to be accessed atomically
depends on whether or not there are threads in the system.  There are a
bunch of these functions - see gthr-akaros.h for all of them.

Previously, we told gcc to use 'posix' threading, which means pthreads.
However, if we're using a different 2LS, then that would be incorrect.  The
correct threading model is to make our own.

Further, since our pthreads aren't really integrated into gcc/glibc, we
were returning 0 (false) when asked "are we multithreaded."  That led to a
brutal shared_ptr refcount bug.

This commit fixes the detection of threading and should also deal with any
other interactions between gcc/c++ and uthreads.

Rebuild your toolchain (gcc and glibc).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/compilers/gcc-glibc/Makefile
tools/compilers/gcc-glibc/gcc-4.9.2-akaros/config/gthr.m4 [new file with mode: 0644]
tools/compilers/gcc-glibc/gcc-4.9.2-akaros/gcc/configure [new file with mode: 0755]
tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/config/gthr-akaros.h [new file with mode: 0644]
tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/configure [new file with mode: 0644]
tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libstdc++-v3/configure