Skip to content

Commit ce298fe

Browse files
author
Aleksandar Beserminji
committed
[test-suite] Fix stdthreadbug when building static
This patch adds necessary flags for the test stdthreadbug.cpp, so it can be executed without error, when tests are compiled with -static flag. Differential Revision: https://reviews.llvm.org/D52878 llvm-svn: 352385
1 parent a3eea31 commit ce298fe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
list(APPEND CXXFLAGS -std=c++11 -pthread)
22
list(APPEND LDFLAGS -lstdc++ -pthread)
3+
4+
file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cpp)
5+
if(${CMAKE_EXE_LINKER_FLAGS} MATCHES "-static")
6+
list(APPEND LDFLAGS -Wl,--whole-archive -lpthread -Wl,--no-whole-archive)
7+
endif()
8+
39
llvm_singlesource()

SingleSource/UnitTests/C++11/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ CPPFLAGS += -std=c++11 -pthread
66

77
ifdef BENCHMARKING_ONLY
88
PROGRAMS_TO_SKIP += stdthreadbug
9+
else
10+
ifeq (-static, $(findstring -static, $(TARGET_FLAGS)))
11+
LDFLAGS += -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
12+
endif
913
endif
1014

1115
LDFLAGS += -lstdc++ -pthread

0 commit comments

Comments
 (0)