<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 - cmake Minsizerel with LTO fails on Linux"
   href="https://bugs.llvm.org/show_bug.cgi?id=42101">42101</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cmake Minsizerel with LTO fails on Linux
          </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>Linux
          </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>cmake
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>milind@uber.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Configure llvm project with Minsizerel and enable LTO and set clang/clang++ as
the compiler and LLD as the linker (example below).

cmake -DCMAKE_BUILD_TYPE=Minsizerel -DLLVM_ENABLE_LTO=Full 
-DLLVM_ENABLE_PROJECTS=clang -DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=1  -G "Ninja" ../llvm

The build fails with the following error:

ld.lld: error: -plugin-opt=Os: number expected, but got 's'
clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)

Clearly, the -Os flag passed to the linker is not getting recognized. If the
linker does not support -Os, the build scripts should make sure that they do
not pass -Os down to the linker.</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>