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