This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Filter out -z,defs when building custom libc++
AbandonedPublic

Authored by phosek on Jun 6 2018, 10:03 PM.

Details

Summary

-z,defs is incompatible with sanitizers so we need to filter it out
from the linker flags before passing them to the libc++ build.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Jun 6 2018, 10:03 PM
Herald added subscribers: Restricted Project, llvm-commits, mgorny. · View Herald Transcript

This should unbreak sanitizer builder which is currently red due to my previous change.

morehouse accepted this revision.Jun 7 2018, 9:48 AM
This revision is now accepted and ready to land.Jun 7 2018, 9:48 AM
This revision was automatically updated to reflect the committed changes.

The buildbot is still broken from r334139: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux?numbuilds=200.

The CMake logs show errors like:

/b/sanitizer-x86_64-linux/build/clang_build/./bin/clang++     -fPIC -fvisibility-inlines-hidden -Werror=date-time 
-std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedant
ic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-secti
ons -Wall -std=c++11 -Wno-unused-parameter -fsanitize=memory -fsanitize-memory-track-origins -Wno-pedantic -m64 -D
LIBCXX_HAS_WX_FLAG  -nodefaultlibs -fno-sanitize=all   /WX -o CMakeFiles/cmTC_d4484.dir/src.cxx.o -c /b/sanitizer-
x86_64-linux/build/clang_build/projects/compiler-rt/lib/msan/libcxx_msan_x86_64-bins/CMakeFiles/CMakeTmp/src.cxx
clang-7: error: no such file or directory: '/WX'
--
/b/sanitizer-x86_64-linux/build/clang_build/./bin/clang++     -fPIC -fvisibility-inlines-hidden -Werror=date-time 
-std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedant
ic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-secti
ons -Wall -std=c++11 -Wno-unused-parameter -fsanitize=memory -fsanitize-memory-track-origins -Wno-pedantic -m64 -D
LIBCXX_HAS_NO_WX_FLAG  -nodefaultlibs -fno-sanitize=all   /WX- -o CMakeFiles/cmTC_28ac4.dir/src.cxx.o -c /b/saniti
zer-x86_64-linux/build/clang_build/projects/compiler-rt/lib/msan/libcxx_msan_x86_64-bins/CMakeFiles/CMakeTmp/src.c
xx
clang-7: error: no such file or directory: '/WX-'
--
/b/sanitizer-x86_64-linux/build/clang_build/./bin/clang++     -fPIC -fvisibility-inlines-hidden -Werror=date-time 
-std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedant
ic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-secti
ons -Wall -std=c++11 -Wno-unused-parameter -fsanitize=memory -fsanitize-memory-track-origins -Wno-pedantic -m64 -D
LIBCXX_HAS_EHSC_FLAG  -nodefaultlibs -fno-sanitize=all   /EHsc -o CMakeFiles/cmTC_7d79b.dir/src.cxx.o -c /b/saniti
zer-x86_64-linux/build/clang_build/projects/compiler-rt/lib/msan/libcxx_msan_x86_64-bins/CMakeFiles/CMakeTmp/src.c
xx
clang-7: error: no such file or directory: '/EHsc'
morehouse added a comment.EditedJun 11 2018, 6:44 PM

https://reviews.llvm.org/rCRT334458 should fix the build bot.

Partially fixes. During standalone compiler-rt build we still get:

Performing C++ SOURCE FILE Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG failed with the following output:
Change Dir: /b/sanitizer-x86_64-linux/build/compiler_rt_build/lib/fuzzer/libcxx_fuzzer_x86_64-bins/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_08c90/fast"
make[3]: Entering directory '/b/sanitizer-x86_64-linux/build/compiler_rt_build/lib/fuzzer/libcxx_fuzzer_x86_64-bins/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_08c90.dir/build.make CMakeFiles/cmTC_08c90.dir/build
make[4]: Entering directory '/b/sanitizer-x86_64-linux/build/compiler_rt_build/lib/fuzzer/libcxx_fuzzer_x86_64-bins/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_08c90.dir/src.cxx.o
/b/sanitizer-x86_64-linux/build/llvm_build64/bin/clang++     -Wall -Werror -std=c++11 -Wno-unused-parameter -m64 -D_LIBCPP_ABI_VERSION=Fuzzer -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=1 -fvisibility=hidden -DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG  -nodefaultlibs   -std=c++11 -o CMakeFiles/cmTC_08c90.dir/src.cxx.o -c /b/sanitizer-x8
6_64-linux/build/compiler_rt_build/lib/fuzzer/libcxx_fuzzer_x86_64-bins/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_08c90
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_08c90.dir/link.txt --verbose=1
/b/sanitizer-x86_64-linux/build/llvm_build64/bin/clang++    -Wall -Werror -std=c++11 -Wno-unused-parameter -m64 -D_LIBCPP_ABI_VERSION=Fuzzer -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=1 -fvisibility=hidden -DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG  -nodefaultlibs    CMakeFiles/cmTC_08c90.dir/src.cxx.o  -o cmTC_08c90 -lgcc_s 
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o:function _start: **error: undefined reference to '__libc_csu_fini'
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o:function _start: error: undefined reference to '__libc_csu_init'
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o:function _start: error: undefined reference to '__libc_start_main'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
morehouse reopened this revision.Jun 12 2018, 12:50 PM
This revision is now accepted and ready to land.Jun 12 2018, 12:50 PM
phosek abandoned this revision.Jun 14 2018, 10:10 PM