Blame SOURCES/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch

190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Fedora GDB patches <invalid@email.com>
190f2a
Date: Fri, 27 Oct 2017 21:07:50 +0200
190f2a
Subject: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
190f2a
190f2a
;; Toolchain on sparc is slightly broken and debuginfo files are generated
190f2a
;; with non 64bit aligned tables/offsets.
190f2a
;; See for example readelf -S ../Xvnc.debug.
190f2a
;;
190f2a
;; As a consenquence calculation of sectp->filepos as used in
190f2a
;; dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer
190f2a
;; that cannot be used directly as done with MMAP.
190f2a
;; Usage will result in a BusError.
190f2a
;;
190f2a
;; While we figure out what's wrong in the toolchain and do a full archive
190f2a
;; rebuild to fix it, we need to be able to use gdb :)
190f2a
;;=push
190f2a
190f2a
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
190f2a
--- a/gdb/gdb_bfd.c
190f2a
+++ b/gdb/gdb_bfd.c
190f2a
@@ -24,12 +24,14 @@
190f2a
 #include "hashtab.h"
190f2a
 #include "filestuff.h"
190f2a
 #include "vec.h"
190f2a
+#ifndef __sparc__
190f2a
 #ifdef HAVE_MMAP
190f2a
 #include <sys/mman.h>
190f2a
 #ifndef MAP_FAILED
190f2a
 #define MAP_FAILED ((void *) -1)
190f2a
 #endif
190f2a
 #endif
190f2a
+#endif
190f2a
 #include "target.h"
190f2a
 #include "gdb/fileio.h"
190f2a
 #include "inferior.h"
190f2a
@@ -484,6 +486,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
190f2a
 
190f2a
   if (sect != NULL && sect->data != NULL)
190f2a
     {
190f2a
+#ifndef __sparc__
190f2a
 #ifdef HAVE_MMAP
190f2a
       if (sect->map_addr != NULL)
190f2a
 	{
190f2a
@@ -493,6 +496,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
190f2a
 	  gdb_assert (res == 0);
190f2a
 	}
190f2a
       else
190f2a
+#endif
190f2a
 #endif
190f2a
 	xfree (sect->data);
190f2a
     }
190f2a
@@ -659,6 +663,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
190f2a
   if (descriptor->data != NULL)
190f2a
     goto done;
190f2a
 
190f2a
+#ifndef __sparc__
190f2a
 #ifdef HAVE_MMAP
190f2a
   if (!bfd_is_section_compressed (abfd, sectp))
190f2a
     {
190f2a
@@ -693,6 +698,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
190f2a
 	}
190f2a
     }
190f2a
 #endif /* HAVE_MMAP */
190f2a
+#endif
190f2a
 
190f2a
   /* Handle compressed sections, or ordinary uncompressed sections in
190f2a
      the no-mmap case.  */