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