<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - compiler-rt (git) CMake Error in AArch64 platform with GCC compiler"
   href="http://llvm.org/bugs/show_bug.cgi?id=21475">21475</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>compiler-rt (git) CMake Error in AArch64 platform with GCC compiler
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yuxing.tang@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13287" name="attach_13287" title="the patch file for compiler-rt/cmake/config-ix.cmake in aarch64 platform">attachment 13287</a> <a href="attachment.cgi?id=13287&action=edit" title="the patch file for compiler-rt/cmake/config-ix.cmake in aarch64 platform">[details]</a></span>
the patch file for compiler-rt/cmake/config-ix.cmake in aarch64 platform

I got this Problem when try to build the whole llvm git tree in AArch64
platform. A simple test error in compiler-rt just stop the configuration
progress.

   It seems cmake try to do some compiling test before the real build, but it
failed in aarch64. Form the log. I figure out the possible cause is the wrong
"-march" parameters for gcc. It seems the cmake build system try to push
"-march=aarch64" into the compiler testing command. After checking the current
gcc document and testing gcc-4.8.3 and gcc-4.9.0, I'm sure current gcc release
just recognize "-march=armv8-a", not "-march=aarch64"

  The problem is in compiler-rt/cmake/config-ix.cmake file. If the platform is
aarch32, cmake will push the right parameter "-march=armv8-a". If the platform
is aarch64, the paramter will change to "-march=aarch64", which the gcc cannot
handle. So I produce a simple patch.

********************* possible patch ************************
--- ./llvmGIT/llvm/projects/compiler-rt/cmake/config-ix.cmake   2014-11-04
19:25:39.827152526 +0800
+++ ./llvm/projects/compiler-rt/cmake/config-ix.cmake   2014-10-28
08:25:15.189851798 +0800
@@ -148,7 +148,7 @@
   elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch32")
     test_target_arch(aarch32 "-march=armv8-a")
   elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch64")
-    test_target_arch(aarch64 "-march=aarch64")
+    test_target_arch(aarch64 "-march=armv8-a")
   endif()
   set(COMPILER_RT_OS_SUFFIX "")
 endif()

*************************************************
This patch just work for aarch64/Linux-gcc platform
I have tested this patch has no side effect in x86_64/Linux-gcc. but
aarch64/Linux-llvm or aarch64/MacOS has not been tested.


***************** The Error message log just as below *************

CMake Error at projects/compiler-rt/cmake/config-ix.cmake:87 (message):
  Cannot compile for aarch64:
 ...
 ...  
CMakeFiles/cmTryCompileExec4150267559.dir/simple.cc.o -c
  /home/xxx/SourceCode/llvmGIT/build/CMakeFiles/simple.cc

  /home/xxx/SourceCode/llvmGIT/build/CMakeFiles/simple.cc:1:0: error: unknown
  value ‘aarch64’ for -march
 ...
 ...  
make: *** [cmTryCompileExec4150267559/fast] Error 2

Call Stack (most recent call first):
  projects/compiler-rt/cmake/config-ix.cmake:151 (test_target_arch)
  projects/compiler-rt/CMakeLists.txt:216 (include)


-- Configuring incomplete, errors occurred!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>