From 3891d357d3da50af2200291d28a507dc87011f97 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Sun, 3 Feb 2019 21:36:32 +0300 Subject: [PATCH] mapi: work around GCC LTO dropping assembly-defined functions Signed-off-by: Konstantin Kharlamov --- src/mapi/es1api/meson.build | 5 ++++- src/mapi/es2api/meson.build | 5 ++++- src/mapi/glapi/meson.build | 6 ++++++ src/mapi/shared-glapi/meson.build | 5 ++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build index b0416e705a1..1b8d9418d93 100644 --- a/src/mapi/es1api/meson.build +++ b/src/mapi/es1api/meson.build @@ -27,13 +27,16 @@ es1_glapi_mapi_tmp_h = custom_target( capture : true, ) +# gcc LTO drops functions implemented in assembly https://bugs.freedesktop.org/show_bug.cgi?id=109391 +maybe_gcc_lto_quirk = (cc.get_id() == 'gcc')? ['-fno-lto'] : [] + libglesv1_cm = shared_library( 'GLESv1_CM', ['../entry.c', es1_glapi_mapi_tmp_h], c_args : [ c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE', '-DMAPI_ABI_HEADER="@0@"'.format(es1_glapi_mapi_tmp_h.full_path()), - ], + ] + maybe_gcc_lto_quirk, link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], link_with : libglapi, diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build index a7f0904b699..0397216b9e1 100644 --- a/src/mapi/es2api/meson.build +++ b/src/mapi/es2api/meson.build @@ -27,13 +27,16 @@ es2_glapi_mapi_tmp_h = custom_target( capture : true, ) +# gcc LTO drops functions implemented in assembly https://bugs.freedesktop.org/show_bug.cgi?id=109391 +maybe_gcc_lto_quirk = (cc.get_id() == 'gcc')? ['-fno-lto'] : [] + libgles2 = shared_library( 'GLESv2', ['../entry.c', es2_glapi_mapi_tmp_h], c_args : [ c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE', '-DMAPI_ABI_HEADER="@0@"'.format(es2_glapi_mapi_tmp_h.full_path()), - ], + ] + maybe_gcc_lto_quirk, link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], link_with : libglapi, diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build index 7e8bc38a817..aad519f7110 100644 --- a/src/mapi/glapi/meson.build +++ b/src/mapi/glapi/meson.build @@ -29,6 +29,12 @@ if ['apple', 'windows'].contains(with_dri_platform) static_glapi_files += [glapi_gentable_c, glapitable_h] endif +if cc.get_id() == 'gcc' + # gcc LTO drops functions implemented in assembly + # https://bugs.freedesktop.org/show_bug.cgi?id=109391 + static_glapi_args += ['-fno-lto'] +endif + if with_shared_glapi static_glapi_files += files( '../entry.c', diff --git a/src/mapi/shared-glapi/meson.build b/src/mapi/shared-glapi/meson.build index 828d14bfd41..571fddb0314 100644 --- a/src/mapi/shared-glapi/meson.build +++ b/src/mapi/shared-glapi/meson.build @@ -27,6 +27,9 @@ files_mapi_glapi = files( '../table.h', ) +# gcc LTO drops functions implemented in assembly https://bugs.freedesktop.org/show_bug.cgi?id=109391 +maybe_gcc_lto_quirk = (cc.get_id() == 'gcc')? ['-fno-lto'] : [] + shared_glapi_mapi_tmp_h = custom_target( 'shared_glapi_mapi_tmp.h', input : [mapi_abi_py, gl_and_es_api_files], @@ -42,7 +45,7 @@ libglapi = shared_library( c_args : [ c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_GLAPI', '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()), - ], + ] + maybe_gcc_lto_quirk, link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], dependencies : [dep_thread, dep_selinux], -- 2.20.1