<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVV1z4jYU_TXmRRMPOEDggYdsSJpMy6ZT0u70iZFk2dZGtjz6CMu_77myYel23zpDcJDvx7nnnnslbHnabJXvdVAsNEo7Jm3b2o7xTiof3CkrHtjeGu60x1nJXoyJrfWs4R-KlfpDuVqVTHfM21Yx7hT3zGs4s1fHpVFMGuthgeDstVfdOVbv7FclA2uto8y8Y7MpOynukKa2OWN_KKm6YBIAcu4URbHI6YPu6qh9k86DtUxy5I59gqEAiRvm1IdWR49AL50PipfMVgQarslNd5V1LQ8atfreJQN4sjaaoHvg7g0HA5T9JSvuWvBiDACP_i1rlFOIvqeyETo0KOpIxce6BnMDKdni03Y2Wy_Xi2yxzYpVE0Lvs9v7rHjC54zRmI82t67G0dm6WJPVdJtNx-8vivnGRlMSc4ILc2IVENljqqa1pTIs-iHrL5aJqGEaeA1QhJRly6kfqMd_DFhLVekO9qCBCRuan3WZqj822iR3PZ4N7r5XUldaUktGa7DxNrBwAlud1yU6IUgCQIcedUxQEdBIOUZF20tDjJa6qoCSNMfAYeq1UPk1ATfsyygCzlounWXgE2AOhxHY4YBfIO6nIjnaMzoK4cnmaN37UPlR40tEYKHoKP-DdwjKGQThIRBPDUZwaXhXU_1kg2ctZUr5APEPAhhbhDpL25HIKPMopfxcxzYxz_6DnQlODYQgCTIOYke6vrH0zsbQx8BUXudJWMspqQaKedjxd_Ub6vV5-BZwTpIfxpOTVoINp16lNmPMwgXFM1lcF4UhGDTBdEhDZy-clQqTC9Zsl-eXAL87-4EWJ2n41_1FMisSL4mkuw5PqNIcdTZgzgOTygUOmwYSFhiY1LaBxmHkbawbDAEcMKcGeh9ZoWRZcf89UatgDHRfI6IYa98ZD0PXHU3yKGLZkGwBuAtaYkEIFY5KdVfy2PETCdRSPBKl0e_qimijBb73se-tA0FPf3b6Gx7P1occC4-QDIqMfcmDekvJX_d_DRoatTlOAU0q4RJoqVNHp897ZcRMZCSP-xv6uxq9YxJYqxCn5d5jATOJMcLKIZ8UAWT6iIVOCTCHwfFSXxbXuCq4wLa7tPJtYFa2kBIlqTCcnkAOIObZ3aeH3f2vj4f93_u3x93h8_3uMbvbst3928Pz4x51F_vYUVsKck8IGHo2rFTKmkYAHH9G933EPiIJXLc-rQKV2p__sPda7BMMtBz2M90X3NixGuya72rJJ-XmtlzfrvmERxy5jUOrmkl0ZvPvzVtj4qPIcddRY8f-4nEzXkv4qb2PtP-fFrfr2XrSbMRsVlViWohiLVayUFKq1WJVVLdcVvOqWk4MF8r4DXY-lv3k_6fUm2Ja4DNbTVeL-XyZF0Isq3K2lPPbxULdFdl8qlquzeUCmbhNCili7fHSpK1weUlyqbH-zgiDDkZtPtNKBY3-x715vukrZ9vz5TBJEDcJ3z8F58Cg>53919</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Need ways to distinguish Illumos from Solaris
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rorth
      </td>
    </tr>
</table>

<pre>
    Despite their common ancestry, Solaris and Illumos have diverged in some areas since Oracle closed the OpenSolaris project more than 10 years ago.  Recently, the need to distinguish the too came up in several reviews.  Instead of having the information spread over multiple places, I'm collecting them here.  Some of this was suggested in [D119695](https://reviews.llvm.org/D119695):

We should probably follow the model used in Go build tags where `solaris` is defined for both Solaris and Illumos, while `illumos` is specific to Illumos.  This way considerable code can be shared while handling differences as need be.

- We need a macro (`__illumos__`) to distinguish the two.  This needs to work both with bundled and vanilla versions of `clang` and `gcc`, so this should be done in two places.
- Define `__illumos__` based on the `uname -o` output e.g. in `llvm/CMakeLists.txt`.  I have a prototype for that.
- Have `clang` predefine it, too.  This depends on...
- Provide `isOSIllumos()` in `clang`.  I'm not yet certain how best to do this, though: normally the `isOS*()` methods just look at the triple, which is identical between the two.  Maybe something like `llvm/lib/Support/Unix/Host.inc` (`updateTripleOSVersion`) can be used, but rewriting the triple to `*-*-illumos` would mean massive changes to the testsuite, contradicting the model above.
- The `cmake` files use `${CMAKE_SYSTEM_NAME} MATCHES "SunOS"` tests all over the place.  Not sure yet how best to handle this.

We may discover more along the way, though.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtVdty2zYQ_RrqBWOORN0f9KBYdu1pFXcqt5k-aUASJBGDAAcXKfr7nAUpRU0zI4sWuJezZ88uclNeNjvhOukF842QlhWmbY1mXBfCeXtJskd2MIpb6XBWslelQmsca_hJsFKehK1FyaRmzrSCcSu4Y07Cmb1ZXijBCmUcLBCcvXVCX2N11nwVhWetsZSZazYZs4vgFmlqkzL2lyiE9ioCIGctKIpBTuelroN0TTz3xrCCI3foIgwBSFwxK05SnB0CvWrnBS-ZqQg0XKOb1JWxLfcStbrORgN4sjYoLzvg7hQHA5T9NcmWLXhRCoAH_5Y1wgpEP1DZCO0bFHWm4kNdg7melGT-aTeZrBfreTLfJdmq8b5zyXSbZM_4XDEqdWpTY2scXa2zNVmNd8l4-P4imGtMUCUxl_NcXVgFROYcq2lNKRQLrs_6m2F5kDD1vAYoQsqSxdj11OM_BqylqKSGPWhgufHNr7pM1Z8bqaK7HM56d9eJQlayoJYM1mDjvWfhAra0kyU6kZMEgA490iynIqCRcoiKtpeKGC1lVQElaY6Bw9jrXKT3BDywL4MIOGt5YQ0DnwBzPA7Ajkf8AnG_FMnZXNFRCEc2Z2M_-srPEl95ABaKjvJPXCMoZxCEg0AcNRjBC8V1TfWTDZ51UcSUjxB_L4ChRaizNJpERpkHKaXXOnaRefY_7Czn1EAIkiDjIGjS9YOhdyb4Lngm0jqNwlqMSTVQzOOef4g_UK9L_TePc5J8P56ctOKNv3Qithlj5m8oXsjivigMQa8JJn0cOnPjrBSYXLBmdJreAvxpzQktjtJwb4ebZFYkXhKJvg9PqOIcaeMx554VwnoOmwYSzjEwsW09jf3Im1A3GAI4YE4V9D6wQ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