From d8befc612f2120eea077f67f48684a6abe3bd1eb Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 3 Feb 2022 19:14:36 +0000 Subject: [PATCH] demos: Make our stack noexec This is similar to https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4330 and https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4334, which fixed the main library but missed the demos. --- demos/gtk-demo/meson.build | 4 ++++ demos/widget-factory/meson.build | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index 5c84a0121d..f594cd59b2 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -170,6 +170,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad depfile : 'gtkdemo.gresource.d', command : [glib_compile_resources, '--generate', + '--internal', '--target=@OUTPUT@', '--dependency-file=@DEPFILE@', '--sourcedir=' + meson.current_source_dir(), @@ -183,6 +184,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad depfile : 'gtkdemo_resources.c.d', command : [glib_compile_resources, '--generate-source', + '--internal', '--target=@OUTPUT@', '--dependency-file=@DEPFILE@', '--sourcedir=' + meson.current_source_dir(), @@ -196,6 +198,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad input : gtkdemo_gresource, output : 'gtkdemo_resources.o', command : [ld, + '-z', 'noexecstack', '-r', '-b','binary', '@INPUT@', @@ -206,6 +209,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad input : gtkdemo_resources_binary, output : 'gtkdemo_resources2.o', command : [objcopy, + '--strip-all', '--add-symbol','_g_binary_gtkdemo_resource_data=.data:0', '@INPUT@', '@OUTPUT@']) diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build index 800230b512..9a083eb1ac 100644 --- a/demos/widget-factory/meson.build +++ b/demos/widget-factory/meson.build @@ -18,6 +18,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad depfile: 'widgetfactory.gresource.d', command : [glib_compile_resources, '--generate', + '--internal', '--target=@OUTPUT@', '--dependency-file=@DEPFILE@', '--sourcedir=' + meson.current_source_dir(), @@ -31,6 +32,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad depfile: 'widgetfactory_resources.c.d', command : [glib_compile_resources, '--generate-source', + '--internal', '--target=@OUTPUT@', '--dependency-file=@DEPFILE@', '--sourcedir=' + meson.current_source_dir(), @@ -44,6 +46,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad input : widgetfactory_gresource, output : 'widgetfactory_resources.o', command : [ld, + '-z', 'noexecstack', '-r', '-b','binary', '@INPUT@', @@ -54,6 +57,7 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad input : widgetfactory_resources_binary, output : 'widgetfactory_resources2.o', command : [objcopy, + '--strip-all', '--add-symbol','_g_binary_widgetfactory_resource_data=.data:0', '@INPUT@', '@OUTPUT@'])