Blame SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch

190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Fedora GDB patches <invalid@email.com>
190f2a
Date: Fri, 27 Oct 2017 21:07:50 +0200
190f2a
Subject: gdb-6.6-buildid-locate-rpm-scl.patch
190f2a
190f2a
;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
190f2a
;;=push+jan
190f2a
190f2a
warning: Skipping deprecated .gdb_index section
190f2a
https://bugzilla.redhat.com/show_bug.cgi?id=953585
190f2a
190f2a
diff --git a/gdb/build-id.c b/gdb/build-id.c
190f2a
--- a/gdb/build-id.c
190f2a
+++ b/gdb/build-id.c
190f2a
@@ -689,7 +689,11 @@ static int missing_rpm_list_entries;
190f2a
 /* Returns the count of newly added rpms.  */
190f2a
 
190f2a
 static int
190f2a
+#ifndef GDB_INDEX_VERIFY_VENDOR
190f2a
 missing_rpm_enlist (const char *filename)
190f2a
+#else
190f2a
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
190f2a
+#endif
190f2a
 {
190f2a
   static int rpm_init_done = 0;
190f2a
   rpmts ts;
190f2a
@@ -796,7 +800,11 @@ missing_rpm_enlist (const char *filename)
190f2a
   mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
190f2a
   if (mi != NULL)
190f2a
     {
190f2a
+#ifndef GDB_INDEX_VERIFY_VENDOR
190f2a
       for (;;)
190f2a
+#else
190f2a
+      if (!verify_vendor) for (;;)
190f2a
+#endif
190f2a
 	{
190f2a
 	  Header h;
190f2a
 	  char *debuginfo, **slot, *s, *s2;
190f2a
@@ -914,6 +922,37 @@ missing_rpm_enlist (const char *filename)
190f2a
 	    xfree (debuginfo);
190f2a
 	  count++;
190f2a
 	}
190f2a
+#ifdef GDB_INDEX_VERIFY_VENDOR
190f2a
+      else /* verify_vendor */
190f2a
+	{
190f2a
+	  int vendor_pass = 0, vendor_fail = 0;
190f2a
+
190f2a
+	  for (;;)
190f2a
+	    {
190f2a
+	      Header h;
190f2a
+	      errmsg_t err;
190f2a
+	      char *vendor;
190f2a
+
190f2a
+	      h = rpmdbNextIterator_p (mi);
190f2a
+	      if (h == NULL)
190f2a
+		break;
190f2a
+
190f2a
+	      vendor = headerFormat_p (h, "%{vendor}", &err;;
190f2a
+	      if (!vendor)
190f2a
+		{
190f2a
+		  warning (_("Error querying the rpm file `%s': %s"), filename,
190f2a
+			   err);
190f2a
+		  continue;
190f2a
+		}
190f2a
+	      if (strcmp (vendor, "Red Hat, Inc.") == 0)
190f2a
+		vendor_pass = 1;
190f2a
+	      else
190f2a
+		vendor_fail = 1;
190f2a
+	      xfree (vendor);
190f2a
+	    }
190f2a
+	  count = vendor_pass != 0 && vendor_fail == 0;
190f2a
+	}
190f2a
+#endif
190f2a
 
190f2a
       rpmdbFreeIterator_p (mi);
190f2a
     }
190f2a
@@ -924,6 +963,21 @@ missing_rpm_enlist (const char *filename)
190f2a
 }
190f2a
 
190f2a
 static int
190f2a
+#ifdef GDB_INDEX_VERIFY_VENDOR
190f2a
+missing_rpm_enlist (const char *filename)
190f2a
+{
190f2a
+  return missing_rpm_enlist_1 (filename, 0);
190f2a
+}
190f2a
+
190f2a
+extern int rpm_verify_vendor (const char *filename);
190f2a
+int
190f2a
+rpm_verify_vendor (const char *filename)
190f2a
+{
190f2a
+  return missing_rpm_enlist_1 (filename, 1);
190f2a
+}
190f2a
+
190f2a
+static int
190f2a
+#endif
190f2a
 missing_rpm_list_compar (const char *const *ap, const char *const *bp)
190f2a
 {
190f2a
   return strcoll (*ap, *bp);
190f2a
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
190f2a
--- a/gdb/dwarf2read.c
190f2a
+++ b/gdb/dwarf2read.c
190f2a
@@ -3469,6 +3469,16 @@ read_gdb_index_from_section (struct objfile *objfile,
190f2a
      "set use-deprecated-index-sections on".  */
190f2a
   if (version < 6 && !deprecated_ok)
190f2a
     {
190f2a
+#ifdef GDB_INDEX_VERIFY_VENDOR
190f2a
+      extern int rpm_verify_vendor (const char *filename);
190f2a
+
190f2a
+      /* Red Hat Developer Toolset exception.  */
190f2a
+      if (rpm_verify_vendor (filename))
190f2a
+	{}
190f2a
+      else
190f2a
+      {
190f2a
+
190f2a
+#endif
190f2a
       static int warning_printed = 0;
190f2a
       if (!warning_printed)
190f2a
 	{
190f2a
@@ -3480,6 +3490,10 @@ to use the section anyway."),
190f2a
 	  warning_printed = 1;
190f2a
 	}
190f2a
       return 0;
190f2a
+#ifdef GDB_INDEX_VERIFY_VENDOR
190f2a
+
190f2a
+      }
190f2a
+#endif
190f2a
     }
190f2a
   /* Version 7 indices generated by gold refer to the CU for a symbol instead
190f2a
      of the TU (for symbols coming from TUs),