Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* SH simulator build fix
@ 2005-04-12 19:05 Jonathan Larmour
  2005-04-12 19:10 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Larmour @ 2005-04-12 19:05 UTC (permalink / raw)
  To: gdb-patches

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

The SH simulator doesn't build on slightly older GCC. gencode.c relies on 
the C99 ability (like C++) to define variables after code in a function. 
So for example it would generate source code in code.c like:

   case 37:
     {
       {
         RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();
         int i;

where RAISE_EXCEPTION_IF_IN_DELAY_SLOT is:
#define RAISE_EXCEPTION_IF_IN_DELAY_SLOT() \
   if (in_delay_slot) RAISE_EXCEPTION (SIGILL)


Fortunately the fix is trivial, and attached!

2005-04-12  Jonathan Larmour  <jifl@eCosCentric.com>

	* gencode.c (tab): Avoid inserting code before variables all declared.

I have CVS write access to src, so I can do the check-in assuming that's 
easier.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

[-- Attachment #2: gdb-6.3-shsim.patch --]
[-- Type: text/x-patch, Size: 1716 bytes --]

diff -ur gdb-6.3/sim/sh/gencode.c gdb-6.3x/sim/sh/gencode.c
--- gdb-6.3/sim/sh/gencode.c	2004-09-08 10:11:50.000000000 +0100
+++ gdb-6.3x/sim/sh/gencode.c	2005-04-12 19:44:42.141676053 +0100
@@ -102,8 +102,8 @@
 
   { "", "n", "bit32 #imm3,@(disp12,<REG_N>)", "0011nnnni8*11001",
     "/* 32-bit logical bit-manipulation instructions.  */",
-    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "int word2 = RIAT (nip);",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "i >>= 4;	/* BOGUS: Using only three bits of 'i'.  */",
     "/* MSB of 'i' must be zero.  */",
     "if (i > 7)",
@@ -238,9 +238,9 @@
     "saved_state.asregs.regstack[bankn].regs[regn] = R0;",
   },
   { "", "", "resbank", "0000000001011011",
+    "int i;",
     "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     /* FIXME: cdef all */
-    "int i;",
     "if (BO) {	/* Bank Overflow */",
     /* FIXME: how do we know when to reset BO?  */
     "  for (i = 0; i <= 14; i++) {",
@@ -587,8 +587,8 @@
     "   and mov.bwl <REG_N>, @(disp12,<REG_M>)",
     "   and mov.bwl @(disp12,<REG_N>),<REG_M>",
     "   and movu.bw @(disp12,<REG_N>),<REG_M>.  */",
-    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "int word2 = RIAT (nip);",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "SET_NIP (nip + 2);	/* Consume 2 more bytes.  */",
     "MA (1);",
     "do_long_move_insn (word2 & 0xf000, word2 & 0x0fff, m, n, &thislock);",
@@ -1493,8 +1493,8 @@
   },
 
   { "0", "", "trapa #<imm>", "11000011i8*1....", 
-    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "long imm = 0xff & i;",
+    "RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();",
     "if (i < 20 || i == 33 || i == 34 || i == 0xc3)",
     "  nip += trap (i, &R0, PC, memory, maskl, maskw, endianw);",
 #if 0

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

* Re: SH simulator build fix
  2005-04-12 19:05 SH simulator build fix Jonathan Larmour
@ 2005-04-12 19:10 ` Daniel Jacobowitz
  2005-04-12 21:50   ` Jonathan Larmour
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2005-04-12 19:10 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: gdb-patches

On Tue, Apr 12, 2005 at 08:04:54PM +0100, Jonathan Larmour wrote:
> The SH simulator doesn't build on slightly older GCC. gencode.c relies on 
> the C99 ability (like C++) to define variables after code in a function. 
> So for example it would generate source code in code.c like:
> 
>   case 37:
>     {
>       {
>         RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();
>         int i;
> 
> where RAISE_EXCEPTION_IF_IN_DELAY_SLOT is:
> #define RAISE_EXCEPTION_IF_IN_DELAY_SLOT() \
>   if (in_delay_slot) RAISE_EXCEPTION (SIGILL)
> 
> 
> Fortunately the fix is trivial, and attached!
> 
> 2005-04-12  Jonathan Larmour  <jifl@eCosCentric.com>
> 
> 	* gencode.c (tab): Avoid inserting code before variables all 
> 	declared.
> 
> I have CVS write access to src, so I can do the check-in assuming that's 
> easier.

Sure looks like an obvious fix to me; please go ahead, assuming that
you have tested the resulting simulator.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


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

* Re: SH simulator build fix
  2005-04-12 19:10 ` Daniel Jacobowitz
@ 2005-04-12 21:50   ` Jonathan Larmour
  2005-04-14 19:13     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Larmour @ 2005-04-12 21:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Tue, Apr 12, 2005 at 08:04:54PM +0100, Jonathan Larmour wrote:
> 
>>The SH simulator doesn't build on slightly older GCC. gencode.c relies on 
>>the C99 ability (like C++) to define variables after code in a function. 
>>So for example it would generate source code in code.c like:
>>
>>  case 37:
>>    {
>>      {
>>        RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();
>>        int i;
>>
>>where RAISE_EXCEPTION_IF_IN_DELAY_SLOT is:
>>#define RAISE_EXCEPTION_IF_IN_DELAY_SLOT() \
>>  if (in_delay_slot) RAISE_EXCEPTION (SIGILL)
>>
>>
>>Fortunately the fix is trivial, and attached!
>>
>>2005-04-12  Jonathan Larmour  <jifl@eCosCentric.com>
>>
>>	* gencode.c (tab): Avoid inserting code before variables all 
>>	declared.
>>
>>I have CVS write access to src, so I can do the check-in assuming that's 
>>easier.
> 
> 
> Sure looks like an obvious fix to me; please go ahead, assuming that
> you have tested the resulting simulator.

For a build failure?

I'm not in a position to test the simulator sorry. I don't have tools that 
can generate code that can run in it. To be honest, the build failure was 
only affecting me by getting in the way of a GDB build.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


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

* Re: SH simulator build fix
  2005-04-12 21:50   ` Jonathan Larmour
@ 2005-04-14 19:13     ` Daniel Jacobowitz
  2005-04-14 20:16       ` Jonathan Larmour
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2005-04-14 19:13 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: gdb-patches

On Tue, Apr 12, 2005 at 10:50:08PM +0100, Jonathan Larmour wrote:
> Daniel Jacobowitz wrote:
> >On Tue, Apr 12, 2005 at 08:04:54PM +0100, Jonathan Larmour wrote:
> >
> >>The SH simulator doesn't build on slightly older GCC. gencode.c relies on 
> >>the C99 ability (like C++) to define variables after code in a function. 
> >>So for example it would generate source code in code.c like:
> >>
> >> case 37:
> >>   {
> >>     {
> >>       RAISE_EXCEPTION_IF_IN_DELAY_SLOT ();
> >>       int i;
> >>
> >>where RAISE_EXCEPTION_IF_IN_DELAY_SLOT is:
> >>#define RAISE_EXCEPTION_IF_IN_DELAY_SLOT() \
> >> if (in_delay_slot) RAISE_EXCEPTION (SIGILL)
> >>
> >>
> >>Fortunately the fix is trivial, and attached!
> >>
> >>2005-04-12  Jonathan Larmour  <jifl@eCosCentric.com>
> >>
> >>	* gencode.c (tab): Avoid inserting code before variables all 
> >>	declared.
> >>
> >>I have CVS write access to src, so I can do the check-in assuming that's 
> >>easier.
> >
> >
> >Sure looks like an obvious fix to me; please go ahead, assuming that
> >you have tested the resulting simulator.
> 
> For a build failure?
> 
> I'm not in a position to test the simulator sorry. I don't have tools that 
> can generate code that can run in it. To be honest, the build failure was 
> only affecting me by getting in the way of a GDB build.

Well, the patch does look correct after a closer reading, and the
resulting simulator builds where the old one didn't.  Please go ahead
and check this in.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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

* Re: SH simulator build fix
  2005-04-14 19:13     ` Daniel Jacobowitz
@ 2005-04-14 20:16       ` Jonathan Larmour
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Larmour @ 2005-04-14 20:16 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> 
> Well, the patch does look correct after a closer reading, and the
> resulting simulator builds where the old one didn't.  Please go ahead
> and check this in.

Done, thanks!

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


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

end of thread, other threads:[~2005-04-14 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-12 19:05 SH simulator build fix Jonathan Larmour
2005-04-12 19:10 ` Daniel Jacobowitz
2005-04-12 21:50   ` Jonathan Larmour
2005-04-14 19:13     ` Daniel Jacobowitz
2005-04-14 20:16       ` Jonathan Larmour

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