[libcxx] r224096 - Add support for building libc++ as a 32 bit library

Eric Fiselier eric at efcs.ca
Thu Dec 11 19:12:19 PST 2014


Author: ericwf
Date: Thu Dec 11 21:12:18 2014
New Revision: 224096

URL: http://llvm.org/viewvc/llvm-project?rev=224096&view=rev
Log:
Add support for building libc++ as a 32 bit library

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/test/CMakeLists.txt
    libcxx/trunk/test/lit.cfg
    libcxx/trunk/test/lit.site.cfg.in

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=224096&r1=224095&r2=224096&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Dec 11 21:12:18 2014
@@ -43,6 +43,7 @@ option(LIBCXX_ENABLE_WERROR "Fail and st
 option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
 option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
 option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
+option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++" OFF)
 option(LIBCXX_ENABLE_MONOTONIC_CLOCK
   "Build libc++ with support for a monotonic clock.
    This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
@@ -205,6 +206,14 @@ if (NOT LIBCXX_ENABLE_SHARED)
   list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
 endif()
 
+if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
+  if (LIBCXX_BUILD_32_BITS)
+    message(STATUS "Building 32 bits executables and libraries.")
+    list(APPEND LIBCXX_CXX_FLAGS "-m32")
+  endif()
+elseif(LIBCXX_BUILD_32_BITS)
+  message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
+endif()
 # This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=224096&r1=224095&r2=224096&view=diff
==============================================================================
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Thu Dec 11 21:12:18 2014
@@ -30,6 +30,7 @@ if(PYTHONINTERP_FOUND)
   pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
   pythonize_bool(LIBCXX_ENABLE_RTTI)
   pythonize_bool(LIBCXX_ENABLE_SHARED)
+  pythonize_bool(LIBCXX_BUILD_32_BITS)
   pythonize_bool(LIBCXX_ENABLE_THREADS)
   pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
 

Modified: libcxx/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=224096&r1=224095&r2=224096&view=diff
==============================================================================
--- libcxx/trunk/test/lit.cfg (original)
+++ libcxx/trunk/test/lit.cfg Thu Dec 11 21:12:18 2014
@@ -436,6 +436,9 @@ class Configuration(object):
             self.config.available_features.add('rtti')
         else:
             self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
+        enable_32bit = self.get_lit_bool('enable_32bit', False)
+        if enable_32bit:
+            self.compile_flags += ['-m32']
         # Configure threading features.
         enable_threads = self.get_lit_bool('enable_threads', True)
         enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock', True)

Modified: libcxx/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=224096&r1=224095&r2=224096&view=diff
==============================================================================
--- libcxx/trunk/test/lit.site.cfg.in (original)
+++ libcxx/trunk/test/lit.site.cfg.in Thu Dec 11 21:12:18 2014
@@ -7,6 +7,7 @@ config.python_executable        = "@PYTH
 config.enable_exceptions        = "@LIBCXX_ENABLE_EXCEPTIONS@"
 config.enable_rtti              = "@LIBCXX_ENABLE_RTTI@"
 config.enable_shared            = "@LIBCXX_ENABLE_SHARED@"
+config.enable_32bit             = "@LIBCXX_BUILD_32_BITS@"
 config.enable_threads           = "@LIBCXX_ENABLE_THREADS@"
 config.enable_monotonic_clock   = "@LIBCXX_ENABLE_MONOTONIC_CLOCK@"
 config.cxx_abi                  = "@LIBCXX_CXX_ABI_LIBNAME@"





More information about the cfe-commits mailing list