alexk / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
ed184b
From cc1965ce3acaa7d9356b7671050a15e2cda2f424 Mon Sep 17 00:00:00 2001
ed184b
Message-Id: <cc1965ce3acaa7d9356b7671050a15e2cda2f424.1571917336.git.pmatilai@redhat.com>
ed184b
From: nickclifton <31441682+nickclifton@users.noreply.github.com>
ed184b
Date: Wed, 19 Jun 2019 12:45:09 +0100
ed184b
Subject: [PATCH] Add step to find-debuginfo.sh script to compress annobin
ed184b
 notes.
ed184b
ed184b
With the introduction of the annobin gcc plugin to the build process,
ed184b
built binary files have become larger.  Sometimes significantly so.
ed184b
This is a patch that adds a new step to the post-link process performed
ed184b
by rpmbuild, to run the objcopy program with the --merge-notes option
ed184b
specified.  This will reduce the size of the annobin notes in binary
ed184b
files, thus alleviating the size growth.
ed184b
---
ed184b
 scripts/find-debuginfo.sh | 4 ++++
ed184b
 1 file changed, 4 insertions(+)
ed184b
ed184b
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
ed184b
index d75da1108..2e9d76531 100755
ed184b
--- a/scripts/find-debuginfo.sh
ed184b
+++ b/scripts/find-debuginfo.sh
ed184b
@@ -405,6 +405,10 @@ do_file()
ed184b
     fi
ed184b
   fi
ed184b
 
ed184b
+  # Compress any annobin notes in the original binary.
ed184b
+  # Ignore any errors, since older objcopy don't support --merge-notes.
ed184b
+  objcopy --merge-notes "$f" 2>/dev/null || true
ed184b
+
ed184b
   # A binary already copied into /usr/lib/debug doesn't get stripped,
ed184b
   # just has its file names collected and adjusted.
ed184b
   case "$dn" in
ed184b
-- 
ed184b
2.21.0
ed184b