Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2] [gdb/build] Fix build on postmarketos
@ 2024-03-14 16:31 Tom de Vries
  2024-03-14 20:13 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-03-14 16:31 UTC (permalink / raw)
  To: gdb-patches

I tried building gdbserver on postmarketos (which is based on alpine linux,
which uses musl libc), and ran into:
...
gdbserver/linux-low.cc: In lambda function:
gdbserver/linux-low.cc:1907:41: error: \
  'W_EXITCODE' was not declared in this scope
 1907 |               mark_lwp_dead (leader_lp, W_EXITCODE (0, 0), true);
      |                                         ^~~~~~~~~~
...

The macro W_EXITCODE is not defined in gdbsupport/gdb_wait.h.

OTOH, WSETEXIT is defined there, but unused:
...
 /* These are not defined in POSIX, but are used by our programs.  */

 #ifndef WSETEXIT
 # ifdef W_EXITCODE
 #define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
 # else
 #define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
 # endif
 #endif
...

Fix this by dropping the WSETEXIT definition, and instead defining W_EXITCODE.

Tested on x86_64-linux, in combination with an "#undef W_EXITCODE" to make
sure the definition is exercised.

PR build/31483
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31483
---
 gdbsupport/gdb_wait.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/gdbsupport/gdb_wait.h b/gdbsupport/gdb_wait.h
index e9e39584e6e..c6348dbcb1c 100644
--- a/gdbsupport/gdb_wait.h
+++ b/gdbsupport/gdb_wait.h
@@ -99,12 +99,8 @@ extern int windows_status_to_termsig (unsigned long);
 
 /* These are not defined in POSIX, but are used by our programs.  */
 
-#ifndef	WSETEXIT
-# ifdef	W_EXITCODE
-#define	WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
-# else
-#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
-# endif
+#ifndef W_EXITCODE
+#define W_EXITCODE(status, sig) ((status) << 8 | (sig))
 #endif
 
 #ifndef W_STOPCODE

base-commit: 9a03f2185347bd8f20da9bf535bc68a8d0f18ce8
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] [gdb/build] Fix build on postmarketos
  2024-03-14 16:31 [PATCH v2] [gdb/build] Fix build on postmarketos Tom de Vries
@ 2024-03-14 20:13 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-03-14 20:13 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> Fix this by dropping the WSETEXIT definition, and instead defining W_EXITCODE.

Tom> Tested on x86_64-linux, in combination with an "#undef W_EXITCODE" to make
Tom> sure the definition is exercised.

Tom> PR build/31483
Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31483

Thanks, looks good to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-14 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 16:31 [PATCH v2] [gdb/build] Fix build on postmarketos Tom de Vries
2024-03-14 20:13 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox