Always set -m32/-m64 flags for targeting i386/x86_64 respectively. Apparently, there...
authorAlexey Samsonov <samsonov@google.com>
Sun, 30 Jun 2013 16:21:32 +0000 (16:21 +0000)
committerAlexey Samsonov <samsonov@google.com>
Sun, 30 Jun 2013 16:21:32 +0000 (16:21 +0000)
llvm-svn: 185287

compiler-rt/CMakeLists.txt

index c33848bbefa2a4ce7e85b73588cdced7e390e208..b9c232393d3c27c954031978413b47ed38a27254 100644 (file)
@@ -43,16 +43,12 @@ set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/linux)
 
 # Detect whether the current target platform is 32-bit or 64-bit, and setup
 # the correct commandline flags needed to attempt to target 32-bit and 64-bit.
-if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR LLVM_BUILD_32_BITS)
-  set(TARGET_64_BIT_CFLAGS "-m64")
-  set(TARGET_32_BIT_CFLAGS "")
-else()
-  if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
-    message(FATAL_ERROR "Please use a sane architecture with 4 or 8 byte pointers.")
-  endif()
-  set(TARGET_64_BIT_CFLAGS "")
-  set(TARGET_32_BIT_CFLAGS "-m32")
+if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
+    NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+  message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
 endif()
+set(TARGET_64_BIT_CFLAGS "-m64")
+set(TARGET_32_BIT_CFLAGS "-m32")
 
 # List of architectures we can target.
 set(COMPILER_RT_SUPPORTED_ARCH)
@@ -90,10 +86,7 @@ if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
   test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
   test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
 elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
-  # Explicitly set -m flag on powerpc, because on ppc64 defaults for gcc and
-  # clang are different.
-  test_target_arch(powerpc64 "-m64")
-  test_target_arch(powerpc "-m32")
+  test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
 endif()
 
 # We only support running instrumented tests when we're not cross compiling