From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 84A9F385829C; Thu, 14 Mar 2024 20:27:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84A9F385829C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710448072; bh=pW/+y3WCh99ir7b699NFC1aaYVGXjocRZIQ9qvwo1iA=; h=From:To:Subject:Date:From; b=KdmgRoSD7owVEQvPCLBkKsnkHg3JLp3FOSZqKCT6ovSFocxb3BAVuEjkDvl+IDZEi PecZcTKa7hcMAINtZqKrwFpxMG2gHhfhcj98eJr61Af096op6I/0Kr5EcdVmeuPlCS tYOXZpEurAlb3+WUVdQ5anqEZno6n1X7EHwd2CLo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/build] Fix build on postmarketos X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: da48217f315084097ef25226c0acab3bbd55ebd3 X-Git-Newrev: 97e9c24c38513a69db81fe4c8206785c3a7050af Message-Id: <20240314202752.84A9F385829C@sourceware.org> Date: Thu, 14 Mar 2024 20:27:52 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D97e9c24c3851= 3a69db81fe4c8206785c3a7050af commit 97e9c24c38513a69db81fe4c8206785c3a7050af Author: Tom de Vries Date: Thu Mar 14 21:28:44 2024 +0100 [gdb/build] Fix build on postmarketos =20 I tried building gdbserver on postmarketos (which is based on alpine li= nux, 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= ); | ^~~~~~~~~~ ... =20 The macro W_EXITCODE is not defined in gdbsupport/gdb_wait.h. =20 OTOH, WSETEXIT is defined there, but unused: ... /* These are not defined in POSIX, but are used by our programs. */ =20 #ifndef WSETEXIT # ifdef W_EXITCODE #define WSETEXIT(w,status) ((w) =3D W_EXITCODE(status,0)) # else #define WSETEXIT(w,status) ((w) =3D (0 | ((status) << 8))) # endif #endif ... =20 Fix this by dropping the WSETEXIT definition, and instead defining W_EX= ITCODE. =20 Tested on x86_64-linux, in combination with an "#undef W_EXITCODE" to m= ake sure the definition is exercised. =20 Approved-By: Tom Tromey =20 PR build/31483 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31483 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); =20 /* These are not defined in POSIX, but are used by our programs. */ =20 -#ifndef WSETEXIT -# ifdef W_EXITCODE -#define WSETEXIT(w,status) ((w) =3D W_EXITCODE(status,0)) -# else -#define WSETEXIT(w,status) ((w) =3D (0 | ((status) << 8))) -# endif +#ifndef W_EXITCODE +#define W_EXITCODE(status, sig) ((status) << 8 | (sig)) #endif =20 #ifndef W_STOPCODE