Skip to content

Need ways to distinguish Illumos from Solaris #53919

@rorth

Description

@rorth

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions