This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix LP64 model bug in PPC simulator


The PowerPC simulator didn't work on a little-endian LP64 platform
(like x86_64-unknown-linux-gnu).  The problem turned out to be that
ppc/sim/words.h is defining {un,}signed32 unconditionally as "long" --
but then depending on that being 32 bits.  Fixed with a bit of
autoconfiscation.  Tested by verifying that I can now run a simple
PowerPC binary in simulation on x86_64-unknown-linux-gnu.

OK?

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
 
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure.ac,v
retrieving revision 1.4
diff -c -5 -p -r1.4 configure.ac
*** configure.ac	28 Nov 2005 23:19:39 -0000	1.4
--- configure.ac	24 Jan 2006 05:50:56 -0000
*************** AC_TYPE_OFF_T
*** 590,599 ****
--- 590,602 ----
  AC_TYPE_PID_T
  AC_TYPE_SIGNAL
  AC_TYPE_SIZE_T
  AC_TYPE_UID_T
  
+ AC_CHECK_SIZEOF(int)
+ AC_CHECK_SIZEOF(long)
+ 
  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
  
Index: words.h
===================================================================
RCS file: /cvs/src/src/sim/ppc/words.h,v
retrieving revision 1.2
diff -c -5 -p -r1.2 words.h
*** words.h	20 Apr 2005 14:43:55 -0000	1.2
--- words.h	24 Jan 2006 05:50:59 -0000
*************** typedef char natural8;
*** 53,67 ****
--- 53,79 ----
  typedef short natural16;
  typedef long natural32;
  
  typedef signed char signed8;
  typedef signed short signed16;
+ #if SIZEOF_INT == 4
+ typedef signed int signed32;
+ #elif SIZEOF_LONG == 4
  typedef signed long signed32;
+ #else
+ #error "No 32-bit type"
+ #endif
  
  typedef unsigned char unsigned8;
  typedef unsigned short unsigned16;
+ #if SIZEOF_INT == 4
+ typedef unsigned int unsigned32;
+ #elif SIZEOF_LONG == 4
  typedef unsigned long unsigned32;
+ #else
+ #error "No 32-bit type"
+ #endif 
  
  #ifdef __GNUC__
  typedef long long natural64;
  typedef signed long long signed64;
  typedef unsigned long long unsigned64;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]