aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhushan Attarde <bhushan.attarde@imgtec.com>2016-09-14 13:49:16 +0100
committerNick Clifton <nickc@redhat.com>2016-09-14 13:49:16 +0100
commit5d9bbb73c1df68741048c3d0f837b50c289ea608 (patch)
tree878758b70ad43df5e7b5d1d83f56c5e864f68c2b
parent32348c581bf104d46c3fb42a7ff5cefe8ef65f7f (diff)
downloadgdb-5d9bbb73c1df68741048c3d0f837b50c289ea608.zip
gdb-5d9bbb73c1df68741048c3d0f837b50c289ea608.tar.gz
gdb-5d9bbb73c1df68741048c3d0f837b50c289ea608.tar.bz2
Prevent segfault in GDB when searching for architecture matches.
* format.c (struct bfd_preserve): New "build_id" field. (bfd_preserve_save): Save "build_id". (bfd_preserve_restore): Restore "build_id".
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/format.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6863e3a..7414c39 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-14 Bhushan Attarde <bhushan.attarde@imgtec.com>
+
+ * format.c (struct bfd_preserve): New "build_id" field.
+ (bfd_preserve_save): Save "build_id".
+ (bfd_preserve_restore): Restore "build_id".
+
2016-09-06 H.J. Lu <hongjiu.lu@intel.com>
PR ld/20550
diff --git a/bfd/format.c b/bfd/format.c
index f34b1d4..15237a3 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -104,6 +104,7 @@ struct bfd_preserve
struct bfd_section *section_last;
unsigned int section_count;
struct bfd_hash_table section_htab;
+ const struct bfd_build_id *build_id;
};
/* When testing an object for compatibility with a particular target
@@ -126,6 +127,7 @@ bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
preserve->section_count = abfd->section_count;
preserve->section_htab = abfd->section_htab;
preserve->marker = bfd_alloc (abfd, 1);
+ preserve->build_id = abfd->build_id;
if (preserve->marker == NULL)
return FALSE;
@@ -158,6 +160,7 @@ bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
abfd->sections = preserve->sections;
abfd->section_last = preserve->section_last;
abfd->section_count = preserve->section_count;
+ abfd->build_id = preserve->build_id;
/* bfd_release frees all memory more recently bfd_alloc'd than
its arg, as well as its arg. */