From 371b97af271b53ee3234b0831d3e994bea31c7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 17 Jan 2019 11:54:29 +0100 Subject: [PATCH] meson: Fix map files and load them to hide private symbols Map files were using wrong syntax (missing final `;` or invalid chars). Also, the map files were only monitored for rebuilding, but not really used by ld, so pass the ldflags with version-script so that private symbols are really hidden. https://gitlab.gnome.org/GNOME/mutter/merge_requests/395 --- cogl/cogl-gles2/libmutter-cogl-gles2.map | 4 +--- cogl/cogl-gles2/meson.build | 8 +++++++- cogl/cogl-pango/libmutter-cogl-pango.map | 2 +- cogl/cogl-pango/meson.build | 8 +++++++- cogl/cogl-path/libmutter-cogl-path.map | 2 +- cogl/cogl-path/meson.build | 8 +++++++- cogl/cogl/libmutter-cogl.map | 8 +++++--- cogl/cogl/meson.build | 8 +++++++- 8 files changed, 36 insertions(+), 12 deletions(-) diff --git a/cogl/cogl-gles2/libmutter-cogl-gles2.map b/cogl/cogl-gles2/libmutter-cogl-gles2.map index 8b2a54588..071e32cfa 100644 --- a/cogl/cogl-gles2/libmutter-cogl-gles2.map +++ b/cogl/cogl-gles2/libmutter-cogl-gles2.map @@ -1,6 +1,4 @@ { -global: - gl*; local: *; -} +}; diff --git a/cogl/cogl-gles2/meson.build b/cogl/cogl-gles2/meson.build index 4d5ffb463..b83dac74b 100644 --- a/cogl/cogl-gles2/meson.build +++ b/cogl/cogl-gles2/meson.build @@ -8,12 +8,18 @@ cogl_gles2_sources = [ 'cogl-gles2-api.c', ] +libmutter_cogl_gles2_map = 'libmutter-cogl-gles2.map' +libmutter_cogl_gles2_link_args = [ + '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), + libmutter_cogl_gles2_map), +] libmutter_cogl_gles2 = shared_library('mutter-cogl-gles2-' + libmutter_api_version, sources: [cogl_gles2_sources, cogl_gles2_public_headers], soversion: '0.0.0', c_args: cogl_c_args, include_directories: [cogl_includepath, cogl_path_includepath], - link_depends: 'libmutter-cogl-gles2.map', + link_depends: libmutter_cogl_gles2_map, + link_args: libmutter_cogl_gles2_link_args, dependencies: [ cogl_deps, libmutter_cogl_dep diff --git a/cogl/cogl-pango/libmutter-cogl-pango.map b/cogl/cogl-pango/libmutter-cogl-pango.map index 8d98b792d..35d637e69 100644 --- a/cogl/cogl-pango/libmutter-cogl-pango.map +++ b/cogl/cogl-pango/libmutter-cogl-pango.map @@ -3,4 +3,4 @@ global: cogl_pango_*; local: *; -} +}; diff --git a/cogl/cogl-pango/meson.build b/cogl/cogl-pango/meson.build index c104112bf..75bc37c8e 100644 --- a/cogl/cogl-pango/meson.build +++ b/cogl/cogl-pango/meson.build @@ -21,12 +21,18 @@ cogl_pango_deps = [ libmutter_cogl_dep, ] +libmutter_cogl_pango_map = 'libmutter-cogl-pango.map' +libmutter_cogl_pango_link_args = [ + '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), + libmutter_cogl_pango_map), +] libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_version, sources: [cogl_pango_sources, cogl_pango_public_headers], soversion: '0.0.0', c_args: cogl_c_args, include_directories: [cogl_includepath, cogl_path_includepath], - link_depends: 'libmutter-cogl-pango.map', + link_depends: libmutter_cogl_pango_map, + link_args: libmutter_cogl_pango_link_args, dependencies: [cogl_pango_deps], install_rpath: pkglibdir, install_dir: pkglibdir, diff --git a/cogl/cogl-path/libmutter-cogl-path.map b/cogl/cogl-path/libmutter-cogl-path.map index 9b1638317..64789553a 100644 --- a/cogl/cogl-path/libmutter-cogl-path.map +++ b/cogl/cogl-path/libmutter-cogl-path.map @@ -14,4 +14,4 @@ global: cogl2_set_*; local: *; -} +}; diff --git a/cogl/cogl-path/meson.build b/cogl/cogl-path/meson.build index 7df5636cc..b394199f8 100644 --- a/cogl/cogl-path/meson.build +++ b/cogl/cogl-path/meson.build @@ -52,12 +52,18 @@ cogl_path_c_args = [ cogl_c_args, ] +libmutter_cogl_path_map = 'libmutter-cogl-path.map' +libmutter_cogl_path_link_args = [ + '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), + libmutter_cogl_path_map), +] libmutter_cogl_path = shared_library('mutter-cogl-path-' + libmutter_api_version, sources: [cogl_path_sources, cogl_path_public_headers], soversion: '0.0.0', c_args: cogl_path_c_args, include_directories: [cogl_includepath, cogl_path_includepath], - link_depends: 'libmutter-cogl-path.map', + link_depends: libmutter_cogl_path_map, + link_args: libmutter_cogl_path_link_args, dependencies: [libmutter_cogl_dep, cogl_deps], install_rpath: pkglibdir, install_dir: pkglibdir, diff --git a/cogl/cogl/libmutter-cogl.map b/cogl/cogl/libmutter-cogl.map index ea0b66fcd..9f2f16ba0 100644 --- a/cogl/cogl/libmutter-cogl.map +++ b/cogl/cogl/libmutter-cogl.map @@ -45,7 +45,9 @@ global: _cogl_framebuffer_winsys_update_size; _cogl_winsys_egl_make_current; _cogl_winsys_egl_ensure_current; - _cogl_pixel_format_get_bytes_per_pixel).*"; + _cogl_pixel_format_get_bytes_per_pixel*; + _cogl_system_error_quark; + _cogl_util_next_p2; local: - *; -} + *; +}; diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index c25ad75fa..b06031c96 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -466,12 +466,18 @@ if have_cogl_tests endif libmutter_cogl_name = 'mutter-cogl-' + libmutter_api_version +libmutter_cogl_map = 'libmutter-cogl.map' +libmutter_cogl_link_args = [ + '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), + libmutter_cogl_map), +] libmutter_cogl = shared_library(libmutter_cogl_name, sources: [cogl_sources, cogl_headers_all], soversion: '0.0.0', c_args: cogl_c_args, include_directories: cogl_includepath, - link_depends: 'libmutter-cogl.map', + link_depends: libmutter_cogl_map, + link_args: libmutter_cogl_link_args, dependencies: [cogl_deps, cogl_test_deps], install_rpath: pkglibdir, install_dir: pkglibdir,