[Lldb-commits] [lldb] r222031 - add Makefile rule for test program CREATE_STD_THREADS

Shawn Best sbest at blueshiftinc.com
Fri Nov 14 11:41:33 PST 2014


Author: sbest
Date: Fri Nov 14 13:41:33 2014
New Revision: 222031

URL: http://llvm.org/viewvc/llvm-project?rev=222031&view=rev
Log:
add Makefile rule for test program CREATE_STD_THREADS

Effectively removes -lpthreads from linux/gcc build of test programs in test/api/multithreaded. This was done due to that combination causing a test program to hang due, likely due to an issue with gcc linker and libstdc++ conflicting pthreads code in test program and pthread used by lldb.  Issue has been documented at:
http://llvm.org/bugs/show_bug.cgi?id=21553

Differential Revision: http://reviews.llvm.org/D5838

Modified:
    lldb/trunk/test/api/multithreaded/Makefile
    lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/api/multithreaded/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/Makefile?rev=222031&r1=222030&r2=222031&view=diff
==============================================================================
--- lldb/trunk/test/api/multithreaded/Makefile (original)
+++ lldb/trunk/test/api/multithreaded/Makefile Fri Nov 14 13:41:33 2014
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-ENABLE_THREADS := YES
+ENABLE_STD_THREADS := YES
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=222031&r1=222030&r2=222031&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Nov 14 13:41:33 2014
@@ -120,9 +120,23 @@ LD = $(CC)
 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





More information about the lldb-commits mailing list