Skip to content

Commit 3f4eea7

Browse files
ivanivanov884jeffmahoney
authored andcommitted
gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
;; Toolchain on sparc is slightly broken and debuginfo files are generated ;; with non 64bit aligned tables/offsets. ;; See for example readelf -S ../Xvnc.debug. ;; ;; As a consenquence calculation of sectp->filepos as used in ;; dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer ;; that cannot be used directly as done with MMAP. ;; Usage will result in a BusError. ;; ;; While we figure out what's wrong in the toolchain and do a full archive ;; rebuild to fix it, we need to be able to use gdb :) ;;=push
1 parent 97c509b commit 3f4eea7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gdb/gdb_bfd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
#include "hashtab.h"
2525
#include "common/filestuff.h"
2626
#include "common/vec.h"
27+
#ifndef __sparc__
2728
#ifdef HAVE_MMAP
2829
#include <sys/mman.h>
2930
#ifndef MAP_FAILED
3031
#define MAP_FAILED ((void *) -1)
3132
#endif
3233
#endif
34+
#endif
3335
#include "target.h"
3436
#include "gdb/fileio.h"
3537
#include "inferior.h"
@@ -484,6 +486,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
484486

485487
if (sect != NULL && sect->data != NULL)
486488
{
489+
#ifndef __sparc__
487490
#ifdef HAVE_MMAP
488491
if (sect->map_addr != NULL)
489492
{
@@ -493,6 +496,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
493496
gdb_assert (res == 0);
494497
}
495498
else
499+
#endif
496500
#endif
497501
xfree (sect->data);
498502
}
@@ -659,6 +663,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
659663
if (descriptor->data != NULL)
660664
goto done;
661665

666+
#ifndef __sparc__
662667
#ifdef HAVE_MMAP
663668
if (!bfd_is_section_compressed (abfd, sectp))
664669
{
@@ -693,6 +698,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
693698
}
694699
}
695700
#endif /* HAVE_MMAP */
701+
#endif
696702

697703
/* Handle compressed sections, or ordinary uncompressed sections in
698704
the no-mmap case. */

0 commit comments

Comments
 (0)