[Mesa-dev] [PATCH] mesa: Enable LTO compilation

Chuck Atkins chuck.atkins at kitware.com
Tue May 31 15:07:12 UTC 2016


I only build with swr and llvmpipe.  I generally don't have use for the GPU
drivers so my configure line is typically:

  --enable-opengl --disable-gles1 --disable-gles2
  --disable-va --disable-gbm --disable-xvmc --disable-vdpau
  --enable-shared-glapi
  --disable-dri --with-dri-drivers=
  --enable-gallium-llvm --enable-llvm-shared-libs
  --with-gallium-drivers=swrast,swr
  --disable-egl --disable-gbm --with-egl-platforms=
  --enable-gallium-osmesa
  --enable-glx

With gcc 5.3.1 I end up with lib{GL,OSMesa}.so @ 44M and libswrAVX{,2}.so @
70M.  With flto turned on it drops WAY down to lib{GL,OSMesa}.so @ 13M and
libswrAVX{,2}.so @ 18M


- Chuck

On Tue, May 31, 2016 at 10:57 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> On 31 May 2016 at 15:34, Chuck Atkins <chuck.atkins at kitware.com> wrote:
>
>> I've been using lto for the past several weeks not for performance
>> reasons but to reduce the resulting binary size which has grown to be
>> rather substantial.  I usually set "-flto -ffat-lto-objects
>> -flto-odr-type-merging" in the CFLAGS and CXXFLAGS env vars prior to
>> configure and have yet to experience any problems with the files in mapi./
>>
>> Thanks for the confirmation Chuck. It matches what I'm seeing when
> building using only "-flto".
>
> On the binary size topic - please make sure you include only the drivers
> that you need in --with-dri-drivers and --with-gallium-drivers. Otherwise
> you'll end up with 'megadrivers' (all the drivers in a single binary) with
> hardlinks for each driver instance. The latter is for backwards
> compatibility.
>
> -Emil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160531/f7335a1f/attachment-0001.html>


More information about the mesa-dev mailing list