[v2,1/6] Fix CORE_ADDR size assertion in symfile-mem.c

Message ID 20200225222243.8260-2-tom@tromey.com
State New
Headers show
  • Change gdbserver to use existing gdbsupport
Related show

Commit Message

Tom Tromey Feb. 25, 2020, 10:22 p.m.
symfile-mem.c has some assertions about the size of various types, to
ensure that gdb and BFD don't get out of sync in a way that would
cause bugs.

Once CORE_ADDR is always 64-bit, one of these assertions can fail for
a 32-bit BFD build.  However, the real requirement here is just that
CORE_ADDR is wider -- because this code promotes a bfd_vma to a

This patch corrects the assert.

2020-02-25  Tom Tromey  <tom@tromey.com>

	* symfile-mem.c: Update CORE_ADDR size assert.
 gdb/ChangeLog     | 4 ++++
 gdb/symfile-mem.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)



diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index a62d0d0c8f4..e2d2e43d7fa 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -57,7 +57,7 @@ 
 /* Verify parameters of target_read_memory_bfd and target_read_memory are
    compatible.  */
-gdb_static_assert (sizeof (CORE_ADDR) == sizeof (bfd_vma));
+gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (bfd_vma));
 gdb_static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
 gdb_static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));