From: Konstantin Kharlamov Date: Sun, 3 Feb 2019 18:36:32 +0000 (+0300) Subject: mapi: work around GCC LTO dropping assembly-defined functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fccc9d3de6cfd1f4d7dbf49af1582b88d143c4cd;p=mesa.git mapi: work around GCC LTO dropping assembly-defined functions Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109391 Signed-off-by: Konstantin Kharlamov Acked-by: Eric Engestrom Reviewed-by: Dylan Baker Reviewed-by: Eric Engestrom --- diff --git a/meson.build b/meson.build index 8c24ef268f3..fbc02970e68 100644 --- a/meson.build +++ b/meson.build @@ -1465,6 +1465,10 @@ pkg = import('pkgconfig') env_test = environment() env_test.set('NM', find_program('nm').path()) +# This quirk needs to be applied to sources with functions defined in assembly +# as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391 +gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : [] + subdir('include') subdir('bin') subdir('src') diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build index b0416e705a1..016090dac91 100644 --- a/src/mapi/es1api/meson.build +++ b/src/mapi/es1api/meson.build @@ -33,6 +33,7 @@ libglesv1_cm = shared_library( c_args : [ c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE', '-DMAPI_ABI_HEADER="@0@"'.format(es1_glapi_mapi_tmp_h.full_path()), + gcc_lto_quirk, ], link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build index a7f0904b699..c6e9261bcc8 100644 --- a/src/mapi/es2api/meson.build +++ b/src/mapi/es2api/meson.build @@ -33,6 +33,7 @@ libgles2 = shared_library( c_args : [ c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE', '-DMAPI_ABI_HEADER="@0@"'.format(es2_glapi_mapi_tmp_h.full_path()), + gcc_lto_quirk, ], link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build index 7e8bc38a817..6a4f9f5733e 100644 --- a/src/mapi/glapi/meson.build +++ b/src/mapi/glapi/meson.build @@ -44,6 +44,7 @@ if with_shared_glapi static_glapi_args += [ '-DMAPI_MODE_BRIDGE', '-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path()), + gcc_lto_quirk, ] else static_glapi_args += '-DMAPI_MODE_UTIL' diff --git a/src/mapi/shared-glapi/meson.build b/src/mapi/shared-glapi/meson.build index 828d14bfd41..af0c68a1c83 100644 --- a/src/mapi/shared-glapi/meson.build +++ b/src/mapi/shared-glapi/meson.build @@ -42,6 +42,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()), + gcc_lto_quirk, ], link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi],