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

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