[rpm] - add dwarf-4 support to debugedit (#707677) - generate build-id symlinks for all filenames sharing
Panu Matilainen
pmatilai at fedoraproject.org
Thu May 26 07:10:17 UTC 2011
commit aca4330de012cacb7b6e281b35ef580628b1fc1e
Author: Panu Matilainen <pmatilai at redhat.com>
Date: Thu May 26 10:06:47 2011 +0300
- add dwarf-4 support to debugedit (#707677)
- generate build-id symlinks for all filenames sharing a build-id (#641377)
rpm-4.9.0-debugedit-dwarf4.patch | 130 ++++++++++++++++++++++++++++++++++++
rpm-4.9.0-debuginfo-allnames.patch | 55 +++++++++++++++
rpm.spec | 11 +++-
3 files changed, 195 insertions(+), 1 deletions(-)
---
diff --git a/rpm-4.9.0-debugedit-dwarf4.patch b/rpm-4.9.0-debugedit-dwarf4.patch
new file mode 100644
index 0000000..e10e1f1
--- /dev/null
+++ b/rpm-4.9.0-debugedit-dwarf4.patch
@@ -0,0 +1,130 @@
+--- rpm-4.9.0/tools/debugedit.c 2010-12-03 13:11:57.000000000 +0100
++++ rpm-4.9.0/tools/debugedit.c.jj 2011-05-25 18:49:53.151936963 +0200
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009, 2010 Red Hat, Inc.
++/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009, 2010, 2011 Red Hat, Inc.
+ Written by Alexander Larsson <alexl at redhat.com>, 2002
+ Based on code by Jakub Jelinek <jakub at redhat.com>, 2001.
+
+@@ -44,6 +44,10 @@
+ #include "tools/hashtab.h"
+
+ #define DW_TAG_partial_unit 0x3c
++#define DW_FORM_sec_offset 0x17
++#define DW_FORM_exprloc 0x18
++#define DW_FORM_flag_present 0x19
++#define DW_FORM_ref_sig8 0x20
+
+ char *base_dir = NULL;
+ char *dest_dir = NULL;
+@@ -220,6 +224,7 @@ static struct
+ #define DEBUG_STR 8
+ #define DEBUG_FRAME 9
+ #define DEBUG_RANGES 10
++#define DEBUG_TYPES 11
+ { ".debug_info", NULL, NULL, 0, 0, 0 },
+ { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
+ { ".debug_line", NULL, NULL, 0, 0, 0 },
+@@ -231,6 +236,7 @@ static struct
+ { ".debug_str", NULL, NULL, 0, 0, 0 },
+ { ".debug_frame", NULL, NULL, 0, 0, 0 },
+ { ".debug_ranges", NULL, NULL, 0, 0, 0 },
++ { ".debug_types", NULL, NULL, 0, 0, 0 },
+ { NULL, NULL, NULL, 0, 0, 0 }
+ };
+
+@@ -323,7 +329,8 @@ no_memory:
+ goto no_memory;
+ }
+ form = read_uleb128 (ptr);
+- if (form == 2 || form > DW_FORM_indirect)
++ if (form == 2
++ || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
+ {
+ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
+ htab_delete (h);
+@@ -352,7 +359,6 @@ static char *
+ canonicalize_path (const char *s, char *d)
+ {
+ char *rv = d;
+- const char *sroot;
+ char *droot;
+
+ if (IS_DIR_SEPARATOR (*s))
+@@ -368,7 +374,6 @@ canonicalize_path (const char *s, char *
+ s++;
+ }
+ droot = d;
+- sroot = s;
+
+ while (*s)
+ {
+@@ -495,7 +500,7 @@ edit_dwarf2_line (DSO *dso, uint32_t off
+ }
+
+ value = read_16 (ptr);
+- if (value != 2 && value != 3)
++ if (value != 2 && value != 3 && value != 4)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ value);
+@@ -511,8 +516,8 @@ edit_dwarf2_line (DSO *dso, uint32_t off
+ return 1;
+ }
+
+- opcode_base = ptr[4];
+- ptr = dir = ptr + 4 + opcode_base;
++ opcode_base = ptr[4 + (value >= 4)];
++ ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
+
+ /* dir table: */
+ value = 1;
+@@ -739,7 +744,8 @@ edit_attributes (DSO *dso, unsigned char
+ {
+ if (t->attr[i].attr == DW_AT_stmt_list)
+ {
+- if (form == DW_FORM_data4)
++ if (form == DW_FORM_data4
++ || form == DW_FORM_sec_offset)
+ {
+ list_offs = do_read_32_relocated (ptr);
+ found_list_offs = 1;
+@@ -841,6 +847,8 @@ edit_attributes (DSO *dso, unsigned char
+ else
+ ptr += 4;
+ break;
++ case DW_FORM_flag_present:
++ break;
+ case DW_FORM_addr:
+ ptr += ptr_size;
+ break;
+@@ -855,10 +863,12 @@ edit_attributes (DSO *dso, unsigned char
+ break;
+ case DW_FORM_ref4:
+ case DW_FORM_data4:
++ case DW_FORM_sec_offset:
+ ptr += 4;
+ break;
+ case DW_FORM_ref8:
+ case DW_FORM_data8:
++ case DW_FORM_ref_sig8:
+ ptr += 8;
+ break;
+ case DW_FORM_sdata:
+@@ -887,6 +897,7 @@ edit_attributes (DSO *dso, unsigned char
+ form = DW_FORM_block1;
+ break;
+ case DW_FORM_block:
++ case DW_FORM_exprloc:
+ len = read_uleb128 (ptr);
+ form = DW_FORM_block1;
+ assert (len < UINT_MAX);
+@@ -1190,7 +1201,7 @@ edit_dwarf2 (DSO *dso)
+ }
+
+ cu_version = read_16 (ptr);
+- if (cu_version != 2 && cu_version != 3)
++ if (cu_version != 2 && cu_version != 3 && cu_version != 4)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ cu_version);
diff --git a/rpm-4.9.0-debuginfo-allnames.patch b/rpm-4.9.0-debuginfo-allnames.patch
new file mode 100644
index 0000000..125c85c
--- /dev/null
+++ b/rpm-4.9.0-debuginfo-allnames.patch
@@ -0,0 +1,55 @@
+--- rpm-4.9.0/scripts/find-debuginfo.sh 2011-02-19 07:57:21.000000000 +0100
++++ rpm-4.9.0/scripts/find-debuginfo.sh.orig 2011-02-19 08:50:23.000000000 +0100
+@@ -127,6 +127,23 @@ debug_link()
+ link_relative "$t" "$l" "$RPM_BUILD_ROOT"
+ }
+
++# Provide .2, .3, ... symlinks to all filename instances of this build-id.
++make_id_dup_link()
++{
++ local id="$1" file="$2" idfile
++
++ local n=1
++ while true; do
++ idfile=".build-id/${id:0:2}/${id:2}.$n"
++ [ $# -eq 3 ] && idfile="${idfile}$3"
++ if [ ! -L "$RPM_BUILD_ROOT/usr/lib/debug/$idfile" ]; then
++ break
++ fi
++ n=$[$n+1]
++ done
++ debug_link "$file" "/$idfile"
++}
++
+ # Make a build-id symlink for id $1 with suffix $3 to file $2.
+ make_id_link()
+ {
+@@ -140,6 +157,8 @@ make_id_link()
+ return
+ fi
+
++ make_id_dup_link "$@"
++
+ [ $# -eq 3 ] && return 0
+
+ local other=$(readlink -m "$root_idfile")
+@@ -188,6 +207,9 @@ while read nlinks inum f; do
+ if [ $nlinks -gt 1 ]; then
+ eval linked=\$linked_$inum
+ if [ -n "$linked" ]; then
++ eval id=\$linkedid_$inum
++ make_id_dup_link "$id" "$dn/$(basename $f)"
++ make_id_dup_link "$id" "/usr/lib/debug$dn/$bn" .debug
+ link=$debugfn
+ get_debugfn "$linked"
+ echo "hard linked $link to $debugfn"
+@@ -202,6 +224,9 @@ while read nlinks inum f; do
+ echo "extracting debug info from $f"
+ id=$(/usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
+ -i -l "$SOURCEFILE" "$f") || exit
++ if [ $nlinks -gt 1 ]; then
++ eval linkedid_$inum=\$id
++ fi
+ if [ -z "$id" ]; then
+ echo >&2 "*** ${strict_error}: No build ID note found in $f"
+ $strict && exit 2
diff --git a/rpm.spec b/rpm.spec
index c8cd53c..b33e46c 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}7%{?dist}
+Release: %{?snapver:0.%{snapver}.}8%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.9.x/%{name}-%{srcver}.tar.bz2
@@ -58,6 +58,9 @@ Patch106: rpm-4.9.0-prefcolor-erase.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
Patch302: rpm-4.7.1-geode-i686.patch
+# To be upstreamed after rawhide-testdrive (#641377, #707677)
+Patch303: rpm-4.9.0-debugedit-dwarf4.patch
+Patch304: rpm-4.9.0-debuginfo-allnames.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@@ -230,6 +233,8 @@ packages on a system.
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
+%patch303 -p1 -b .dwarf-4
+%patch304 -p1 -b .debuginfo-allnames
%if %{with int_bdb}
ln -s db-%{bdbver} db
@@ -443,6 +448,10 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
+* Thu May 26 2011 Panu Matilainen <pmatilai at redhat.com> - 4.9.0-8
+- add dwarf-4 support to debugedit (#707677)
+- generate build-id symlinks for all filenames sharing a build-id (#641377)
+
* Thu Apr 07 2011 Panu Matilainen <pmatilai at redhat.com> - 4.9.0-7
- add missing ldconfig calls to build-libs sub-package
- fix source url
More information about the scm-commits
mailing list