This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] tsystem.h, unwind-pe.h: Make h8300 port buildable again.


Hi,

Attached is a patch to make the h8300 port buildable again.

The patch for tsystem.h matters when unwind-dw2-fde.c is compiled
because it uses strlen().  Since macro inhibit_libc is defined,
tsystem.h will not include string.h.

The patch for unwind-pe.h matters when it is compiled with -mn and
-mint32, which say that the pointer is 16-bit wide, but the integer is
32-bit wide.  "a + sizeof (void *)" will have 32 bits because
everything is promoted to at least int!?  So we need to convert the
result back to a 16-bit integer by putting a cast to
_Unwind_Internal_Ptr.

Tested on h8300 port.  OK to apply?

Kazu Hirata

2003-11-03  Kazu Hirata  <kazu@cs.umass.edu>

	* tsystem.h: Add the prototype of strlen.
	* unwind-pe.h (read_encoded_value_with_base): Add an
	appropriate cast to handle a case where the pointer size is
	smaller than sizeof (int).

Index: tsystem.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tsystem.h,v
retrieving revision 1.10
diff -u -r1.10 tsystem.h
--- tsystem.h	13 Jun 2003 21:52:02 -0000	1.10
+++ tsystem.h	3 Nov 2003 22:47:43 -0000
@@ -62,6 +62,10 @@
 extern void abort (void) __attribute__ ((__noreturn__));
 #endif
 
+#ifndef strlen
+extern size_t strlen (const char *);
+#endif
+
 #else /* ! inhibit_libc */
 /* We disable this when inhibit_libc, so that gcc can still be built without
    needing header files first.  */
Index: unwind-pe.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-pe.h,v
retrieving revision 1.14
diff -u -r1.14 unwind-pe.h
--- unwind-pe.h	3 Oct 2003 15:42:08 -0000	1.14
+++ unwind-pe.h	3 Nov 2003 22:47:44 -0000
@@ -199,7 +199,7 @@
       _Unwind_Internal_Ptr a = (_Unwind_Internal_Ptr) p;
       a = (a + sizeof (void *) - 1) & - sizeof(void *);
       result = *(_Unwind_Internal_Ptr *) a;
-      p = (const unsigned char *) (a + sizeof (void *));
+      p = (const unsigned char *) (_Unwind_Internal_Ptr) (a + sizeof (void *));
     }
   else
     {


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