<html>
    <head>
      <base href="https://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 --- - LLVM 3.7+ doesn't build on Illumos-based OSes (SmartOS, OpenIndiana, etc.)"
   href="https://llvm.org/bugs/show_bug.cgi?id=25409">25409</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM 3.7+ doesn't build on Illumos-based OSes (SmartOS, OpenIndiana, etc.)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Solaris
          </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>Makefiles
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nikita.baksalyar@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hello,

Makefile.rules adds linker flags to strip dead symbols. For Solaris-like
operating systems it has the following code:

    ifeq ($(HOST_OS),SunOS)
      LD.Flags += -Wl,-z -Wl,discard-unused=sections
      ...
    endif

According to an OpenIndiana developers mailing list [1] Illumos (the
OpenSolaris fork) doesn't support the linker flag "discard-unused=sections"
yet. It's available only on Oracle's Solaris 11.1 [2].

That makes it impossible to compile LLVM on Illumos derivatives, such as Joyent
SmartOS, OmniOS, and others.

Both Illumos and Oracle Solaris support `-z ignore` flag, though, that is
similar (but not equivalent) to `discard-unused=sections`. So this bug can be
easily fixed by replacing the "discard-unused=sections" with "ignore".

If maintainers are OK with such a fix, I can submit a patch.

Thanks!

[1] <a href="http://openindiana.org/pipermail/oi-dev/2015-June/003696.html">http://openindiana.org/pipermail/oi-dev/2015-June/003696.html</a>
[2] <a href="https://docs.oracle.com/cd/E26502_01/html/E26507/glmth.html">https://docs.oracle.com/cd/E26502_01/html/E26507/glmth.html</a></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>