summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2017-01-04 21:40:00 +0000
committerBob Haarman <llvm@inglorion.net>2017-01-04 21:40:00 +0000
commitf51b0d59080b7d0bc897f79f15c28da0cdb564be (patch)
treef2d6ffb9f5f1bb763d50182dff53aa5f47e54ab9
parent63687e40bca4fa7e2bd6032ba57f9b060b634c17 (diff)
downloadbcm5719-llvm-f51b0d59080b7d0bc897f79f15c28da0cdb564be.tar.gz
bcm5719-llvm-f51b0d59080b7d0bc897f79f15c28da0cdb564be.zip
[compiler-rt] suppress LNK4221 warning when creating static libraries
Summary: We put empty object files in archives, which causes MSVC's linker to complain about these objects not defining any previously undefined symbols. Since we do it on purpose, this only creates noise during the build process. This patch causes us to suppress the warnings. Reviewers: rnk, samsonov Subscribers: dberris, mgorny Differential Revision: https://reviews.llvm.org/D28262 llvm-svn: 291011
-rw-r--r--compiler-rt/CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 5b1591e8a4b..e8326f04b81 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -225,6 +225,17 @@ append_list_if(COMPILER_RT_HAS_WD4800_FLAG /wd4800 SANITIZER_COMMON_CFLAGS)
# Warnings to turn off for all libraries, not just sanitizers.
append_string_if(COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG -Wno-unused-parameter CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+if (CMAKE_LINKER MATCHES "link.exe$")
+ # Silence MSVC linker warnings caused by empty object files. The
+ # sanitizer libraries intentionally use ifdefs that result in empty
+ # files, rather than skipping these files in the build system.
+ # Ideally, we would pass this flag only for the libraries that need
+ # it, but CMake doesn't seem to have a way to set linker flags for
+ # individual static libraries, so we enable the suppression flag for
+ # the whole compiler-rt project.
+ append("/IGNORE:4221" CMAKE_STATIC_LINKER_FLAGS)
+endif()
+
add_subdirectory(include)
set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
OpenPOWER on IntegriCloud