<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 - [LTO] -Os and -Oz -flto results in error message from LTO code generator."
   href="https://bugs.llvm.org/show_bug.cgi?id=41568">41568</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LTO] -Os and -Oz -flto results in error message from LTO code generator.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>lto
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang t.c -Os -flto -o optlto -fuse-ld=lld
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)

Anything that will compile will do for the t.c file, I used an empty main.

This is the same for -Oz. While the error is reported by LLD it is coming from
the LTO Code Generator.

This has been raised before as <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - No --lto-Os and --lto-Oz"
   href="show_bug.cgi?id=31665">https://bugs.llvm.org/show_bug.cgi?id=31665</a>
however it was closed by the raiser as invalid as the optsize and minsize
attributes are added to the functions when they were compiled.

However I think that there still could be some work to do here:
- It isn't convenient to change the optimization flags just for the link steps
in some build systems. It also isn't discoverable what the equivalent
optimization setting should be given as a replacement. I believe -O2 comes
closest.
- When using the new pass manager there are some passes that check the
PassBuilder optimisation setting using isOptimizingForSize(). I think the
impact on code-generation will be low, but this may change in the future.

At this stage I don't think that supporting -Os and -Oz need be much more than
translating to one of the other optimization levels. Of course there could be a
custom size focused -Os, -Oz LTO added later.</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>