summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gnome-base/librsvg/files/librsvg-2.56.0-gc-sections-shrink.patch')
-rw-r--r--gnome-base/librsvg/files/librsvg-2.56.0-gc-sections-shrink.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/gnome-base/librsvg/files/librsvg-2.56.0-gc-sections-shrink.patch b/gnome-base/librsvg/files/librsvg-2.56.0-gc-sections-shrink.patch
new file mode 100644
index 000000000000..d20909f4eaa5
--- /dev/null
+++ b/gnome-base/librsvg/files/librsvg-2.56.0-gc-sections-shrink.patch
@@ -0,0 +1,53 @@
+https://gitlab.gnome.org/GNOME/librsvg/-/issues/965
+https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/832
+https://github.com/rust-lang/rust/issues/111593
+
+From 61bba147f65019eab2a42148065798bc568169ab Mon Sep 17 00:00:00 2001
+From: Federico Mena Quintero <federico@gnome.org>
+Date: Thu, 18 May 2023 17:57:01 -0600
+Subject: [PATCH] (#965): Shrink the shared library by telling the linker to
+ omit unused code
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Thanks to Sebastian Dröge for spotting this.
+
+Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/965
+
+Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/832>
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -217,12 +217,24 @@ librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = $(AM_CPPFLAGS)
+
+ librsvg_@RSVG_API_MAJOR_VERSION@_la_CFLAGS = $(AM_CFLAGS)
+
+-librsvg_@RSVG_API_MAJOR_VERSION@_la_LDFLAGS = \
+- $(BSYMBOLIC_LDFLAG) \
+- -version-info @RSVG_LT_VERSION_INFO@ \
+- -export-dynamic \
+- -no-undefined \
+- -export-symbols-regex "^rsvg_.*" \
++# This is not strictly needed, but since we are telling Cargo to build a staticlib, it puts in
++# all of Rust's standard library and code from dependencies even when it is not needed.
++# With the following, we shrink the final .so size; see issue #965.
++#
++# This will no longer be needed when we switch to cargo-cbuild, which does this automatically.
++if OS_DARWIN
++gc_linked_library_args="-Wl,-dead_strip"
++else
++gc_linked_library_args="-Wl,--gc-sections"
++endif
++
++librsvg_@RSVG_API_MAJOR_VERSION@_la_LDFLAGS = \
++ $(BSYMBOLIC_LDFLAG) \
++ -version-info @RSVG_LT_VERSION_INFO@ \
++ -export-dynamic \
++ -no-undefined \
++ -export-symbols-regex "^rsvg_.*" \
++ $(gc_linked_library_args) \
+ $(AM_LDFLAGS)
+
+ if OS_DARWIN
+--
+GitLab