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

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