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

Martin Peres martin.peres at free.fr
Tue May 31 21:50:03 UTC 2016


On 31/05/16 21:26, ⚛ wrote:
> On Tue, May 31, 2016 at 8:04 PM, Chuck Atkins <chuck.atkins at kitware.com> wrote:
>> Agreed.  I've been building on both Fedora and EL7 for the past few months
>> with -flto and haven't seen any issues with the files in mapi.  You reported
>> that you get build failures with gcc for this though so what is your
>> particular build environment that is failing and how is it failing?
> Build environment: Gentoo, GCC 4.9.3, binutils 2.25.1
>
> The error message:
>
> make[5]: Entering directory 'build32/src/mapi'
> /bin/sh ../../libtool  --tag=CC   --mode=link ccache-gcc -pthread
> -Werror=pointer-arith -Werror=vla -g -Og -Wall -flto=4 -msse4
> -ffat-lto-objects -fuse-linker-plugin -m32 -Wall -std=c99
> -Werror=implicit-function-declaration -Werror=missing-prototypes
> -fno-strict-aliasing -fno-math-errno -fno-trapping-math
> -fno-builtin-memcmp   -no-undefined -Wl,--gc-sections
> -Wl,--no-undefined  -o shared-glapi/libglapi.la -rpath install32/lib
> shared_glapi_libglapi_la-entry.lo
> shared_glapi_libglapi_la-mapi_glapi.lo
> shared_glapi_libglapi_la-stub.lo shared_glapi_libglapi_la-table.lo
> shared_glapi_libglapi_la-u_current.lo
> shared_glapi_libglapi_la-u_execmem.lo -lpthread
> libtool: link: ccache-gcc -shared  -fPIC -DPIC
> .libs/shared_glapi_libglapi_la-entry.o
> .libs/shared_glapi_libglapi_la-mapi_glapi.o
> .libs/shared_glapi_libglapi_la-stub.o
> .libs/shared_glapi_libglapi_la-table.o
> .libs/shared_glapi_libglapi_la-u_current.o
> .libs/shared_glapi_libglapi_la-u_execmem.o   -lpthread  -pthread -g
> -Og -flto=4 -msse4 -fuse-linker-plugin -m32 -Wl,--gc-sections
> -Wl,--no-undefined   -pthread -Wl,-soname -Wl,libglapi.so.0 -o
> shared-glapi/.libs/libglapi.so.0.0.0
> /tmp/ccuX0CSJ.ltrans5.ltrans.o: In function `entry_patch_public':
> src/mapi/entry_x86_tls.h:87: undefined reference to `x86_current_tls'
> src/mapi/entry_x86_tls.h:89: undefined reference to `x86_entry_start'
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld:
> /tmp/ccuX0CSJ.ltrans5.ltrans.o: relocation R_386_GOTOFF against
> undefined symbol `x86_entry_start' can not be used when making a
> shared object
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld:
> final link failed: Bad value
> collect2: error: ld returned 1 exit status

I had issues until gcc 5.1 to get LTO to work with mesa. LTO is not as 
good on older versions of GCC anyway. What is stopping you from moving 
to GCC 6.1?

Martin


More information about the mesa-dev mailing list