demos: Make our stack noexec
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Thu, 3 Feb 2022 19:14:36 +0000 (19:14 +0000)
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Thu, 3 Feb 2022 19:14:36 +0000 (19:14 +0000)
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
demos/widget-factory/meson.build

index 5c84a0121d33b7d73a18cca26b28a310d5e59972..f594cd59b29cb96ec45bb1c22cc82cd1f30df587 100644 (file)
@@ -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@'])
index 800230b512db8c1c106a7e7f7cd3e37f7124a4df..9a083eb1aca5dbb6ae6e019be3bac1596dbcc8c2 100644 (file)
@@ -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@'])