[compiler-rt] r185287 - Always set -m32/-m64 flags for targeting i386/x86_64 respectively. Apparently, there are platforms where the clang defaults are different from gcc

Alexey Samsonov samsonov at google.com
Sun Jun 30 09:21:32 PDT 2013


Author: samsonov
Date: Sun Jun 30 11:21:32 2013
New Revision: 185287

URL: http://llvm.org/viewvc/llvm-project?rev=185287&view=rev
Log:
Always set -m32/-m64 flags for targeting i386/x86_64 respectively. Apparently, there are platforms where the clang defaults are different from gcc

Modified:
    compiler-rt/trunk/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=185287&r1=185286&r2=185287&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Sun Jun 30 11:21:32 2013
@@ -43,16 +43,12 @@ set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMP
 
 # 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





More information about the llvm-commits mailing list