public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/build] Fix build on postmarketos
Date: Thu, 14 Mar 2024 20:27:52 +0000 (GMT)	[thread overview]
Message-ID: <20240314202752.84A9F385829C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=97e9c24c38513a69db81fe4c8206785c3a7050af

commit 97e9c24c38513a69db81fe4c8206785c3a7050af
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Mar 14 21:28:44 2024 +0100

    [gdb/build] Fix build on postmarketos
    
    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.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    
    PR build/31483
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31483

Diff:
---
 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

                 reply	other threads:[~2024-03-14 20:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240314202752.84A9F385829C@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).