diff options
author | Petr Hosek <phosek@chromium.org> | 2019-01-28 04:12:54 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-01-28 04:12:54 +0000 |
commit | 6a7c61d1c30f8767b7821bd23916621f590c5b19 (patch) | |
tree | 47d53de370d383377ef0c09a0cf63271f8c546ca | |
parent | 97ad975dc9f4d98aa70df136adef61cc108dcca3 (diff) | |
download | libcxxabi-6a7c61d1c30f8767b7821bd23916621f590c5b19.tar.gz |
[CMake] Use __libc_start_main rather than fopen when checking for C library
The check_library_exists CMake uses a custom symbol definition. This
is a problem when checking for C library symbols because Clang
recognizes many of them as builtins, and returns the
-Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
error. When building with -Werror which is the default, this causes
the check_library_exists check fail making the build think that C
library isn't available.
To avoid this issue, we should use a symbol that isn't recognized by
Clang and wouldn't cause the same issue. __libc_start_main seems like
reasonable choice that fits the bill.
Differential Revision: https://reviews.llvm.org/D57142
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@352341 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/config-ix.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 379b554..4be7adc 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -2,7 +2,7 @@ include(CheckLibraryExists) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) -check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB) +check_library_exists(c __libc_start_main "" LIBCXXABI_HAS_C_LIB) if (NOT LIBCXXABI_USE_COMPILER_RT) check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB) endif () |