<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 --- - Adding triple support for non-OSX Darwin OS"
   href="http://llvm.org/bugs/show_bug.cgi?id=19776">19776</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Adding triple support for non-OSX Darwin OS
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>drppublic@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>Currently, non-OSX Darwin targets do not have a separate triple string. I.e:
cross-compiling llvm/clang with with following command:

CC='clang' CXX='clang++' cmake -G "Unix Makefiles" ../llvm/
-DCMAKE_CROSSCOMPILING=True \
-DCMAKE_INSTALL_PREFIX=/aDir
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-aVendor-darwin13.1.0 \
-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_TARGET_ARCH=x86_64 \
-DCMAKE_CXX_FLAGS="-target x86_64-aVendor-darwin13.1.0"

Results in a clang driver that automatically inserts the triple argument:
-triple x86_64-aVendor-macosx10.9.0
where it should be:
-triple x86_64-aVendor-darwin13.1.0

(See <a href="http://lists.cs.uiuc.edu/pipermail/cfe-users/2014-May/000481.html">http://lists.cs.uiuc.edu/pipermail/cfe-users/2014-May/000481.html</a> for full
test description).


This issue could be resolved with the following steps:

1) Adding "DarwinOS" as an additional identifier in the
clang::driver::toolchains::Darwin DarwinPlatformKind enum in Toolchains.h in
llvm/tools/clang/lib/Driver/ (line 328)

2) Slightly modifying the logic in
clang::driver::toolchains::Darwin::ComputeEffectiveClangTriple()
(Toolchains.cpp, line 186) from:

  Str += isTargetIOSBased() ? "ios" : "macosx";

To:

  if (!isTargetIOSBased() && !isTargetMacOS())
    Str += "darwin";
  else
    Str += isTargetIOSBased() ? "ios" : "macosx";

3) Altering the Darwin/OSX versioning logic to accommodate true Darwin Versions
for Triple::Darwin triples.</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>