mapi: work around GCC LTO dropping assembly-defined functions
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Sun, 3 Feb 2019 18:36:32 +0000 (21:36 +0300)
committerEric Engestrom <eric@engestrom.ch>
Wed, 13 Feb 2019 14:20:51 +0000 (14:20 +0000)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109391

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
meson.build
src/mapi/es1api/meson.build
src/mapi/es2api/meson.build
src/mapi/glapi/meson.build
src/mapi/shared-glapi/meson.build

index 8c24ef268f3b2f69b7eeeaa573746930153c97e7..fbc02970e68c7b06ce2b6954e16aa4f821dcd794 100644 (file)
@@ -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')
index b0416e705a1d9781793b5234a735feb6c53a1995..016090dac91c8f67e51f72125fadacabb842cea6 100644 (file)
@@ -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],
index a7f0904b6996d00035572a242d727efa74fad8a1..c6e9261bcc8e64bcb25dcf4f2969ea967f684dd0 100644 (file)
@@ -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],
index 7e8bc38a817681076c073a266b991ffe51bc75b3..6a4f9f5733e13821abb913561758206d390a0da6 100644 (file)
@@ -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'
index 828d14bfd4156d89f8f447993be531d636a47abd..af0c68a1c838089aead9578f17d66edd32226e28 100644 (file)
@@ -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],