From: Michael Tautschnig <mt@debian.org>
Date: Tue, 7 Nov 2006 21:47:42 +0100
Subject: Patch for gcc > 3.2

Forwarded: no
---
 h8300.rcx             | 18 +++++++++---------
 lib/c++/stub.c        |  6 ++++++
 lib/float/addsf3.s    |  2 +-
 lib/float/expandsf.s  |  2 +-
 lib/float/fixsfsi.s   |  2 +-
 lib/float/floatsisf.s |  2 +-
 lib/float/joinsf.s    |  2 +-
 lib/float/normalsf.s  |  2 +-
 util/dll-src/genlds.c |  2 +-
 9 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/h8300.rcx b/h8300.rcx
index 2b648e7..6e88da6 100644
--- a/h8300.rcx
+++ b/h8300.rcx
@@ -16,7 +16,7 @@ MEMORY {
   ram      : o = 0x8000, l = 0x6f30
   lcddata  : o = 0xef30, l = 0x0020   /* display memory */
   ram2     : o = 0xef50, l = 0x00b0
-  ram3     : o = 0xf002, l = 0x0b7e
+  ram3     : o = 0xf000, l = 0x0b80
   romdata  : o = 0xfd80, l = 0x0040   /* port shadows, interrupt vectors */
   ram4     : o = 0xfe00, l = 0x0100
 
@@ -74,7 +74,13 @@ SECTIONS {
     __edata = . ;
   } > ram
 
-  .bss : {
+  .text.hi : {
+    ___text_hi = . ;
+    *(.text.hi)
+    ___etext_hi = . ;
+  } > ram3 AT>ram
+
+  .bss ___data_end : {
     ___bss     = . ;
     _bss_start = . ; 
     *(.bss)
@@ -82,13 +88,7 @@ SECTIONS {
     ___bss_end = ALIGN(2) ;
     _mm_start  = ALIGN(2) ;    /* start memory management here */
     _end       = ALIGN(2) ;  
-  } >ram
-
-  .text.hi : AT (_bss_start) {
-    ___text_hi = . ;
-    *(.text.hi)
-    ___etext_hi = . ;
-  } > ram3
+  } AT>ram
 
   .lcddata : {
     _display_memory =  0xef43 - 0xef30 ; 
diff --git a/lib/c++/stub.c b/lib/c++/stub.c
index 2d65dae..48c6922 100644
--- a/lib/c++/stub.c
+++ b/lib/c++/stub.c
@@ -96,3 +96,9 @@ __pure_virtual()
   __terminate();
 }
 
+void
+__cxa_pure_virtual()
+{
+  __terminate();
+}
+
diff --git a/lib/float/addsf3.s b/lib/float/addsf3.s
index 7b35674..c22917f 100644
--- a/lib/float/addsf3.s
+++ b/lib/float/addsf3.s
@@ -184,7 +184,7 @@ subentry:
         mov.w   @(6,r7),r1
         not.b   r2l             ; negate exponent difference
         not.b   r2h
-        adds.w  #1,r2
+        adds    #1,r2
 
     endif_2:
 
diff --git a/lib/float/expandsf.s b/lib/float/expandsf.s
index 20f03ed..9e51225 100644
--- a/lib/float/expandsf.s
+++ b/lib/float/expandsf.s
@@ -118,7 +118,7 @@ ___expandsf:
 
                 ; Decrement exponent
 
-                subs.w  #1,r4
+                subs    #1,r4
 
                 ; Is one bit set?  (one bit is in 1 << 23 or 00800000 position)
 
diff --git a/lib/float/fixsfsi.s b/lib/float/fixsfsi.s
index 10a78f8..def427b 100644
--- a/lib/float/fixsfsi.s
+++ b/lib/float/fixsfsi.s
@@ -192,7 +192,7 @@ fix:
 
     ; Subtract bias + 31 from exponent
 
-    add.b   #-158,r4l           ; subtract bias + 31 from exponent
+    add.b   #256-158,r4l        ; subtract bias + 31 from exponent
     addx.b  #-1,r4h
 
     ; Is exponent < 0 ?
diff --git a/lib/float/floatsisf.s b/lib/float/floatsisf.s
index b754756..a6145c4 100644
--- a/lib/float/floatsisf.s
+++ b/lib/float/floatsisf.s
@@ -135,7 +135,7 @@ ufloatentry:
 
         ; Increase exponent
 
-        adds.w  #1,r4           ; add one to exponent
+        adds    #1,r4           ; add one to exponent
 
         bra     endif_1
 
diff --git a/lib/float/joinsf.s b/lib/float/joinsf.s
index 1ffb082..d671a5c 100644
--- a/lib/float/joinsf.s
+++ b/lib/float/joinsf.s
@@ -197,7 +197,7 @@ fixoverflow:
 
         ; Increase exponent
 
-        adds.w  #1,r4           ; add one to exponent
+        adds    #1,r4           ; add one to exponent
 
     endif_5:
 
diff --git a/lib/float/normalsf.s b/lib/float/normalsf.s
index 58d7baf..58add3b 100644
--- a/lib/float/normalsf.s
+++ b/lib/float/normalsf.s
@@ -51,7 +51,7 @@ ___normalizesf:
 
         ; Decrement exponent
 
-        subs.w  #1,r4
+        subs    #1,r4
 
         ; Repeat
 
diff --git a/util/dll-src/genlds.c b/util/dll-src/genlds.c
index 769f459..c90ba28 100644
--- a/util/dll-src/genlds.c
+++ b/util/dll-src/genlds.c
@@ -192,7 +192,7 @@ static void print_footer(FILE *f) {
   .stack : {\n\
     _stack = . ; \n\
     *(.stack)\n\
-  }  > topram\n\
+  }  > stack\n\
 \n\
   .eight 0xff00: {\n\
     *(.eight)\n\
