]>
Commit | Line | Data |
---|---|---|
1 | From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 | |
2 | From: Fedora GDB patches <invalid@email.com> | |
3 | Date: Fri, 27 Oct 2017 21:07:50 +0200 | |
4 | Subject: gdb-6.6-buildid-locate-rpm-scl.patch | |
5 | ||
6 | ;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). | |
7 | ;;=push+jan | |
8 | ||
9 | warning: Skipping deprecated .gdb_index section | |
10 | https://bugzilla.redhat.com/show_bug.cgi?id=953585 | |
11 | ||
12 | diff --git a/gdb/build-id.c b/gdb/build-id.c | |
13 | --- a/gdb/build-id.c | |
14 | +++ b/gdb/build-id.c | |
15 | @@ -689,7 +689,11 @@ static int missing_rpm_list_entries; | |
16 | /* Returns the count of newly added rpms. */ | |
17 | ||
18 | static int | |
19 | +#ifndef GDB_INDEX_VERIFY_VENDOR | |
20 | missing_rpm_enlist (const char *filename) | |
21 | +#else | |
22 | +missing_rpm_enlist_1 (const char *filename, int verify_vendor) | |
23 | +#endif | |
24 | { | |
25 | static int rpm_init_done = 0; | |
26 | rpmts ts; | |
27 | @@ -796,7 +800,11 @@ missing_rpm_enlist (const char *filename) | |
28 | mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); | |
29 | if (mi != NULL) | |
30 | { | |
31 | +#ifndef GDB_INDEX_VERIFY_VENDOR | |
32 | for (;;) | |
33 | +#else | |
34 | + if (!verify_vendor) for (;;) | |
35 | +#endif | |
36 | { | |
37 | Header h; | |
38 | char *debuginfo, **slot, *s, *s2; | |
39 | @@ -914,6 +922,37 @@ missing_rpm_enlist (const char *filename) | |
40 | xfree (debuginfo); | |
41 | count++; | |
42 | } | |
43 | +#ifdef GDB_INDEX_VERIFY_VENDOR | |
44 | + else /* verify_vendor */ | |
45 | + { | |
46 | + int vendor_pass = 0, vendor_fail = 0; | |
47 | + | |
48 | + for (;;) | |
49 | + { | |
50 | + Header h; | |
51 | + errmsg_t err; | |
52 | + char *vendor; | |
53 | + | |
54 | + h = rpmdbNextIterator_p (mi); | |
55 | + if (h == NULL) | |
56 | + break; | |
57 | + | |
58 | + vendor = headerFormat_p (h, "%{vendor}", &err); | |
59 | + if (!vendor) | |
60 | + { | |
61 | + warning (_("Error querying the rpm file `%s': %s"), filename, | |
62 | + err); | |
63 | + continue; | |
64 | + } | |
65 | + if (strcmp (vendor, "Red Hat, Inc.") == 0) | |
66 | + vendor_pass = 1; | |
67 | + else | |
68 | + vendor_fail = 1; | |
69 | + xfree (vendor); | |
70 | + } | |
71 | + count = vendor_pass != 0 && vendor_fail == 0; | |
72 | + } | |
73 | +#endif | |
74 | ||
75 | rpmdbFreeIterator_p (mi); | |
76 | } | |
77 | @@ -924,6 +963,21 @@ missing_rpm_enlist (const char *filename) | |
78 | } | |
79 | ||
80 | static int | |
81 | +#ifdef GDB_INDEX_VERIFY_VENDOR | |
82 | +missing_rpm_enlist (const char *filename) | |
83 | +{ | |
84 | + return missing_rpm_enlist_1 (filename, 0); | |
85 | +} | |
86 | + | |
87 | +extern int rpm_verify_vendor (const char *filename); | |
88 | +int | |
89 | +rpm_verify_vendor (const char *filename) | |
90 | +{ | |
91 | + return missing_rpm_enlist_1 (filename, 1); | |
92 | +} | |
93 | + | |
94 | +static int | |
95 | +#endif | |
96 | missing_rpm_list_compar (const char *const *ap, const char *const *bp) | |
97 | { | |
98 | return strcoll (*ap, *bp); | |
99 | diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c | |
100 | --- a/gdb/dwarf2read.c | |
101 | +++ b/gdb/dwarf2read.c | |
102 | @@ -3469,6 +3469,16 @@ read_gdb_index_from_section (struct objfile *objfile, | |
103 | "set use-deprecated-index-sections on". */ | |
104 | if (version < 6 && !deprecated_ok) | |
105 | { | |
106 | +#ifdef GDB_INDEX_VERIFY_VENDOR | |
107 | + extern int rpm_verify_vendor (const char *filename); | |
108 | + | |
109 | + /* Red Hat Developer Toolset exception. */ | |
110 | + if (rpm_verify_vendor (filename)) | |
111 | + {} | |
112 | + else | |
113 | + { | |
114 | + | |
115 | +#endif | |
116 | static int warning_printed = 0; | |
117 | if (!warning_printed) | |
118 | { | |
119 | @@ -3480,6 +3490,10 @@ to use the section anyway."), | |
120 | warning_printed = 1; | |
121 | } | |
122 | return 0; | |
123 | +#ifdef GDB_INDEX_VERIFY_VENDOR | |
124 | + | |
125 | + } | |
126 | +#endif | |
127 | } | |
128 | /* Version 7 indices generated by gold refer to the CU for a symbol instead | |
129 | of the TU (for symbols coming from TUs), |