summaryrefslogtreecommitdiff
path: root/includes/Stg.h
diff options
context:
space:
mode:
authorDavid M Peixotto <dmp@rice.edu>2011-06-28 15:31:42 -0500
committerDavid M Peixotto <dmp@rice.edu>2011-10-07 16:48:34 -0500
commitdba7254566b121408e7167200d0223a531b66e8b (patch)
tree0a3bfcb739b35123822cb644db93081b46c54fca /includes/Stg.h
parent29a97fded4010bd01aa0a17945c84258e285d421 (diff)
downloadhaskell-dba7254566b121408e7167200d0223a531b66e8b.tar.gz
Enable pthread_getspecific() tls for LLVM compiler
LLVM does not support the __thread attribute for thread local storage and may generate incorrect code for global register variables. We want to allow building the runtime with LLVM-based compilers such as llvm-gcc and clang, particularly for MacOS. This patch changes the gct variable used by the garbage collector to use pthread_getspecific() for thread local storage when an llvm based compiler is used to build the runtime.
Diffstat (limited to 'includes/Stg.h')
-rw-r--r--includes/Stg.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/Stg.h b/includes/Stg.h
index 5665018d93..5b3b20d4d6 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -49,7 +49,10 @@
# define _BSD_SOURCE
#endif
-#if IN_STG_CODE == 0
+#if IN_STG_CODE == 0 || defined(llvm_CC_FLAVOR)
+// C compilers that use an LLVM back end (clang or llvm-gcc) do not
+// correctly support global register variables so we make sure that
+// we do not declare them for these compilers.
# define NO_GLOBAL_REG_DECLS /* don't define fixed registers */
#endif