diff --git a/0001-Add-flag-to-use-strip-g-instead-of-full-strip-on-DSO.patch b/0001-Add-flag-to-use-strip-g-instead-of-full-strip-on-DSO.patch new file mode 100644 index 0000000..69e7575 --- /dev/null +++ b/0001-Add-flag-to-use-strip-g-instead-of-full-strip-on-DSO.patch @@ -0,0 +1,99 @@ +From 1da9e839bb573b9187403983f5a69853ab364306 Mon Sep 17 00:00:00 2001 +Message-Id: <1da9e839bb573b9187403983f5a69853ab364306.1554879119.git.pmatilai@redhat.com> +From: Pavlina Moravcova Varekova +Date: Sun, 17 Mar 2019 06:47:26 +0100 +Subject: [PATCH] Add flag to use strip -g instead of full strip on DSOs + (RhBug:1663264) + +The find-debuginfo.sh flag -g had exactly this meaning. But from +version rpm-4.13.0-alpha flag -g changes its behavior. It affects +both libraries and executables. + +For some packages the original behavior was preferred. That is why +the new find-debuginfo.sh flag --g-libs is created. + +Options -g and --g-libs are mutually exclusive. +--- + scripts/find-debuginfo.sh | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh +index 6e3ba2ce0..c75d176ac 100755 +--- a/scripts/find-debuginfo.sh ++++ b/scripts/find-debuginfo.sh +@@ -4,6 +4,7 @@ + # + # Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m] [-i] [-n] + # [--keep-section SECTION] [--remove-section SECTION] ++# [--g-libs] + # [-j N] [--jobs N] + # [-o debugfiles.list] + # [-S debugsourcefiles.list] +@@ -16,6 +17,8 @@ + # [builddir] + # + # The -g flag says to use strip -g instead of full strip on DSOs or EXEs. ++# The --g-libs flag says to use strip -g instead of full strip ONLY on DSOs. ++# Options -g and --g-libs are mutually exclusive. + # The -r flag says to use eu-strip --reloc-debug-sections. + # Use --keep-section SECTION or --remove-section SECTION to explicitly + # keep a (non-allocated) section in the main executable or explicitly +@@ -68,6 +71,9 @@ lib_rpm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + # With -g arg, pass it to strip on libraries or executables. + strip_g=false + ++# With --g-libs arg, pass it to strip on libraries. ++strip_glibs=false ++ + # with -r arg, pass --reloc-debug-sections to eu-strip. + strip_r=false + +@@ -135,6 +141,9 @@ while [ $# -gt 0 ]; do + unique_debug_src_base=$2 + shift + ;; ++ --g-libs) ++ strip_glibs=true ++ ;; + -g) + strip_g=true + ;; +@@ -204,6 +213,11 @@ if test -n "$build_id_seed" -a "$no_recompute_build_id" = "true"; then + exit 2 + fi + ++if ("$strip_g" = "true") && ("$strip_glibs" = "true"); then ++ echo >&2 "*** ERROR: -g and --g-libs cannot be used together" ++ exit 2 ++fi ++ + i=0 + while ((i < nout)); do + outs[$i]="$BUILDDIR/${outs[$i]}" +@@ -237,6 +251,9 @@ strip_to_debug() + application/x-executable*) g=-g ;; + application/x-pie-executable*) g=-g ;; + esac ++ $strip_glibs && case "$(file -bi "$2")" in ++ application/x-sharedlib*) g=-g ;; ++ esac + eu-strip --remove-comment $r $g ${keep_remove_args} -f "$1" "$2" || exit + chmod 444 "$1" || exit + } +@@ -409,8 +426,12 @@ do_file() + # libraries. Other executable ELF files (like kernel modules) don't need it. + if [ "$include_minidebug" = "true" -a "$strip_g" = "false" ]; then + skip_mini=true ++ if [ "$strip_glibs" = "false" ]; then ++ case "$(file -bi "$f")" in ++ application/x-sharedlib*) skip_mini=false ;; ++ esac ++ fi + case "$(file -bi "$f")" in +- application/x-sharedlib*) skip_mini=false ;; + application/x-executable*) skip_mini=false ;; + application/x-pie-executable*) skip_mini=false ;; + esac +-- +2.20.1 + diff --git a/0001-find-debuginfo.sh-Handle-position-independent-execut.patch b/0001-find-debuginfo.sh-Handle-position-independent-execut.patch new file mode 100644 index 0000000..045418a --- /dev/null +++ b/0001-find-debuginfo.sh-Handle-position-independent-execut.patch @@ -0,0 +1,30 @@ +From 0917da26bf0722fcf40de1c5a61412f23982d131 Mon Sep 17 00:00:00 2001 +Message-Id: <0917da26bf0722fcf40de1c5a61412f23982d131.1554881054.git.pmatilai@redhat.com> +From: Ernestas Kulik +Date: Mon, 25 Feb 2019 16:34:06 +0100 +Subject: [PATCH] find-debuginfo.sh: Handle position-independent executables + +Since file 5.33, PIEs are identified by a new MIME type, meaning that, +currently, for such executables, the .gnu_debugdata section is not +added, even if -m is passed. + +Signed-off-by: Ernestas Kulik +--- + scripts/find-debuginfo.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh +index 967814509..6e3ba2ce0 100755 +--- a/scripts/find-debuginfo.sh ++++ b/scripts/find-debuginfo.sh +@@ -412,6 +412,7 @@ do_file() + case "$(file -bi "$f")" in + application/x-sharedlib*) skip_mini=false ;; + application/x-executable*) skip_mini=false ;; ++ application/x-pie-executable*) skip_mini=false ;; + esac + $skip_mini || add_minidebug "${debugfn}" "$f" + fi +-- +2.20.1 + diff --git a/rpm.spec b/rpm.spec index fb64ba8..954665c 100644 --- a/rpm.spec +++ b/rpm.spec @@ -23,7 +23,7 @@ %global rpmver 4.14.2.1 #global snapver rc2 -%global rel 4 +%global rel 5 %global srcver %{version}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} @@ -61,6 +61,8 @@ Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch Patch103: 0001-rpmfc-push-name-epoch-version-release-macro-before-i.patch Patch104: 0001-Take-_prefix-into-account-when-compressing-man-pages.patch Patch105: rpm-4.14.2-RPMTAG_MODULARITYLABEL.patch +Patch106: 0001-find-debuginfo.sh-Handle-position-independent-execut.patch +Patch107: 0001-Add-flag-to-use-strip-g-instead-of-full-strip-on-DSO.patch # These are not yet upstream Patch906: rpm-4.7.1-geode-i686.patch @@ -568,6 +570,10 @@ make check || (cat tests/rpmtests.log; exit 1) %doc doc/librpm/html/* %changelog +* Wed Apr 10 2019 Panu Matilainen - 4.14.2.1-5 +- Generate minidebug for PIE executables on file >= 5.33 too +- Backport find-debuginfo --g-libs option for glibc's benefit (#1661512) + * Sat Feb 02 2019 Fedora Release Engineering - 4.14.2.1-4.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild