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

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