<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/71361>71361</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `clang` does not support `-fwhole-program`
        </td>
    </tr>

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

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

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

<pre>
    Compiling a program with `-fwhole-program` results in the following warning:

 warning: optimization flag '-fwhole-program' is not supported [-Wignored-optimization-argument]

It is documented [here][gcc-docs]:

> Assume that the current compilation unit represents the whole program being compiled.
> All public functions and variables with the exception of `main` and those merged by attribute `externally_visible` become static functions and in effect are optimized more aggressively by interprocedural optimizers.

Even if no additional optimizations are performed, it should at least make all the symbols static. This is a useful transformation to apply when building the final executable.

[gcc-docs]: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVMGSozYQ_Rpx6TKFxYDtA4ednXVVTntJVY6pltSAEiFRUsse5-tTws6uZycXKKTX77Xea4Qp2ckTDaJ7Fd1bhZnnEIcFeaaclhDJRqxUMLfha1hW66yfAGGNYYq4wNXyDKJvduN1Do52j3XRNxApZccJrAeeCcbgXLiW6itGb_0k2i-ieRPN4_m0DGFlu9h_kG3wMDqcQMjDrxLyADaBDwwpr2uITAZE97r7w04-RDK7Z5Ydxikv5Fl0b8-qv3EhMUFvm3eGmSIVWPc6ab0zQafy9bFb0X6DLynlhYBn5O2EOsdInkFvPt2bz94yRFojJfKcNtx2jB8OKiqe3GvI1E_0zsGalbMaxux1oUuA3sAFo0XlKN3dL5T0rmndBMNY4ljQ-pJBgfMcEsFCcSID6gbIHK3KTAVI70zRo3O3Py82WeWolCnSYSFIjPxJ3XqgcSTNgJH-S4oMlFEBnKZIKdkLuVvRsp4prjFoMjmi-wGPqX5289uFPNgRfAA0xhaxn2B8aEeCleIY4kJGyK9gGdIcsjOADI4wMSz4NwE6t3mSbosKLj1OUcPvs00lbIScaMwOOKJPhe8eFQfAdXU3uM7kQWXrTElmm11b-qF30pmL8x-a_zQnMDOvqQyMPAt5nrSuJ5_rECchz8E762kDb1tCnr8_TNl93yJM9cyLq8zQmlN7woqGfX86ya47dcdqHg7tiNSe-o467HqzpxfVqm5sFLb0QgorO8hGtvt90zeHVrbHet9odThK1bZIx1PXi5eGFrSudu6ylLYqm1Km4bBv-33lUJFL23UgpXboJyFluRniUPA7lackXhpnE6efDGzZ0SD65l7RN2ACffg7__-WqHJ0wy9-WZ6zqnVYhDwXgcerVP1FmoU8b_0WA7eW_w0AAP___DCfgw">