ports: GDB fixes

Fixes #4976
This commit is contained in:
Christian Prochaska 2023-08-08 06:47:46 +02:00 committed by Christian Helmuth
parent 48e6468df1
commit 9e41848927
5 changed files with 139 additions and 7 deletions

View File

@ -1 +1 @@
59a56418c6720518cfc7e4485557dd2c707b5e03
3b5bd5ce53f96a52eb48eca9c95066e307636367

View File

@ -0,0 +1,58 @@
From 5fc6b6d44cd63651c2902cbfc5b9734a55aaa617 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Tue, 7 Mar 2023 14:21:50 +0000
Subject: [PATCH] gdb: Fix GDB_AC_CHECK_BFD macro regression
Commit 5218fa9e8937b007d554f1e01c2e4ecdb9b7e271, "gdb: use libtool in
GDB_AC_CHECK_BFD" dropped passing in existing LDFLAGS. In our environment,
this caused the configure check "checking for ELF support in BFD" to stop
working causing build failures as we need our LDFLAGS to be used for
correct linking.
That change also meant the code failed to match the comments. Add back the
missing LDFLAGS preservation, fix our builds and match the comment.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Change-Id: Ie91509116fab29f95b9db1ff0b6ddc280d460112
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-By: Jose E. Marchesi <jose.marchesi@oracle.com>
---
gdb/acinclude.m4 | 2 +-
gdb/configure | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 05106df8ee62..173e40b440af 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -234,7 +234,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [
# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
# always want our bfd.
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
- LDFLAGS="-L../bfd -L../libiberty"
+ LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
LIBS="-lbfd -liberty $intl $LIBS"
CC="./libtool --quiet --mode=link $CC"
diff --git a/gdb/configure b/gdb/configure
index 017ec05e4b71..5bb2a0795e59 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -28206,7 +28206,7 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
# always want our bfd.
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
- LDFLAGS="-L../bfd -L../libiberty"
+ LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
LIBS="-lbfd -liberty $intl $LIBS"
CC="./libtool --quiet --mode=link $CC"
@@ -28323,7 +28323,7 @@ fi
# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
# always want our bfd.
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
- LDFLAGS="-L../bfd -L../libiberty"
+ LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
LIBS="-lbfd -liberty $intl $LIBS"
CC="./libtool --quiet --mode=link $CC"

View File

@ -0,0 +1,23 @@
non_stop.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Fix a failed assertion in non-stop mode if more than
one thread is initially stopped.
---
gdb/remote.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index 218bca3..b5db0c0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7458,7 +7458,7 @@ remote_target::queued_stop_reply (ptid_t ptid)
remote_state *rs = get_remote_state ();
struct stop_reply *r = remote_notif_remove_queued_reply (ptid);
- if (!rs->stop_reply_queue.empty () && target_can_async_p ())
+ if (!rs->stop_reply_queue.empty () && target_is_async_p ())
{
/* There's still at least an event left. */
mark_async_event_handler (rs->remote_async_inferior_event_token);

View File

@ -1,6 +1,8 @@
gdb_ac_check_bfd.patch
shared_library.patch
arm_single_step.patch
gdb_x86_64.patch
noux_build.patch
gdbserver_genode.patch
call_dummy_location.patch
non_stop.patch

View File

@ -4,12 +4,52 @@ From: Christian Prochaska <christian.prochaska@genode-labs.com>
Enable shared library support.
---
gdb/aarch64-tdep.c | 14 ++++++++++++++
gdb/amd64-tdep.c | 4 ++++
gdb/arm-tdep.c | 4 ++++
gdb/configure.tgt | 7 +++++--
gdb/configure.tgt | 9 ++++++---
gdb/i386-tdep.c | 4 ++++
4 files changed, 17 insertions(+), 2 deletions(-)
5 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 3cc0d3b..d07dd6e 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -29,6 +29,7 @@
#include "value.h"
#include "arch-utils.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "frame-unwind.h"
#include "frame-base.h"
#include "trad-frame.h"
@@ -3852,6 +3853,14 @@ static void aarch64_process_record_test (void);
}
#endif
+/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
+
+static void aarch64_genode_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
+}
+
void _initialize_aarch64_tdep ();
void
_initialize_aarch64_tdep ()
@@ -3859,6 +3868,11 @@ _initialize_aarch64_tdep ()
gdbarch_register (bfd_arch_aarch64, aarch64_gdbarch_init,
aarch64_dump_tdep);
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_aarch64, bfd_mach_aarch64,
+ GDB_OSABI_GENODE, aarch64_genode_init_abi);
+ /* /Genode */
+
/* Debug this file's internals. */
add_setshow_boolean_cmd ("aarch64", class_maintenance, &aarch64_debug, _("\
Set AArch64 debugging."), _("\
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index b8cd818..74cb9cf 100644
--- a/gdb/amd64-tdep.c
@ -55,9 +95,18 @@ index 58b9c5f..2fcf104 100644
These are gdbarch discriminators, like the OSABI. */
tdep->arm_abi = arm_abi;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index e84e222..d7d8e29 100644
index e84e222..5d59879 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -127,7 +127,7 @@ esac
case "${targ}" in
aarch64*-*-elf | aarch64*-*-rtems*)
# Target: AArch64 embedded system
- gdb_target_obs="aarch64-newlib-tdep.o"
+ gdb_target_obs="solib-svr4.o"
;;
aarch64*-*-freebsd*)
@@ -200,7 +200,7 @@ arm*-*-openbsd*)
;;
arm*-*-*)