summaryrefslogtreecommitdiff
path: root/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch')
-rw-r--r--media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch b/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch
new file mode 100644
index 000000000000..1e1a8198ef26
--- /dev/null
+++ b/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch
@@ -0,0 +1,70 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/e28a052105f8ef35b3f469d3b85e1fcb25106f26
+
+From e28a052105f8ef35b3f469d3b85e1fcb25106f26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= <pobrn@protonmail.com>
+Date: Wed, 13 Apr 2022 18:13:12 +0200
+Subject: [PATCH] treewide: retain sections to prevent linker garbage
+ collection
+
+The linker may remove sections that are actually used when
+"--gc-sections" and "-z start-stop-gc" is set. Add the `retain`
+attribute to prevent that.
+
+Furthermore, fix the alignment for `pwtest_suite_decl` objects.
+
+See: #2292
+See: https://lld.llvm.org/ELF/start-stop-gc.html
+See: https://github.com/systemd/systemd/issues/21847
+See: https://github.com/systemd/systemd/pull/21855
+---
+ src/modules/module-protocol-pulse/module.h | 1 +
+ test/pwtest-implementation.h | 2 +-
+ test/pwtest.h | 6 ++++--
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/modules/module-protocol-pulse/module.h b/src/modules/module-protocol-pulse/module.h
+index c1153640e..f75d8786c 100644
+--- a/src/modules/module-protocol-pulse/module.h
++++ b/src/modules/module-protocol-pulse/module.h
+@@ -47,6 +47,7 @@ struct module_info {
+
+ #define DEFINE_MODULE_INFO(name) \
+ __attribute__((used)) \
++ __attribute__((retain)) \
+ __attribute__((section("pw_mod_pulse_modules"))) \
+ __attribute__((aligned(__alignof__(struct module_info)))) \
+ const struct module_info name
+diff --git a/test/pwtest-implementation.h b/test/pwtest-implementation.h
+index 7bfad01cf..1525d2056 100644
+--- a/test/pwtest-implementation.h
++++ b/test/pwtest-implementation.h
+@@ -131,7 +131,7 @@ void _pwtest_add(struct pwtest_context *ctx,
+ struct pwtest_suite_decl {
+ const char *name;
+ enum pwtest_result (*setup)(struct pwtest_context *, struct pwtest_suite *);
+-} __attribute__((aligned(16)));
++};
+
+
+ #endif /* PWTEST_IMPLEMENTATION_H */
+diff --git a/test/pwtest.h b/test/pwtest.h
+index 9c0737523..6d3070b79 100644
+--- a/test/pwtest.h
++++ b/test/pwtest.h
+@@ -494,9 +494,11 @@ enum pwtest_arg {
+ */
+ #define PWTEST_SUITE(cname) \
+ static enum pwtest_result (cname##__setup)(struct pwtest_context *ctx, struct pwtest_suite *suite); \
+- static const struct pwtest_suite_decl _test_suite \
+ __attribute__((used)) \
+- __attribute((section("pwtest_suite_section"))) = { \
++ __attribute__((retain)) \
++ __attribute__((section("pwtest_suite_section"))) \
++ __attribute__((aligned(__alignof__(struct pwtest_suite_decl)))) \
++ static const struct pwtest_suite_decl _test_suite = { \
+ .name = #cname, \
+ .setup = cname##__setup, \
+ }; \
+--
+GitLab
+