Skip to content

Commit

Permalink
[CMake] Pass -march=i686 when targeting i686 (PR24222)
Browse files Browse the repository at this point in the history
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=x86-64'.

Differential Revision: http://reviews.llvm.org/D11618

llvm-svn: 243604
  • Loading branch information
zmodem committed Jul 30, 2015
1 parent 0e776a2 commit 78bea23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion compiler-rt/cmake/config-ix.cmake
Expand Up @@ -180,7 +180,8 @@ else()
# 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")
# Use -march to make sure Clang defines __i686__; see PR24222.
test_target_arch(i686 __i686__ "-m32" "-march=i686")
test_target_arch(i386 __i386__ "-m32")
else()
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
Expand Down
@@ -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=x86-64 -O0 -g -xc++ %s -o %t && %run %t
// RUN: %clangxx -m64 -march=x86-64 -O3 -g -xc++ %s -o %t && %run %t
// REQUIRES: x86_64-supported-target

#include <assert.h>
Expand Down

0 comments on commit 78bea23

Please sign in to comment.