From patchwork Tue Jan 2 05:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83098 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 284AE3858284 for ; Tue, 2 Jan 2024 06:31:19 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id DBF803858D1E for ; Tue, 2 Jan 2024 06:30:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBF803858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DBF803858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; cv=none; b=Ti6n5Ym0sfKXYBf9+juyQx43ygUTaaGm2XbsJToqksTBpnBG/Jnd3dvWa5ndPD9T+QFR1aaa8FN/tOvcs13mf2eTWYikqwbV1Zc36dGaQ068AdaJ7wsq3U/V4D8Ehafmw70UPAmUtBl13ppOWc57OsMtI2tVCYZeo2/GuXDnDk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; c=relaxed/simple; bh=Bn8PDoBMZuUNQf+3heww3ZzD7cgonqL9oJxgzLO/gFE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=FJ/1W8NzGTm7anRUKwdnqdXhAV0oYao3a4ZBVTc7Aac9rhEkSvftKloQ4fEZCByudNuYQenuMSK6b9Pbv92FFNQOJxiRRSmqaogDAseOgmTYcuCQLSPWZ2mDV0YeaTpQKSy+z/vmXmUE1OTGvplVJiawkvXEqflX1C9ex4SjaU0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 87B0C340813; Tue, 2 Jan 2024 06:30:29 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 1/5] sim: ppc: fix bad AC_CACHE_CHECK call with semun Date: Tue, 2 Jan 2024 00:30:22 -0500 Message-ID: <20240102053026.20425-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org The first arg is the cache var name, and this one was typoed relative to what the call actually set. We also don't need the manual call to AC_MSG_RESULT as the AC_CACHE_CHECK takes care of it for us. --- sim/ppc/configure | 7 ++----- sim/ppc/configure.ac | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index adb4fc00a01d..1f61ff1bacef 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -97,16 +97,14 @@ esac ])dnl AC_CACHE_CHECK([if union semun defined], - ac_cv_HAS_UNION_SEMUN, + [ac_cv_has_union_semun], [AC_TRY_COMPILE([ #include #include #include ], [union semun arg ;], [ac_cv_has_union_semun="yes"], -[ac_cv_has_union_semun="no"]) -AC_MSG_RESULT($ac_cv_has_union_semun) -]) +[ac_cv_has_union_semun="no"])]) if test "$ac_cv_has_union_semun" = "yes"; then From patchwork Tue Jan 2 05:30:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83099 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B12EE385843E for ; Tue, 2 Jan 2024 06:31:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 201E43858C41 for ; Tue, 2 Jan 2024 06:30:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 201E43858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 201E43858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; cv=none; b=js7BdceZuDQBBdOxAlRESUgENSZIOK30zaZWdxH6hF9HXhaWW5nwMr5PqgFlBqvfteJ5oh/J23P+45yaQsMKHfVIBgvFzE6/YvU5379sBRSXzQalId7rrMGqlsm4uy3mBWawSMmbShm1Uh0CZP8LPi/jDJUYQO8PlQZ+Ha/LZYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; c=relaxed/simple; bh=kYAsqK+P4v3QZqAeHEiEEfVwX9ChyZm6vAsF1oK2cW0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kCBkeBirChpWdRT/wW4La2h4JDEazvgxZbGyKExgf3QDPIS2tMk9H3Xd4T9Ywvp0wuXcSIQtHilzxQr+T9xHHy0JyRkX49cvxp9DA8wv3hj0NgdbPVoOS62H1u3BseT4QUZki8uRlFwa+OPBYloBXEpNKlsc8ufmKN1WszApx7c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id A846E3408DD; Tue, 2 Jan 2024 06:30:31 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 2/5] sim: ppc: merge System V semaphores checks Date: Tue, 2 Jan 2024 00:30:23 -0500 Message-ID: <20240102053026.20425-2-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102053026.20425-1-vapier@gentoo.org> References: <20240102053026.20425-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Compile tests can use earlier defines, so hoist the HAVE_UNION_SEMUN define to before the semaphore check, and use it in the test so that we can merge the 2 versions into one. This also defines HAVE_UNION_SEMUN even when ac_cv_sysv_sem is not set, but that's OK as this define is only about a type existing, not about whether the overall code is usable. --- sim/ppc/configure | 54 ++++---------------------------------------- sim/ppc/configure.ac | 42 +++++++--------------------------- 2 files changed, 13 insertions(+), 83 deletions(-) diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 1f61ff1bacef..50afce74303d 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -105,33 +105,12 @@ AC_CACHE_CHECK([if union semun defined], [union semun arg ;], [ac_cv_has_union_semun="yes"], [ac_cv_has_union_semun="no"])]) +AS_IF([test x"$ac_cv_has_union_semun" = x"yes"], [dnl + AC_DEFINE(HAVE_UNION_SEMUN, 1, + [Define if union semun is defined in ]) +]) - -if test "$ac_cv_has_union_semun" = "yes"; then - AC_CACHE_CHECK(whether System V semaphores are supported, - ac_cv_sysv_sem, - [ - AC_TRY_RUN( - [ - #include - #include - #include - int main () { - union semun arg ; - - int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); - if (id == -1) - exit(1); - arg.val = 0; /* avoid implicit type cast to union */ - if (semctl(id, 0, IPC_RMID, arg) == -1) - exit(1); - exit(0); - } - ], - ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) - ]) -else # semun is not defined - AC_CACHE_CHECK(whether System V semaphores are supported, +AC_CACHE_CHECK([whether System V semaphores are supported], ac_cv_sysv_sem, [ AC_TRY_RUN( @@ -139,11 +118,13 @@ else # semun is not defined #include #include #include +#ifndef HAVE_UNION_SEMUN union semun { int val; struct semid_ds *buf; ushort *array; }; +#endif int main () { union semun arg ; @@ -157,8 +138,7 @@ else # semun is not defined } ], ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) - ]) -fi +]) AC_CACHE_CHECK(whether System V shared memory is supported, ac_cv_sysv_shm, @@ -185,12 +165,6 @@ else sim_sysv_ipc_hw=""; fi -if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then - AC_DEFINE(HAVE_UNION_SEMUN, 1, - [Define if union semun is defined in ]) -fi - - AC_ARG_ENABLE(sim-hardware, [ --enable-sim-hardware=list Specify the hardware to be included in the build.], [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" From patchwork Tue Jan 2 05:30:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83101 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECDE63858286 for ; Tue, 2 Jan 2024 06:32:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 0FC973858C2C for ; Tue, 2 Jan 2024 06:30:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FC973858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0FC973858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; cv=none; b=eawYqkBplfa0BQtZVbwVpKKqS7XGdDCYo3SETO/OUw0DiTj/g6mq7WMRB47y6s+5ZOBDPGJLE3tUVtW92YC/COGe63HQmTVcdOPTFrRZpG60IasoX6D4OTkWDjqz3fK+PHZJ567Vfos8xVFIf11bGg+wyUXfam5Ql52BMN8lcPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177039; c=relaxed/simple; bh=zD+gyw8KAIDBcIhS7CwTw++2efvkwiqAL0olBpWLqWs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=v1bk0jO+RpWnUP+rKmjcr6q3rmtyZM97CxYY7hsEOXWayGgDp/PJq23Miq0v04Ruk2Xjo82vmifhPeztWw+G3xvbcCyJZaUJ4U61/SwCubsXWALkqEmxLB9N95aJxzF2D7nCq6uOX245sDB5C2hGwHFF6x/0BeZYQSLxtlgjft8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id AAD7C340906; Tue, 2 Jan 2024 06:30:33 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 3/5] sim: ppc: change SysV sem & shm tests to compile-time Date: Tue, 2 Jan 2024 00:30:24 -0500 Message-ID: <20240102053026.20425-3-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102053026.20425-1-vapier@gentoo.org> References: <20240102053026.20425-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Instead of executing code to see if SysV semaphores & shared memory are available, switch to just a compile-time test. The system used to compile might not match the system used to run the code wrt the current kernel & OS settings, but the library APIs should. So move the failures from compile-time to runtime so the program is more portable, and works correctly even when cross-compiling. --- sim/ppc/configure | 149 ++++++++++++++++++++----------------------- sim/ppc/configure.ac | 48 +++++--------- 2 files changed, 87 insertions(+), 110 deletions(-) diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 50afce74303d..b78a09d9b587 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -111,10 +111,8 @@ AS_IF([test x"$ac_cv_has_union_semun" = x"yes"], [dnl ]) AC_CACHE_CHECK([whether System V semaphores are supported], - ac_cv_sysv_sem, - [ - AC_TRY_RUN( - [ + [ac_cv_sysv_sem], + [AC_TRY_COMPILE([ #include #include #include @@ -124,40 +122,28 @@ AC_CACHE_CHECK([whether System V semaphores are supported], struct semid_ds *buf; ushort *array; }; -#endif - int main () { - union semun arg ; - - int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); - if (id == -1) - exit(1); - arg.val = 0; /* avoid implicit type cast to union */ - if (semctl(id, 0, IPC_RMID, arg) == -1) - exit(1); - exit(0); - } - ], - ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) -]) +#endif], [ + union semun arg; + int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400); + if (id == -1) + return 1; + arg.val = 0; /* avoid implicit type cast to union */ + if (semctl(id, 0, IPC_RMID, arg) == -1) + return 1; +], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])]) AC_CACHE_CHECK(whether System V shared memory is supported, ac_cv_sysv_shm, -[ -AC_TRY_RUN([ +[AC_TRY_COMPILE([ #include #include -#include -int main () { - int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400); +#include ], [ + int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400); if (id == -1) - exit(1); + return 1; if (shmctl(id, IPC_RMID, 0) == -1) - exit(1); - exit(0); -} -], -ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :) -]) + return 1; +], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])]) if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then sim_sysv_ipc_hw=",sem,shm"; From patchwork Tue Jan 2 05:30:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83102 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CECC8385842B for ; Tue, 2 Jan 2024 06:33:16 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 41BFF3858C2F for ; Tue, 2 Jan 2024 06:30:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41BFF3858C2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 41BFF3858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177040; cv=none; b=VNdzQsvDvcSLX/1NvDQst1Imf6kN4JNP7QuuMOg7fDVt8R4Tkq97E7CdbR/xI753kc8RWdkjX3E6eZSrniTMEafAnB3doRVVRhxgDnb+LcgP4rkNHpLl9F8C/MDsrB50F44SzVW2BJpyTdi8aO/MqgNLX4cSLQZZ8wdSFg6/TDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177040; c=relaxed/simple; bh=ixOpyPSKBYIxYUEfLsdZ1CS6kdBWa1/kDcpHNifeWAc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=rZKeuyXBUXiuw7bGvwW995pUWUvpkC1rRmiQbTYaxZyp+JD8GO6A2FqD8TIMVzPN3GzFChAaoEAbrfmhozXfs1nuyCHJ0FNi6HgVKffjxY5T/sKg8m4iUgzDnjkz3zO97W6rOfyy4EwAdukQsrYijeJab8mB0as7+8MEwoW5WCM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id ABF47340943; Tue, 2 Jan 2024 06:30:35 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 4/5] sim: ppc: always compile in the sysv sem & shm device files Date: Tue, 2 Jan 2024 00:30:25 -0500 Message-ID: <20240102053026.20425-4-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102053026.20425-1-vapier@gentoo.org> References: <20240102053026.20425-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Move the stub logic to the device files themselves. This makes the configure & build logic more static which will make it easier to move to the top-level build, and matches what we did with the common/ hw tree already. This also decouples the logic from the two -- in the past, you needed both sem & shm in order to enable the device models, but now each one is tied to its own independent knob. Practically speaking, this will probably not make a difference, but it simplifies the build a bit. --- sim/ppc/config.in | 6 ++++++ sim/ppc/configure | 18 ++++++++++++------ sim/ppc/configure.ac | 16 ++++++++-------- sim/ppc/hw_sem.c | 10 ++++++++++ sim/ppc/hw_shm.c | 10 ++++++++++ 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index b78a09d9b587..9b01aede82cd 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -131,6 +131,9 @@ AC_CACHE_CHECK([whether System V semaphores are supported], if (semctl(id, 0, IPC_RMID, arg) == -1) return 1; ], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])]) +AS_IF([test x"$ac_cv_sysv_sem" = x"yes"], [dnl + AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported]) +]) AC_CACHE_CHECK(whether System V shared memory is supported, ac_cv_sysv_shm, @@ -144,16 +147,13 @@ ac_cv_sysv_shm, if (shmctl(id, IPC_RMID, 0) == -1) return 1; ], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])]) - -if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then - sim_sysv_ipc_hw=",sem,shm"; -else - sim_sysv_ipc_hw=""; -fi +AS_IF([test x"$ac_cv_sysv_shm" = x"yes"], [dnl + AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported]) +]) AC_ARG_ENABLE(sim-hardware, [ --enable-sim-hardware=list Specify the hardware to be included in the build.], -[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" +[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm" case "${enableval}" in yes) ;; no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";; @@ -165,7 +165,7 @@ sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` if test x"$silent" != x"yes" && test x"$hardware" != x""; then echo "Setting hardware to $sim_hw_src, $sim_hw_obj" -fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" +fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm" sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` if test x"$silent" != x"yes"; then diff --git a/sim/ppc/hw_sem.c b/sim/ppc/hw_sem.c index 937e2ad6f812..c43af3b1d9ed 100644 --- a/sim/ppc/hw_sem.c +++ b/sim/ppc/hw_sem.c @@ -84,6 +84,8 @@ */ +#ifdef HAVE_SYSV_SEM + typedef struct _hw_sem_device { unsigned_word physical_address; key_t key; @@ -278,4 +280,12 @@ const device_descriptor hw_sem_device_descriptor[] = { { NULL }, }; +#else + +const device_descriptor hw_sem_device_descriptor[] = { + { NULL }, +}; + +#endif /* HAVE_SYSV_SEM */ + #endif /* _HW_SEM_C_ */ diff --git a/sim/ppc/hw_shm.c b/sim/ppc/hw_shm.c index c4d5cae83453..0f78ae8c4a9a 100644 --- a/sim/ppc/hw_shm.c +++ b/sim/ppc/hw_shm.c @@ -77,6 +77,8 @@ */ +#ifdef HAVE_SYSV_SHM + typedef struct _hw_shm_device { unsigned_word physical_address; char *shm_address; @@ -222,4 +224,12 @@ const device_descriptor hw_shm_device_descriptor[] = { { NULL }, }; +#else + +const device_descriptor hw_shm_device_descriptor[] = { + { NULL }, +}; + +#endif /* HAVE_SYSV_SHM */ + #endif /* _HW_SHM_C_ */ From patchwork Tue Jan 2 05:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83100 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF2ED3858413 for ; Tue, 2 Jan 2024 06:32:32 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 28F6E3858404 for ; Tue, 2 Jan 2024 06:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28F6E3858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 28F6E3858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177040; cv=none; b=e6oh6/kSFB9+CLMYTvlVN+VevjgZL1847jim9/Niv6m9xLVy6o6JEaY105nCSeoZ9E/Elb+9RXBgrNXnyott0DLORPzibo9G/GpG/YUqD4C9/TjXmhvF8d1a7GAX9CsAmKWtJBcia/x2NZyo0HvHzr3fTEwiIQG8nKDmG7BGgM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704177040; c=relaxed/simple; bh=3K8X81ib8K1u7PK8FjGERd3JF2ownOCXBsAeMy8x82U=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=mo2cWxXelC5ef/L5Y63NHM78dMubnMjYJoGP95Uoa2JFeZ0ucqg4vf6WvX/O7m1hmcc3w8I9sWj3TX5uNL3a827CZ8Gv1JB4aYlEBH8DSYs4DUBcyGnu60MJ0NmGsxVy0aMATOWbVgn2eGX5ARpvP6d8+pBEGu798WDMXFgm6Vw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id AE82D340BCD; Tue, 2 Jan 2024 06:30:37 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/submitted 5/5] sim: ppc: hoist sysv tests to top-level Date: Tue, 2 Jan 2024 00:30:26 -0500 Message-ID: <20240102053026.20425-5-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102053026.20425-1-vapier@gentoo.org> References: <20240102053026.20425-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Now that the sysv tests turn into config.h defines and everything checks that, we can move the tests to the top-level and out of the ppc subdir. --- sim/config.h.in | 9 +++ sim/configure | 132 +++++++++++++++++++++++++++++++++++++- sim/m4/sim_ac_platform.m4 | 55 ++++++++++++++++ sim/ppc/config.in | 9 --- sim/ppc/configure | 127 +----------------------------------- sim/ppc/configure.ac | 54 ---------------- 6 files changed, 195 insertions(+), 191 deletions(-) diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index f45321763fa7..dcab5b2862d9 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -133,6 +133,61 @@ AC_CHECK_TYPES(socklen_t, [], [], #include ]) +dnl Some System V related checks. +AC_CACHE_CHECK([if union semun defined], + [sim_cv_has_union_semun], + [AC_TRY_COMPILE([ +#include +#include +#include ], [ + union semun arg; +], [sim_cv_has_union_semun="yes"], [sim_cv_has_union_semun="no"])]) +AS_IF([test x"$sim_cv_has_union_semun" = x"yes"], [dnl + AC_DEFINE(HAVE_UNION_SEMUN, 1, + [Define if union semun is defined in ]) +]) + +AC_CACHE_CHECK([whether System V semaphores are supported], + [sim_cv_sysv_sem], + [AC_TRY_COMPILE([ + #include + #include + #include +#ifndef HAVE_UNION_SEMUN + union semun { + int val; + struct semid_ds *buf; + ushort *array; + }; +#endif], [ + union semun arg; + int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400); + if (id == -1) + return 1; + arg.val = 0; /* avoid implicit type cast to union */ + if (semctl(id, 0, IPC_RMID, arg) == -1) + return 1; +], [sim_cv_sysv_sem="yes"], [sim_cv_sysv_sem="no"])]) +AS_IF([test x"$sim_cv_sysv_sem" = x"yes"], [dnl + AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported]) +]) + +AC_CACHE_CHECK([whether System V shared memory is supported], + [sim_cv_sysv_shm], + [AC_TRY_COMPILE([ +#include +#include +#include ], [ + int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400); + if (id == -1) + return 1; + if (shmctl(id, IPC_RMID, 0) == -1) + return 1; +], [sim_cv_sysv_shm="yes"], [sim_cv_sysv_shm="no"])]) +AS_IF([test x"$sim_cv_sysv_shm" = x"yes"], [dnl + AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported]) +]) + dnl Types used by common code AC_TYPE_GETGROUPS AC_TYPE_MODE_T diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 9b01aede82cd..06be2c960768 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -96,60 +96,6 @@ case "${target}" in esac ])dnl -AC_CACHE_CHECK([if union semun defined], - [ac_cv_has_union_semun], - [AC_TRY_COMPILE([ -#include -#include -#include ], -[union semun arg ;], -[ac_cv_has_union_semun="yes"], -[ac_cv_has_union_semun="no"])]) -AS_IF([test x"$ac_cv_has_union_semun" = x"yes"], [dnl - AC_DEFINE(HAVE_UNION_SEMUN, 1, - [Define if union semun is defined in ]) -]) - -AC_CACHE_CHECK([whether System V semaphores are supported], - [ac_cv_sysv_sem], - [AC_TRY_COMPILE([ - #include - #include - #include -#ifndef HAVE_UNION_SEMUN - union semun { - int val; - struct semid_ds *buf; - ushort *array; - }; -#endif], [ - union semun arg; - int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400); - if (id == -1) - return 1; - arg.val = 0; /* avoid implicit type cast to union */ - if (semctl(id, 0, IPC_RMID, arg) == -1) - return 1; -], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])]) -AS_IF([test x"$ac_cv_sysv_sem" = x"yes"], [dnl - AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported]) -]) - -AC_CACHE_CHECK(whether System V shared memory is supported, -ac_cv_sysv_shm, -[AC_TRY_COMPILE([ -#include -#include -#include ], [ - int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400); - if (id == -1) - return 1; - if (shmctl(id, IPC_RMID, 0) == -1) - return 1; -], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])]) -AS_IF([test x"$ac_cv_sysv_shm" = x"yes"], [dnl - AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported]) -]) AC_ARG_ENABLE(sim-hardware, [ --enable-sim-hardware=list Specify the hardware to be included in the build.],