<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Failed Checking missing-syscalls for O32"
   href="https://bugs.llvm.org/show_bug.cgi?id=38063">38063</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failed Checking missing-syscalls for O32
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lesliezhai@llvm.org.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi LLVM developers,

I am building Linux Kernel[1] with LLVM toolchain[2] for mips64el.
But it failed Checking missing-syscalls for O32:


error: ABI 'o32' is not supported on CPU 'mips64r2'
Kbuild:98: recipe for target 'missing-syscalls' failed
make[1]: *** [missing-syscalls] Error 1


GCC is able to work:

...
Checking missing-syscalls for O32
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
...


So ugly workaround patch:

diff --git a/lib/Basic/Targets/Mips.cpp b/lib/Basic/Targets/Mips.cpp
index cbd5a01..59dd34b 100644
--- a/lib/Basic/Targets/Mips.cpp
+++ b/lib/Basic/Targets/Mips.cpp
@@ -207,8 +207,7 @@ bool MipsTargetInfo::validateTarget(DiagnosticsEngine
&Diags) const {
   // FIXME: It's valid to use O32 on a 64-bit CPU but the backend can't handle
   //        this yet. It's better to fail here than on the backend assertion.
   if (processorSupportsGPR64() && ABI == "o32") {
-    Diags.Report(diag::err_target_unsupported_abi) << ABI << CPU;
-    return false;
+    return true;
   }

   // 64-bit ABI's require 64-bit CPU's.


1. Linux Kernel 4.9 branch <a href="https://github.com/loongson-community/linux-stable">https://github.com/loongson-community/linux-stable</a>
2. Loongson clang version 7.0.0 (<a href="mailto:git@github.com">git@github.com</a>:llvm-mirror/clang.git
ef356db5c03a0f052c09ebd0a964b9eda3852847) (<a href="mailto:git@github.com">git@github.com</a>:llvm-mirror/llvm.git
ab9920d16bc0acaa2a458b49a43b3aaa9bcda8e6) (based on LLVM 7.0.0svn)
Target: mips64el-redhat-linux
Thread model: posix
InstalledDir: /opt/llvm-git/bin
Found candidate GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Selected GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Candidate multilib: .;
Selected multilib: .;

Regards,
Leslie Zhai</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>