PKGBUILDs/extra/gtk4/0001-demos-Make-our-stack-noexec.patch

116 lines
4.7 KiB
Diff
Raw Normal View History

2022-02-04 00:09:08 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
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 5c84a0121d33..f594cd59b29c 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -170,42 +170,46 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
2022-01-18 00:08:08 +00:00
depfile : 'gtkdemo.gresource.d',
command : [glib_compile_resources,
'--generate',
+ '--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
gtkdemo_resources_c = custom_target('gtkdemo_resources.c',
input : 'demo.gresource.xml',
output : 'gtkdemo_resources.c',
depfile : 'gtkdemo_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
+ '--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_gtkdemo',
'@INPUT@'])
# Create object file containing resource data
gtkdemo_resources_binary = custom_target('gtkdemo_resources.o',
input : gtkdemo_gresource,
output : 'gtkdemo_resources.o',
command : [ld,
+ '-z', 'noexecstack',
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
gtkdemo_resources_o = custom_target('gtkdemo_resources2.o',
input : gtkdemo_resources_binary,
output : 'gtkdemo_resources2.o',
command : [objcopy,
+ '--strip-all',
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
2022-02-04 00:09:08 +00:00
diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build
index 800230b512db..9a083eb1aca5 100644
--- a/demos/widget-factory/meson.build
+++ b/demos/widget-factory/meson.build
2022-01-18 00:08:08 +00:00
@@ -18,42 +18,46 @@ 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(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
widgetfactory_resources_c = custom_target('widgetfactory_resources.c',
input : 'widget-factory.gresource.xml',
output : 'widgetfactory_resources.c',
depfile: 'widgetfactory_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
+ '--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_widgetfactory',
'@INPUT@'])
# Create object file containing resource data
widgetfactory_resources_binary = custom_target('widgetfactory_resources.o',
input : widgetfactory_gresource,
output : 'widgetfactory_resources.o',
command : [ld,
+ '-z', 'noexecstack',
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
widgetfactory_resources_o = custom_target('widgetfactory_resources2.o',
input : widgetfactory_resources_binary,
output : 'widgetfactory_resources2.o',
command : [objcopy,
+ '--strip-all',
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])