1 --- rpm-4.5/tools/debugedit.c.orig 2012-06-23 20:54:51.748542754 +0200
2 +++ rpm-4.5/tools/debugedit.c 2012-06-23 20:56:12.045612104 +0200
6 #define DW_TAG_partial_unit 0x3c
7 +#define DW_FORM_sec_offset 0x17
8 +#define DW_FORM_exprloc 0x18
9 +#define DW_FORM_flag_present 0x19
10 +#define DW_FORM_ref_sig8 0x20
12 char *base_dir = NULL;
13 char *dest_dir = NULL;
14 @@ -250,6 +254,7 @@ static struct
17 #define DEBUG_RANGES 10
18 +#define DEBUG_TYPES 11
19 { ".debug_info", NULL, NULL, 0, 0, 0 },
20 { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
21 { ".debug_line", NULL, NULL, 0, 0, 0 },
22 @@ -261,6 +266,7 @@ static struct
23 { ".debug_str", NULL, NULL, 0, 0, 0 },
24 { ".debug_frame", NULL, NULL, 0, 0, 0 },
25 { ".debug_ranges", NULL, NULL, 0, 0, 0 },
26 + { ".debug_types", NULL, NULL, 0, 0, 0 },
27 { NULL, NULL, NULL, 0, 0, 0 }
30 @@ -353,7 +359,8 @@ no_memory:
33 form = read_uleb128 (ptr);
34 - if (form == 2 || form > DW_FORM_indirect)
36 + || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
38 error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
40 @@ -382,7 +389,6 @@ static char *
41 canonicalize_path (const char *s, char *d)
47 if (IS_DIR_SEPARATOR (*s))
48 @@ -398,7 +404,6 @@ canonicalize_path (const char *s, char *
56 @@ -517,7 +522,7 @@ edit_dwarf2_line (DSO *dso, rpmuint32_t
59 value = read_16 (ptr);
60 - if (value != 2 && value != 3)
61 + if (value != 2 && value != 3 && value != 4)
63 error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
65 @@ -533,8 +538,8 @@ edit_dwarf2_line (DSO *dso, rpmuint32_t
69 - opcode_base = ptr[4];
70 - ptr = dir = ptr + 4 + opcode_base;
71 + opcode_base = ptr[4 + (value >= 4)];
72 + ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
76 @@ -762,7 +767,8 @@ edit_attributes (DSO *dso, unsigned char
78 if (t->attr[i].attr == DW_AT_stmt_list)
80 - if (form == DW_FORM_data4)
81 + if (form == DW_FORM_data4
82 + || form == DW_FORM_sec_offset)
84 list_offs = do_read_32_relocated (ptr);
86 @@ -868,6 +874,8 @@ edit_attributes (DSO *dso, unsigned char
90 + case DW_FORM_flag_present:
95 @@ -882,10 +890,12 @@ edit_attributes (DSO *dso, unsigned char
99 + case DW_FORM_sec_offset:
104 + case DW_FORM_ref_sig8:
108 @@ -914,6 +924,7 @@ edit_attributes (DSO *dso, unsigned char
109 form = DW_FORM_block1;
112 + case DW_FORM_exprloc:
113 len = read_uleb128 (ptr);
114 form = DW_FORM_block1;
115 assert (len < UINT_MAX);
116 @@ -1217,7 +1228,7 @@ edit_dwarf2 (DSO *dso)
119 cu_version = read_16 (ptr);
120 - if (cu_version != 2 && cu_version != 3)
121 + if (cu_version != 2 && cu_version != 3 && cu_version != 4)
123 error (0, 0, "%s: DWARF version %d unhandled", dso->filename,