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

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