[PATCH] D52878: [test-suite] Add flags for stdthreadbug.cpp when building static
Aleksandar Beserminji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 21 02:29:49 PST 2019
abeserminji updated this revision to Diff 182751.
abeserminji marked 3 inline comments as done.
abeserminji added a comment.
Updated the patch, so that the extra flags are added only when -static option is used.
Used @atanasyan 's solution for CMakeLists.txt from D56836#1362293 <https://reviews.llvm.org/D56836#1362293>.
Made equivalent for the Makefile.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D52878/new/
https://reviews.llvm.org/D52878
Files:
SingleSource/UnitTests/C++11/CMakeLists.txt
SingleSource/UnitTests/C++11/Makefile
Index: SingleSource/UnitTests/C++11/Makefile
===================================================================
--- SingleSource/UnitTests/C++11/Makefile
+++ SingleSource/UnitTests/C++11/Makefile
@@ -6,6 +6,10 @@
ifdef BENCHMARKING_ONLY
PROGRAMS_TO_SKIP += stdthreadbug
+else
+ifeq (-static, $(findstring -static, $(TARGET_FLAGS)))
+LDFLAGS += -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
+endif
endif
LDFLAGS += -lstdc++ -pthread
Index: SingleSource/UnitTests/C++11/CMakeLists.txt
===================================================================
--- SingleSource/UnitTests/C++11/CMakeLists.txt
+++ SingleSource/UnitTests/C++11/CMakeLists.txt
@@ -1,3 +1,9 @@
list(APPEND CXXFLAGS -std=c++11 -pthread)
list(APPEND LDFLAGS -lstdc++ -pthread)
+
+file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cpp)
+if(${CMAKE_EXE_LINKER_FLAGS} MATCHES "-static")
+ list(APPEND LDFLAGS -Wl,--whole-archive -lpthread -Wl,--no-whole-archive)
+endif()
+
llvm_singlesource()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52878.182751.patch
Type: text/x-patch
Size: 987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190121/66dcb266/attachment.bin>
More information about the llvm-commits
mailing list