I have added another flag to test/Makefile.rules ENABLE_STD_THREADS and used it 
the api/Multithreaded unit tests.  This can be used to selectively omit 
'-lpthreads' option for certain systems.  All platforms except linux/gcc should 
behave as before.

I have also made a Bugzilla report for simple program that hangs on linux ( 
http://llvm.org/bugs/show_bug.cgi?id=21553 )

I see there has been some recent activity in this area with r215562 omitting 
-lpthreads on windows, and r218899 recently adding -lpthreads as it was needed 
for FreeBSD.

http://reviews.llvm.org/D5838

Files:
  test/api/multithreaded/Makefile
  test/make/Makefile.rules
Index: test/api/multithreaded/Makefile
===================================================================
--- test/api/multithreaded/Makefile
+++ test/api/multithreaded/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
+ENABLE_STD_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
Index: test/make/Makefile.rules
===================================================================
--- test/make/Makefile.rules
+++ test/make/Makefile.rules
@@ -120,9 +120,23 @@
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS)
 ifneq "$(OS)" "Windows_NT"
-	ifeq "$(ENABLE_THREADS)" "YES"
-		LDFLAGS += -lpthread
-	endif
+    ifeq "$(ENABLE_THREADS)" "YES"
+        LDFLAGS += -lpthread
+    else 
+        ifeq "$(ENABLE_STD_THREADS)" "YES"
+            # with the specific combination of Linux, g++, std=c++11, adding the 
+            # linker flag -lpthread, will cause a program to hang when a std::conditional_variable
+            # is used in a program that links lldb (see bugzilla 21553)
+            ifeq "$(OS)" "Linux"
+                ifeq (,$(findstring gcc,$(CC))) 
+                    # Linux, but not gcc
+                    LDFLAGS += -lpthread
+                endif
+            else
+                LDFLAGS += -lpthread
+            endif
+        endif
+    endif
 endif
 OBJECTS =
 EXE ?= a.out
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to