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

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