Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Fix LP64 model bug in PPC simulator
@ 2006-01-24  5:55 Mark Mitchell
  2006-01-24 19:27 ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 2006-01-24  5:55 UTC (permalink / raw)
  To: gdb-patches


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;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-24  5:55 PATCH: Fix LP64 model bug in PPC simulator Mark Mitchell
@ 2006-01-24 19:27 ` Mark Kettenis
  2006-01-24 19:52   ` Mark Mitchell
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2006-01-24 19:27 UTC (permalink / raw)
  To: mark; +Cc: gdb-patches

> Date: Mon, 23 Jan 2006 21:55:16 -0800
> From: Mark Mitchell <mark@codesourcery.com>
> 
> 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?

Any reason not to just use 'int'?  I'm pretty sure our code base makes
that assumption in a lot of places.

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-24 19:27 ` Mark Kettenis
@ 2006-01-24 19:52   ` Mark Mitchell
  2006-01-24 21:09     ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 2006-01-24 19:52 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis wrote:

> Any reason not to just use 'int'?  I'm pretty sure our code base makes
> that assumption in a lot of places.

Fine by me.  OK with that change?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-24 19:52   ` Mark Mitchell
@ 2006-01-24 21:09     ` Daniel Jacobowitz
  2006-01-24 21:45       ` Mark Kettenis
  2006-01-24 23:49       ` Mark Mitchell
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-24 21:09 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Mark Kettenis, gdb-patches

On Tue, Jan 24, 2006 at 11:52:06AM -0800, Mark Mitchell wrote:
> Mark Kettenis wrote:
> 
> > Any reason not to just use 'int'?  I'm pretty sure our code base makes
> > that assumption in a lot of places.
> 
> Fine by me.  OK with that change?

Yes, it is.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-24 21:09     ` Daniel Jacobowitz
@ 2006-01-24 21:45       ` Mark Kettenis
  2006-01-24 23:49       ` Mark Mitchell
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2006-01-24 21:45 UTC (permalink / raw)
  To: drow; +Cc: mark, mark.kettenis, gdb-patches

> Date: Tue, 24 Jan 2006 16:09:00 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> On Tue, Jan 24, 2006 at 11:52:06AM -0800, Mark Mitchell wrote:
> > Mark Kettenis wrote:
> > 
> > > Any reason not to just use 'int'?  I'm pretty sure our code base makes
> > > that assumption in a lot of places.
> > 
> > Fine by me.  OK with that change?
> 
> Yes, it is.

Sure, go ahead.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-24 21:09     ` Daniel Jacobowitz
  2006-01-24 21:45       ` Mark Kettenis
@ 2006-01-24 23:49       ` Mark Mitchell
       [not found]         ` <5981.192.87.1.22.1138179926.squirrel@webmail.xs4all.nl>
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 2006-01-24 23:49 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

Daniel Jacobowitz wrote:
> On Tue, Jan 24, 2006 at 11:52:06AM -0800, Mark Mitchell wrote:
> 
>>Mark Kettenis wrote:
>>
>>
>>>Any reason not to just use 'int'?  I'm pretty sure our code base makes
>>>that assumption in a lot of places.
>>
>>Fine by me.  OK with that change?

Here's what I checked in.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

[-- Attachment #2: gdb.sim.patch --]
[-- Type: text/plain, Size: 1245 bytes --]

2006-01-23  Mark Mitchell  <mark@codesourcery.com>

	* words.h (signed32): Define as "int".
	(unsigned32): Define as "unsigned int".

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 23:47:26 -0000
*************** typedef char natural8;
*** 53,67 ****
  typedef short natural16;
  typedef long natural32;
  
  typedef signed char signed8;
  typedef signed short signed16;
! typedef signed long signed32;
  
  typedef unsigned char unsigned8;
  typedef unsigned short unsigned16;
! typedef unsigned long unsigned32;
  
  #ifdef __GNUC__
  typedef long long natural64;
  typedef signed long long signed64;
  typedef unsigned long long unsigned64;
--- 53,67 ----
  typedef short natural16;
  typedef long natural32;
  
  typedef signed char signed8;
  typedef signed short signed16;
! typedef signed int signed32;
  
  typedef unsigned char unsigned8;
  typedef unsigned short unsigned16;
! typedef unsigned int unsigned32;
  
  #ifdef __GNUC__
  typedef long long natural64;
  typedef signed long long signed64;
  typedef unsigned long long unsigned64;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
       [not found]         ` <5981.192.87.1.22.1138179926.squirrel@webmail.xs4all.nl>
@ 2006-01-25 17:32           ` Mark Mitchell
  2006-01-25 23:08             ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 2006-01-25 17:32 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

Mark Kettenis wrote:

> Sorry that I didn't notice it before but can you change natural32 as well?

Sure -- I'm sorry I missed that.  I checked in the attached patch after
confirming that the simulator still worked on x86_64-unknown-linux-gnu.

I interpreted your note as an implicit approval of such a change.  I
hope that's OK; let me know if that was a breach of protocol, and I'll
back the patch out.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

[-- Attachment #2: gdb.sim.patch --]
[-- Type: text/plain, Size: 815 bytes --]

2006-01-25  Mark Mitchell  <mark@codesourcery.com>

	* words.h (natural32): Define as "int".

Index: words.h
===================================================================
RCS file: /cvs/src/src/sim/ppc/words.h,v
retrieving revision 1.3
diff -c -5 -p -r1.3 words.h
*** words.h	24 Jan 2006 23:48:01 -0000	1.3
--- words.h	25 Jan 2006 17:27:46 -0000
***************
*** 49,59 ****
  #endif
  
  /* bit based */
  typedef char natural8;
  typedef short natural16;
! typedef long natural32;
  
  typedef signed char signed8;
  typedef signed short signed16;
  typedef signed int signed32;
  
--- 49,59 ----
  #endif
  
  /* bit based */
  typedef char natural8;
  typedef short natural16;
! typedef int natural32;
  
  typedef signed char signed8;
  typedef signed short signed16;
  typedef signed int signed32;
  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PATCH: Fix LP64 model bug in PPC simulator
  2006-01-25 17:32           ` Mark Mitchell
@ 2006-01-25 23:08             ` Mark Kettenis
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2006-01-25 23:08 UTC (permalink / raw)
  To: mark; +Cc: gdb-patches

> Date: Wed, 25 Jan 2006 09:32:18 -0800
> From: Mark Mitchell <mark@codesourcery.com>
> 
> Mark Kettenis wrote:
> 
> > Sorry that I didn't notice it before but can you change natural32 as well?
> 
> Sure -- I'm sorry I missed that.  I checked in the attached patch after
> confirming that the simulator still worked on x86_64-unknown-linux-gnu.
> 
> I interpreted your note as an implicit approval of such a change.  I
> hope that's OK; let me know if that was a breach of protocol, and I'll
> back the patch out.

It's all-ok!

Thanks,

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-25 23:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-24  5:55 PATCH: Fix LP64 model bug in PPC simulator Mark Mitchell
2006-01-24 19:27 ` Mark Kettenis
2006-01-24 19:52   ` Mark Mitchell
2006-01-24 21:09     ` Daniel Jacobowitz
2006-01-24 21:45       ` Mark Kettenis
2006-01-24 23:49       ` Mark Mitchell
     [not found]         ` <5981.192.87.1.22.1138179926.squirrel@webmail.xs4all.nl>
2006-01-25 17:32           ` Mark Mitchell
2006-01-25 23:08             ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox