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

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