[PATCH] D11618: [CMake] Pass -march=i686 when targeting i686 (PR24222)

Hans Wennborg hans at chromium.org
Wed Jul 29 18:19:40 PDT 2015


hans created this revision.
hans added a reviewer: samsonov.
hans added subscribers: llvm-commits, hansw.

Clang will not define __i686__, even when the target triple is i686,
without -march=i686.

With this patch, the compiler-rt build will successfully detect that
Clang can target i686.

The open_memstream.cc test is a little funny. Before my patch, it
was invoked with "-m32 -m64". To make it work after my -march
change, I had to add '-march='''.

http://reviews.llvm.org/D11618

Files:
  cmake/config-ix.cmake
  test/sanitizer_common/TestCases/Linux/open_memstream.cc

Index: test/sanitizer_common/TestCases/Linux/open_memstream.cc
===================================================================
--- test/sanitizer_common/TestCases/Linux/open_memstream.cc
+++ test/sanitizer_common/TestCases/Linux/open_memstream.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx -m64 -O0 -g -xc++ %s -o %t && %run %t
-// RUN: %clangxx -m64 -O3 -g -xc++ %s -o %t && %run %t
+// RUN: %clangxx -m64 -march='' -O0 -g -xc++ %s -o %t && %run %t
+// RUN: %clangxx -m64 -march='' -O3 -g -xc++ %s -o %t && %run %t
 // REQUIRES: x86_64-supported-target
 
 #include <assert.h>
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -180,7 +180,7 @@
       # FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
       # target different variant than "$CMAKE_C_COMPILER -m32". This part should
       # be gone after we resolve PR14109.
-      test_target_arch(i686 __i686__ "-m32")
+      test_target_arch(i686 __i686__ "-m32" "-march=i686")
       test_target_arch(i386 __i386__ "-m32")
     else()
       if (CMAKE_SIZEOF_VOID_P EQUAL 4)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11618.30976.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150730/430022bc/attachment.bin>


More information about the llvm-commits mailing list