[PATCH] D23791: [libc++] Perform configuration checks with -nodefaultlibs
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 23 14:33:25 PDT 2016
I just tested on Ubuntu 14.04 as well. The configuration goes through correctly. There are 30 unexpected failures both with and without the patch when I run check-libcxx.
Are there any other platforms in particular which I should be testing on?
From: cfe-commits <cfe-commits-bounces at lists.llvm.org> on behalf of Shoaib Meenai via cfe-commits <cfe-commits at lists.llvm.org>
Reply-To: Shoaib Meenai <smeenai at fb.com>
Date: Tuesday, August 23, 2016 at 10:18 AM
To: "reviews+d23791+public+1be7b6c753063b3c at reviews.llvm.org" <reviews+d23791+public+1be7b6c753063b3c at reviews.llvm.org>, Eric Fiselier <eric at efcs.ca>
Cc: "mclow.lists at gmail.com" <mclow.lists at gmail.com>, Richard Smith <richard at metafoo.co.uk>, "cfe-commits at lists.llvm.org" <cfe-commits at lists.llvm.org>
Subject: Re: [PATCH] D23791: [libc++] Perform configuration checks with -nodefaultlibs
I tested on OS X 10.11 and Ubuntu 16.04.
Get Outlook for iOS<https://urldefense.proofpoint.com/v2/url?u=https-3A__aka.ms_o0ukef&d=DQMFAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=l7bou7qSkm2CYotaUVRllyhV5IFtNt_Fs0WNzO_lJ3w&s=FaEEFpWn73yOistHV_tTWJzVlr5r2Q-WkUv7FrV6CDA&e=>
On Mon, Aug 22, 2016 at 8:37 PM -0700, "Eric Fiselier" <eric at efcs.ca<mailto:eric at efcs.ca>> wrote:
What platforms was this tested on?
On Aug 22, 2016 9:20 PM, "Shoaib Meenai" <smeenai at fb.com<mailto:smeenai at fb.com>> wrote:
smeenai created this revision.
smeenai added reviewers: beanz, compnerd, EricWF, mclow.lists, rsmith.
smeenai added a subscriber: cfe-commits.
We're compiling libc++ with -nodefaultlibs, so we should also pass this
option during the configuration checks to ensure those checks are
consistent with the actual build.
The primary motivation here is to ease cross-compilation against a
non-standard set of C++ libraries. Previously, the configuration checks
would attempt to link against the standard C++ libraries, which would
cause link failures when cross-compiling, even though the actual library
link would go through correctly (because of the use of -nodefaultlibs
and explicitly specifying any needed libraries). This is more correct
even ignoring the motivation, however.
https://reviews.llvm.org/D23791<https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D23791&d=DQMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=canNAfshUtSeM58gyOrRQoF0tgW8MEhlz2mHMbuyEQE&s=B2hLMlMDoMII263TrdLusbDuiFYnpqFYCsrXl4E9K1I&e=>
Files:
cmake/config-ix.cmake
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,26 @@
include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+ if (LIBCXX_HAS_C_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+ endif ()
+ if (LIBCXX_HAS_GCC_S_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ endif ()
+endif ()
+
include(CheckLibcxxAtomic)
# Check compiler flags
@@ -14,7 +35,5 @@
# Check libraries
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
-check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
-check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160823/236a2349/attachment-0001.html>
More information about the cfe-commits
mailing list