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

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