From patchwork Thu Jan 11 03:37:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83814 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 3423C385DC0B for ; Thu, 11 Jan 2024 03:38:31 +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 09A8938582AC for ; Thu, 11 Jan 2024 03:37:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 09A8938582AC 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 09A8938582AC 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=1704944273; cv=none; b=wGKHY0d7jcyjE7pVYmUrdUdOr6koB9lsvTBVjGwvk8GNXAQiKwD/14XbgT0EcmxWkMw4KTGmIST+0kApHI8a0vzNkyg9jtQ5kIGwoY0ZezyQvaK0vomceulYpZrvTjC1P6F81QLv5iIQifRPXMe8qSPnAct1tqhm9Ohc9P7ZUEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704944273; c=relaxed/simple; bh=kgryQXpr3Ycs+SlAaRVEqP+wL8UMITaF0T0OOIsKY8k=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=laDqVWjYTiqeSCMdYWKsCRCAc9PeybMPpfWacFiP/jN5CdM4asQbYiWOcjZ2NMzhxsRDj3p9DAbWpZ2bPl8VQDR4AYjCZLYWmbxEIUGfr47ojaNuhthqS+VYaxEAWELlf6mgKntL4c8yqeCk5c8y6EB2qX3ZwQ4gaKO6y52YNcw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 90A1F3431F1; Thu, 11 Jan 2024 03:37:50 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 1/5] sim: m32r: cleanup unused variables Date: Wed, 10 Jan 2024 22:37:43 -0500 Message-ID: <20240111033747.17795-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, 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 We've been building this file with -Wno-error, so clean up unused variable warnings. --- sim/m32r/traps.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index 51fe0d484a5e..b779e0c3b9f5 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -141,7 +141,6 @@ static void * t2h_addr (host_callback *cb, struct cb_syscall *sc, unsigned long taddr) { - void *addr; SIM_DESC sd = (SIM_DESC) sc->p1; SIM_CPU *cpu = (SIM_CPU *) sc->p2; @@ -220,7 +219,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) { CB_SYSCALL s; unsigned int func, arg1, arg2, arg3, arg4, arg5, arg6, arg7; - int result, result2, errcode; + int result, errcode; if (STATE_ENVIRONMENT (sd) != USER_ENVIRONMENT) goto case_default; @@ -250,7 +249,6 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) s.write_mem = sim_syscall_write_mem; result = 0; - result2 = 0; errcode = 0; switch (func) From patchwork Thu Jan 11 03:37:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83817 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 C8144385AC12 for ; Thu, 11 Jan 2024 03:39:00 +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 389173857708 for ; Thu, 11 Jan 2024 03:37:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 389173857708 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 389173857708 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=1704944274; cv=none; b=R3XWtwTt3YY4Z+DMckXitafdJSYCommDh59ZaiK9ruKFQWeMK8Yqydrl/SK/89GMriM/JlWVfEyUf++ZkPsq/uPyHve/wJ7LGTO5VYPfmxtIMNtAwIJ8FsK3cepLO52kd/xEbqJWxLfLw+Js8QolmDrButcFfChQnPILxg0MlWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704944274; c=relaxed/simple; bh=wPD9bSis8YFdXoCma0nlC8zsHZigTjAnd4IcgoTauNo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=E49d7kRVEq0klJdfJ3c8OE62Fg3d8hcHh6wEW1sSSN0PnH1h1/UZzOoDTjhJWlEWBM1viAxwOakb1Rf4znmbluXs3CI2aRTVgYwqsgFBMcCavAsbhc1gm5vrnL9vfGmZ2fS/Epq/dwFkOP+06ykZqjQmNUJJD6S5wrum7MWEpbU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 9449C343228; Thu, 11 Jan 2024 03:37:52 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 2/5] sim: m32r: migrate ftime() to clock_gettime() Date: Wed, 10 Jan 2024 22:37:44 -0500 Message-ID: <20240111033747.17795-2-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111033747.17795-1-vapier@gentoo.org> References: <20240111033747.17795-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, 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 ftime() function has been deprecated since POSIX-1-2004, and removed in POSIX.1-2008. It's also been deprecated/removed in glibc since 2.33. POSIX has always said the function is not portable, and its return value, timezone, and dstflag fields are unspecified. Even if Linux/glibc & m32r had defined behavior, those aren't the host for the sim runtime. So let's stop using the function and switch to clock_gettime. gnulib already has detection support for it, and it's been around since at least POSIX-1-2004. --- sim/m32r/traps.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index b779e0c3b9f5..c5191989d7fd 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -386,17 +386,20 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) case TARGET_LINUX_SYS_ftime: { struct timeb t; + struct timespec ts; - result = ftime (&t); + result = clock_gettime (CLOCK_REALTIME, &ts); errcode = errno; if (result != 0) break; - t.time = H2T_4 (t.time); - t.millitm = H2T_2 (t.millitm); - t.timezone = H2T_2 (t.timezone); - t.dstflag = H2T_2 (t.dstflag); + t.time = H2T_4 (ts.tv_sec); + t.millitm = H2T_2 (ts.tv_nsec / 1000000); + /* POSIX.1-2001 says the contents of the timezone and dstflag + members of tp after a call to ftime() are unspecified. */ + t.timezone = H2T_2 (0); + t.dstflag = H2T_2 (0); if ((s.write_mem) (cb, &s, arg1, (char *) &t, sizeof(t)) != sizeof(t)) { From patchwork Thu Jan 11 03:37:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83815 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 A9B29385AC33 for ; Thu, 11 Jan 2024 03:38:32 +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 10C71385782D for ; Thu, 11 Jan 2024 03:37:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10C71385782D 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 10C71385782D 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=1704944276; cv=none; b=YyrRQDf2Tb6pVBEN1qBZSBdomMt+lyAgKRW9ZZUhXZVeU2nchQGC5/R2llEmgL4mwmSh6D8rxASGnm72vrwkr4udnaVNsTobTUa+z2FZ2TiV16vPYCX4ZNIV54hIqW+GVSvMVPluxx2GC6zsvk2bDk0xrW7ENyIUh2YIrXxLkOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704944276; c=relaxed/simple; bh=fdt+XovzU+b4JQ+CVj+KBfdrhTm8WRi9e1DY1ykDFp4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=SrT/d1ZMVfVHnLvDB7JheVTmXmBbzefCP3bs4W+XQZ2rwDnBKZ4mfGmEV5Y/o1jqa2O2SbKcSw9s7o+/5slAOCfBCU7sT59+OzQt2hMLt5aWIhERl40aMcXYDUvFnTafIPK+1Bto/g00WrofEzZVQumpy6GhsSMcof0RwTRzDpQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 98E563431F1; Thu, 11 Jan 2024 03:37:54 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 3/5] sim: m32r: fix missing break statement Date: Wed, 10 Jan 2024 22:37:45 -0500 Message-ID: <20240111033747.17795-3-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111033747.17795-1-vapier@gentoo.org> References: <20240111033747.17795-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, 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 ftime syscall should not fallthrough to the sync syscall. Clearly the code was missing a break statement. --- sim/m32r/traps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index c5191989d7fd..9ffa3bb15d94 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -407,6 +407,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = EINVAL; } } + break; case TARGET_LINUX_SYS_sync: sync (); From patchwork Thu Jan 11 03:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83816 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 EC1F6385DC30 for ; Thu, 11 Jan 2024 03:38:37 +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 EF1DD3857B80 for ; Thu, 11 Jan 2024 03:37:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF1DD3857B80 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 EF1DD3857B80 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=1704944279; cv=none; b=FLWJGu5xfGnRmCwH2czyS9fJr5RuI+n1ZM7uZh/i9DP9gSXYGtLep1T9tReuBxJUt8AU1qVYf4w9FogNo0z+vniZh+s5ImHmoRd2IAGXRrz7YqM/TmozM6Kcfi0xhAkTFJdgqsrWW8SqSW6TMJRUtrwCWLaMCOaMFOHQA5b/6wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704944279; c=relaxed/simple; bh=saCmrSWCI1dKjNatQkW8PoOVrNqvXFtJXv7e8S2b98Q=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=c5MeXhNpvbi7qEgSx/49rWyilVowSovrVYQtg2m8WKe48qxWvoAUl6EHn3cUPnuUX5ZnaZX+jSpuAdmPBd2JXBBvdRXljshguPO1pnjwnKJChlBeJ9OU3hcJ+6+nR4QKK1OePvhQ27AbLux/G1TLJ61RNikFul3gB/Kzo8I9/2A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id A023B343228; Thu, 11 Jan 2024 03:37:56 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 4/5] sim: m32r: fixup some of the int<->pointer casts Date: Wed, 10 Jan 2024 22:37:46 -0500 Message-ID: <20240111033747.17795-4-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111033747.17795-1-vapier@gentoo.org> References: <20240111033747.17795-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, 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 m32r trap code was written for a 32-bit Linux host (and really, one whose Linux ABI matched pretty exactly). This has lead to conversions between integers and pointers which breaks down hard on 64-bit hosts. Clean up some of the functions where possible to avoid unnecessary conversions, use uintptr_t to cast 32-bit target pointers to host pointers in some places, and just stub out a few functions that can't easily be salvaged currently when sizeof(void*) is not 32-bits. This is a bit ugly, but lets us enable warnings for the whole file. --- sim/config.h.in | 3 ++ sim/configure | 39 +++++++++++++++++-- sim/m32r/traps.c | 81 +++++++++++++++++++++++++-------------- sim/m4/sim_ac_platform.m4 | 2 + 4 files changed, 94 insertions(+), 31 deletions(-) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index 9ffa3bb15d94..d010863502db 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -436,7 +436,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_brk: - result = brk ((void *) arg1); + result = brk ((void *) (uintptr_t) arg1); errcode = errno; //result = arg1; break; @@ -582,51 +582,51 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) { int n; fd_set readfds; - fd_set *treadfdsp; + unsigned int treadfdsp; fd_set *hreadfdsp; fd_set writefds; - fd_set *twritefdsp; + unsigned int twritefdsp; fd_set *hwritefdsp; fd_set exceptfds; - fd_set *texceptfdsp; + unsigned int texceptfdsp; fd_set *hexceptfdsp; - struct timeval *ttimeoutp; + unsigned int ttimeoutp; struct timeval timeout; n = arg1; - treadfdsp = (fd_set *) arg2; - if (treadfdsp != NULL) + treadfdsp = arg2; + if (treadfdsp !=0) { - readfds = *((fd_set *) t2h_addr (cb, &s, (unsigned int) treadfdsp)); + readfds = *((fd_set *) t2h_addr (cb, &s, treadfdsp)); translate_endian_t2h (&readfds, sizeof(readfds)); hreadfdsp = &readfds; } else hreadfdsp = NULL; - twritefdsp = (fd_set *) arg3; - if (twritefdsp != NULL) + twritefdsp = arg3; + if (twritefdsp != 0) { - writefds = *((fd_set *) t2h_addr (cb, &s, (unsigned int) twritefdsp)); + writefds = *((fd_set *) t2h_addr (cb, &s, twritefdsp)); translate_endian_t2h (&writefds, sizeof(writefds)); hwritefdsp = &writefds; } else hwritefdsp = NULL; - texceptfdsp = (fd_set *) arg4; - if (texceptfdsp != NULL) + texceptfdsp = arg4; + if (texceptfdsp != 0) { - exceptfds = *((fd_set *) t2h_addr (cb, &s, (unsigned int) texceptfdsp)); + exceptfds = *((fd_set *) t2h_addr (cb, &s, texceptfdsp)); translate_endian_t2h (&exceptfds, sizeof(exceptfds)); hexceptfdsp = &exceptfds; } else hexceptfdsp = NULL; - ttimeoutp = (struct timeval *) arg5; - timeout = *((struct timeval *) t2h_addr (cb, &s, (unsigned int) ttimeoutp)); + ttimeoutp = arg5; + timeout = *((struct timeval *) t2h_addr (cb, &s, ttimeoutp)); translate_endian_t2h (&timeout, sizeof(timeout)); result = select (n, hreadfdsp, hwritefdsp, hexceptfdsp, &timeout); @@ -635,10 +635,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) if (result != 0) break; - if (treadfdsp != NULL) + if (treadfdsp != 0) { translate_endian_h2t (&readfds, sizeof(readfds)); - if ((s.write_mem) (cb, &s, (unsigned long) treadfdsp, + if ((s.write_mem) (cb, &s, treadfdsp, (char *) &readfds, sizeof(readfds)) != sizeof(readfds)) { result = -1; @@ -646,10 +646,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } } - if (twritefdsp != NULL) + if (twritefdsp != 0) { translate_endian_h2t (&writefds, sizeof(writefds)); - if ((s.write_mem) (cb, &s, (unsigned long) twritefdsp, + if ((s.write_mem) (cb, &s, twritefdsp, (char *) &writefds, sizeof(writefds)) != sizeof(writefds)) { result = -1; @@ -657,10 +657,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } } - if (texceptfdsp != NULL) + if (texceptfdsp != 0) { translate_endian_h2t (&exceptfds, sizeof(exceptfds)); - if ((s.write_mem) (cb, &s, (unsigned long) texceptfdsp, + if ((s.write_mem) (cb, &s, texceptfdsp, (char *) &exceptfds, sizeof(exceptfds)) != sizeof(exceptfds)) { result = -1; @@ -669,7 +669,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } translate_endian_h2t (&timeout, sizeof(timeout)); - if ((s.write_mem) (cb, &s, (unsigned long) ttimeoutp, + if ((s.write_mem) (cb, &s, ttimeoutp, (char *) &timeout, sizeof(timeout)) != sizeof(timeout)) { result = -1; @@ -692,8 +692,13 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_readdir: +#if SIZEOF_VOID_P == 4 result = (int) readdir ((DIR *) t2h_addr (cb, &s, arg1)); errcode = errno; +#else + result = 0; + errcode = ENOSYS; +#endif break; #if 0 @@ -714,6 +719,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) #endif case TARGET_LINUX_SYS_mmap2: { +#if SIZEOF_VOID_P == 4 /* Code assumes m32r pointer size matches host. */ void *addr; size_t len; int prot, flags, fildes; @@ -736,11 +742,16 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) 0, access_read_write_exec, 0, result, len, 0, NULL, NULL); } +#else + result = 0; + errcode = ENOSYS; +#endif } break; case TARGET_LINUX_SYS_mmap: { +#if SIZEOF_VOID_P == 4 /* Code assumes m32r pointer size matches host. */ void *addr; size_t len; int prot, flags, fildes; @@ -773,11 +784,15 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) 0, access_read_write_exec, 0, result, len, 0, NULL, NULL); } +#else + result = 0; + errcode = ENOSYS; +#endif } break; case TARGET_LINUX_SYS_munmap: - result = munmap ((void *)arg1, arg2); + result = munmap ((void *) (uintptr_t) arg1, arg2); errcode = errno; if (result != -1) sim_core_detach (sd, NULL, 0, arg2, result); @@ -1078,7 +1093,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_mprotect: - result = mprotect ((void *) arg1, arg2, arg3); + result = mprotect ((void *) (uintptr_t) arg1, arg2, arg3); errcode = errno; break; @@ -1149,7 +1164,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_msync: - result = msync ((void *) arg1, arg2, arg3); + result = msync ((void *) (uintptr_t) arg1, arg2, arg3); errcode = errno; break; @@ -1216,8 +1231,13 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_mremap: /* FIXME */ +#if SIZEOF_VOID_P == 4 /* Code assumes m32r pointer size matches host. */ result = (int) mremap ((void *) t2h_addr (cb, &s, arg1), arg2, arg3, arg4); errcode = errno; +#else + result = -1; + errcode = ENOSYS; +#endif break; case TARGET_LINUX_SYS_getresuid32: @@ -1285,8 +1305,13 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_getcwd: - result = (int) getcwd ((char *) t2h_addr (cb, &s, arg1), arg2); - errcode = errno; + { + void *ret; + + ret = getcwd ((char *) t2h_addr (cb, &s, arg1), arg2); + result = ret == NULL ? 0 : arg1; + errcode = errno; + } break; case TARGET_LINUX_SYS_sendfile: diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index fd6daeefbd1c..fa099f23e211 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -133,6 +133,8 @@ AC_CHECK_TYPES(socklen_t, [], [], #include ]) +AC_CHECK_SIZEOF([void *]) + dnl Check for struct statfs. AC_CACHE_CHECK([for struct statfs], [sim_cv_struct_statfs], From patchwork Thu Jan 11 03:37:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83818 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 74BDF3857013 for ; Thu, 11 Jan 2024 03:39:07 +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 006803857B82 for ; Thu, 11 Jan 2024 03:37:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 006803857B82 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 006803857B82 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=1704944280; cv=none; b=jykiJo89Dtrz49/VIeLkzZcRHe4Ebe19OA4D8MfOTXzhPR2fgKChCK4Np31lLNgyAGh7lYbMqHRwwDm51aDNmD3wNsnuYGApVGcGHA8OA39hnhTqLEx8jT/r7AXZJgaMZpJzndtLcEPQgbjnNowcTif2Fy8woaZYPEnVFf51YEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704944280; c=relaxed/simple; bh=Fk+2lEXAAe6CRqFEJ/K0X6ZyFUcq0PijkXj7cxMAxd8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=smmwDtGmyowxCFrBya74XBqqz1iTXfo+EGXPbbEEx3ieeOz03e8dNBHOKpqbMtAYWrxvSuF3xZH0BiYjpdx14UGw+yV2GHQoy7N43nly8w6m5f7CQjRnnjVtrqIdmc3nZprgW/56nKOQ8CMCOL9Lil7i9R7GZPepE3B7FNwk1fU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 9D78F3431F1; Thu, 11 Jan 2024 03:37:58 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 5/5] sim: m32r: enable warnings in traps.c Date: Wed, 10 Jan 2024 22:37:47 -0500 Message-ID: <20240111033747.17795-5-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111033747.17795-1-vapier@gentoo.org> References: <20240111033747.17795-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, KAM_SHORT, 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 File should be clean now! --- sim/Makefile.in | 1 - sim/m32r/local.mk | 3 --- 2 files changed, 4 deletions(-) diff --git a/sim/m32r/local.mk b/sim/m32r/local.mk index bb9c84b2bb84..2b5d67ff9eb3 100644 --- a/sim/m32r/local.mk +++ b/sim/m32r/local.mk @@ -16,9 +16,6 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -## Some modules don't build cleanly yet. -AM_CFLAGS_%C%_traps.o = -Wno-error - nodist_%C%_libsim_a_SOURCES = \ %D%/modules.c %C%_libsim_a_SOURCES = \