* PATCH: Make PowerPC simulator compile on MinGW
@ 2005-11-17 3:48 Mark Mitchell
2005-11-17 3:49 ` Mark Kettenis
0 siblings, 1 reply; 7+ messages in thread
From: Mark Mitchell @ 2005-11-17 3:48 UTC (permalink / raw)
To: gdb-patches
This patch makes it possible to build the PowerPC simulator on MinGW
-- with the exception of the recurring SIGTRAP issue. Daniel is
coaching me on how to fix that correctly, so that is not included
here.
OK?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-11-16 Mark Mitchell <mark@codesourcery.com>
* configure.ac (USE_WIN32API): Define it.
(sys/errno.h): Add it to AC_CHECK_HEADERS list.
* configure.in: Regenerate.
* config.in: Likewise.
* emul_netbsd.c (sys/errno.h): Guard with HAVE_SYS_ERRNO_H.
(write_timezone): Guard with HAVE_GETTIMEOFDAY.
* emul_unix.c (do_unix_mkdir): Handle Win32 1-argument mkdir.
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure.ac,v
retrieving revision 1.3
diff -c -5 -p -r1.3 configure.ac
*** configure.ac 20 Apr 2005 14:43:55 -0000 1.3
--- configure.ac 17 Nov 2005 00:29:24 -0000
*************** fi],[sim_xor_endian=""])dnl
*** 565,574 ****
--- 565,584 ----
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
. ${srcdir}/../../bfd/configure.host
+ case ${host} in
+ *mingw32*)
+ AC_DEFINE(USE_WIN32API, 1,
+ [Define if we should use the Windows API, instead of the
+ POSIX API. On Windows, we use the Windows API when
+ building for MinGW, but the POSIX API when building
+ for Cygwin.])
+ ;;
+ esac
+
AC_CONFIG_HEADER(config.h:config.in)
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
*************** AC_TYPE_SIGNAL
*** 582,592 ****
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
! AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h)
AC_HEADER_DIRENT
dnl Figure out what type of termio/termios support there is
sim_termio=""
AC_MSG_CHECKING(for struct termios)
--- 592,602 ----
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
! AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h sys/errno.h)
AC_HEADER_DIRENT
dnl Figure out what type of termio/termios support there is
sim_termio=""
AC_MSG_CHECKING(for struct termios)
Index: emul_netbsd.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/emul_netbsd.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 emul_netbsd.c
*** emul_netbsd.c 24 Sep 2004 18:39:41 -0000 1.5
--- emul_netbsd.c 17 Nov 2005 00:29:24 -0000
***************
*** 41,51 ****
--- 41,53 ----
#include <sys/stat.h>
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
+ #ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
+ #endif
#include <sys/param.h>
#include <sys/time.h>
#ifdef HAVE_GETRUSAGE
#ifndef HAVE_SYS_RESOURCE_H
*************** write_timeval(unsigned_word addr,
*** 222,243 ****
H2T(t.tv_sec);
H2T(t.tv_usec);
emul_write_buffer(&t, addr, sizeof(t), processor, cia);
}
!
STATIC_INLINE_EMUL_NETBSD void
write_timezone(unsigned_word addr,
struct timezone tz,
cpu *processor,
unsigned_word cia)
{
H2T(tz.tz_minuteswest);
H2T(tz.tz_dsttime);
emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
}
!
#ifdef HAVE_GETDIRENTRIES
STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,
char *buf,
--- 224,245 ----
H2T(t.tv_sec);
H2T(t.tv_usec);
emul_write_buffer(&t, addr, sizeof(t), processor, cia);
}
! #ifdef HAVE_GETTIMEOFDAY
STATIC_INLINE_EMUL_NETBSD void
write_timezone(unsigned_word addr,
struct timezone tz,
cpu *processor,
unsigned_word cia)
{
H2T(tz.tz_minuteswest);
H2T(tz.tz_dsttime);
emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
}
! #endif
#ifdef HAVE_GETDIRENTRIES
STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,
char *buf,
Index: emul_unix.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/emul_unix.c,v
retrieving revision 1.1.1.1
diff -c -5 -p -r1.1.1.1 emul_unix.c
*** emul_unix.c 16 Apr 1999 01:35:09 -0000 1.1.1.1
--- emul_unix.c 17 Nov 2005 00:29:24 -0000
*************** do_unix_mkdir(os_emul_data *emul,
*** 728,738 ****
--- 728,742 ----
int status;
if (WITH_TRACE && ppc_trace[trace_os_emul])
printf_filtered ("0x%lx [%s], 0%3o", (long)path_addr, path, mode);
+ #ifdef USE_WIN32API
+ status = mkdir(path);
+ #else
status = mkdir(path, mode);
+ #endif
emul_write_status(processor, status, errno);
}
#endif
#ifndef HAVE_RMDIR
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-17 3:48 PATCH: Make PowerPC simulator compile on MinGW Mark Mitchell
@ 2005-11-17 3:49 ` Mark Kettenis
2005-11-17 3:55 ` Mark Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Mark Kettenis @ 2005-11-17 3:49 UTC (permalink / raw)
To: mark; +Cc: gdb-patches
> Date: Wed, 16 Nov 2005 16:34:20 -0800
> From: Mark Mitchell <mark@codesourcery.com>
> 2005-11-16 Mark Mitchell <mark@codesourcery.com>
>
> * emul_netbsd.c (sys/errno.h): Guard with HAVE_SYS_ERRNO_H.
This really makes me wonder why it is including <sys/errno.h>. I'm
pretty sure that's totally unneeded.
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-17 3:49 ` Mark Kettenis
@ 2005-11-17 3:55 ` Mark Mitchell
2005-11-28 22:58 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Mark Mitchell @ 2005-11-17 3:55 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
Mark Kettenis wrote:
>>Date: Wed, 16 Nov 2005 16:34:20 -0800
>>From: Mark Mitchell <mark@codesourcery.com>
>
>
>>2005-11-16 Mark Mitchell <mark@codesourcery.com>
>>
>> * emul_netbsd.c (sys/errno.h): Guard with HAVE_SYS_ERRNO_H.
>
> This really makes me wonder why it is including <sys/errno.h>. I'm
> pretty sure that's totally unneeded.
I'm happy to try that on a GNU/Linux box, but how do I prove it in
general? I'm happy to just take out that #include, if that will help
move the patch forward.
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-17 3:55 ` Mark Mitchell
@ 2005-11-28 22:58 ` Daniel Jacobowitz
2005-11-29 2:34 ` Mark Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2005-11-28 22:58 UTC (permalink / raw)
To: Mark Mitchell; +Cc: Mark Kettenis, gdb-patches
On Wed, Nov 16, 2005 at 05:19:31PM -0800, Mark Mitchell wrote:
> Mark Kettenis wrote:
> >>Date: Wed, 16 Nov 2005 16:34:20 -0800
> >>From: Mark Mitchell <mark@codesourcery.com>
> >
> >
> >>2005-11-16 Mark Mitchell <mark@codesourcery.com>
> >>
> >> * emul_netbsd.c (sys/errno.h): Guard with HAVE_SYS_ERRNO_H.
> >
> > This really makes me wonder why it is including <sys/errno.h>. I'm
> > pretty sure that's totally unneeded.
>
> I'm happy to try that on a GNU/Linux box, but how do I prove it in
> general? I'm happy to just take out that #include, if that will help
> move the patch forward.
Please do try that.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-28 22:58 ` Daniel Jacobowitz
@ 2005-11-29 2:34 ` Mark Mitchell
2005-11-29 2:44 ` Mark Kettenis
0 siblings, 1 reply; 7+ messages in thread
From: Mark Mitchell @ 2005-11-29 2:34 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 851 bytes --]
Daniel Jacobowitz wrote:
>>I'm happy to try that on a GNU/Linux box, but how do I prove it in
>>general? I'm happy to just take out that #include, if that will help
>>move the patch forward.
>
> Please do try that.
I've tested the attached version (identical, except for the
<sys/errno.h> bits) by building both i686-pc-linux-gnu x powerpc-eabi
and i686-mingw32 x powerpc-eabi debuggers. (The latter was built on an
x86-64 GNU/Linux box using an i686-pc-linux-gnu x i686-mingw32 cross
compiler.)
2005-11-28 Mark Mitchell <mark@codesourcery.com>
* configure.ac (USE_WIN32API): Define it.
* configure.in: Regenerate.
* config.in: Likewise.
* emul_netbsd.c (write_timezone): Guard with HAVE_GETTIMEOFDAY.
* emul_unix.c (do_unix_mkdir): Handle Win32 1-argument mkdir.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
[-- Attachment #2: gdb.patch --]
[-- Type: text/plain, Size: 3270 bytes --]
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure.ac,v
retrieving revision 1.3
diff -c -5 -p -r1.3 configure.ac
*** configure.ac 20 Apr 2005 14:43:55 -0000 1.3
--- configure.ac 28 Nov 2005 22:06:24 -0000
*************** fi],[sim_xor_endian=""])dnl
*** 565,574 ****
--- 565,584 ----
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
. ${srcdir}/../../bfd/configure.host
+ case ${host} in
+ *mingw32*)
+ AC_DEFINE(USE_WIN32API, 1,
+ [Define if we should use the Windows API, instead of the
+ POSIX API. On Windows, we use the Windows API when
+ building for MinGW, but the POSIX API when building
+ for Cygwin.])
+ ;;
+ esac
+
AC_CONFIG_HEADER(config.h:config.in)
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
Index: emul_netbsd.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/emul_netbsd.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 emul_netbsd.c
*** emul_netbsd.c 24 Sep 2004 18:39:41 -0000 1.5
--- emul_netbsd.c 28 Nov 2005 22:06:24 -0000
***************
*** 41,51 ****
#include <sys/stat.h>
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
- #include <sys/errno.h>
#include <sys/param.h>
#include <sys/time.h>
#ifdef HAVE_GETRUSAGE
#ifndef HAVE_SYS_RESOURCE_H
--- 41,50 ----
*************** write_timeval(unsigned_word addr,
*** 222,243 ****
H2T(t.tv_sec);
H2T(t.tv_usec);
emul_write_buffer(&t, addr, sizeof(t), processor, cia);
}
!
STATIC_INLINE_EMUL_NETBSD void
write_timezone(unsigned_word addr,
struct timezone tz,
cpu *processor,
unsigned_word cia)
{
H2T(tz.tz_minuteswest);
H2T(tz.tz_dsttime);
emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
}
!
#ifdef HAVE_GETDIRENTRIES
STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,
char *buf,
--- 221,242 ----
H2T(t.tv_sec);
H2T(t.tv_usec);
emul_write_buffer(&t, addr, sizeof(t), processor, cia);
}
! #ifdef HAVE_GETTIMEOFDAY
STATIC_INLINE_EMUL_NETBSD void
write_timezone(unsigned_word addr,
struct timezone tz,
cpu *processor,
unsigned_word cia)
{
H2T(tz.tz_minuteswest);
H2T(tz.tz_dsttime);
emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
}
! #endif
#ifdef HAVE_GETDIRENTRIES
STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,
char *buf,
Index: emul_unix.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/emul_unix.c,v
retrieving revision 1.1.1.1
diff -c -5 -p -r1.1.1.1 emul_unix.c
*** emul_unix.c 16 Apr 1999 01:35:09 -0000 1.1.1.1
--- emul_unix.c 28 Nov 2005 22:06:24 -0000
*************** do_unix_mkdir(os_emul_data *emul,
*** 728,738 ****
--- 728,742 ----
int status;
if (WITH_TRACE && ppc_trace[trace_os_emul])
printf_filtered ("0x%lx [%s], 0%3o", (long)path_addr, path, mode);
+ #ifdef USE_WIN32API
+ status = mkdir(path);
+ #else
status = mkdir(path, mode);
+ #endif
emul_write_status(processor, status, errno);
}
#endif
#ifndef HAVE_RMDIR
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-29 2:34 ` Mark Mitchell
@ 2005-11-29 2:44 ` Mark Kettenis
2005-11-29 12:41 ` Mark Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Mark Kettenis @ 2005-11-29 2:44 UTC (permalink / raw)
To: mark; +Cc: drow, gdb-patches
> Date: Mon, 28 Nov 2005 14:26:31 -0800
> From: Mark Mitchell <mark@codesourcery.com>
>
> Daniel Jacobowitz wrote:
>
> >>I'm happy to try that on a GNU/Linux box, but how do I prove it in
> >>general? I'm happy to just take out that #include, if that will help
> >>move the patch forward.
> >
> > Please do try that.
>
> I've tested the attached version (identical, except for the
> <sys/errno.h> bits) by building both i686-pc-linux-gnu x powerpc-eabi
> and i686-mingw32 x powerpc-eabi debuggers. (The latter was built on an
> x86-64 GNU/Linux box using an i686-pc-linux-gnu x i686-mingw32 cross
> compiler.)
>
> 2005-11-28 Mark Mitchell <mark@codesourcery.com>
>
> * configure.ac (USE_WIN32API): Define it.
> * configure.in: Regenerate.
> * config.in: Likewise.
> * emul_netbsd.c (write_timezone): Guard with HAVE_GETTIMEOFDAY.
> * emul_unix.c (do_unix_mkdir): Handle Win32 1-argument mkdir.
Looks good to me!
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Make PowerPC simulator compile on MinGW
2005-11-29 2:44 ` Mark Kettenis
@ 2005-11-29 12:41 ` Mark Mitchell
0 siblings, 0 replies; 7+ messages in thread
From: Mark Mitchell @ 2005-11-29 12:41 UTC (permalink / raw)
To: Mark Kettenis; +Cc: drow, gdb-patches
Mark Kettenis wrote:
> Looks good to me!
Daniel seconded offline, so I checked this in.
Thanks!
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-11-28 23:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-17 3:48 PATCH: Make PowerPC simulator compile on MinGW Mark Mitchell
2005-11-17 3:49 ` Mark Kettenis
2005-11-17 3:55 ` Mark Mitchell
2005-11-28 22:58 ` Daniel Jacobowitz
2005-11-29 2:34 ` Mark Mitchell
2005-11-29 2:44 ` Mark Kettenis
2005-11-29 12:41 ` Mark Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox