This is the mail archive of the gcc-bugs@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]

Re: GCC-current fails to build for a Hitachi/H8 cross compiler


 > From: Pekka Nikander <Pekka.Nikander@hut.fi>
 > 
 > When compiling GCC, everything goes well until the compilation
 > of libgcc2.  Then, during the first attempt, the compilation
 > breaks at libgcc2.h
 > 
 > In file included from ../../gcc-current/egcs/gcc/libgcc2.c:52:
 > ../../gcc-current/egcs/gcc/libgcc2.h:274: conflicting types for `__fixunsdfhi'
 > ../../gcc-current/egcs/gcc/libgcc2.h:272: previous declaration of `__fixunsdfhi'
 > ../../gcc-current/egcs/gcc/libgcc2.h:276: conflicting types for `__fixunssfhi'
 > ../../gcc-current/egcs/gcc/libgcc2.h:273: previous declaration of `__fixunssfhi'
 > 
 > This seems to be caused by the earlier definitions of 
 > __fixunsdfsi, __fixunsdfdi, __fixunssfsi, and __fixunssfdi.
 > The net result of the macros _NW and _NDW seems to be
 > 
 > #define __fixunsdfdi __fixunsdfsi
 > #define __fixunsdfsi __fixunsdfhi
 > 
 > which results both __fixunsdfdi and __fixunsdfsi being
 > defined as __fixunsdfhi.  Since the types of __fixunsdfsi
 > and __fixunsdfdi are different, the compilation fails.
 > The same applies for __fixunssfdi and __fixunssfsi.
 > 
 > If I hack around this problem, the second problem seems to be emerge
 > from the changed usage of PTRDIFF_TYPE, SIZE_TYPE and WCHAR_TYPE.
 > For some reason, these get defined on the preprosessor command
 > line as _empty_strings_.  That causes compilation of anything using
 > stddef.h to fail.  The Hitachi H8 backend has its own definitions
 > for these macros; maybe the are prosessed somehow wrong?
 > 
 > These two problems may be related or not, I don't know the internals
 > of GCC well enough.
 > 
 > I am willing to try to fix these problems myself, and have tried
 > for a couple of days, but since I don't know enough of the intended
 > usage of the used macros, I am pretty much on thin ice.  If someone
 > is willing to guide me, I can try to provide patches.
 > 
 > --Pekka Nikander
 >   Helsinki University of Technology


I don't know about the *_TYPE issue, I don't see it when cross
compiling from i686-pc-linux-gnu to h8300-unknown-none.

However this should solve the prototype/macro clash.  Please let me
know if it works for you.

		--Kaveh





2000-03-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* libgcc2.h: Move prototypes above macros with the same name.
	Wrap some function prototypes in the conditional which indicates
	whether they are supported, i.e. "BITS_PER_UNIT == 8".

diff -rup orig/egcs-CVS20000313/gcc/libgcc2.h egcs-CVS20000313/gcc/libgcc2.h
--- orig/egcs-CVS20000313/gcc/libgcc2.h	Wed Mar  8 22:34:58 2000
+++ egcs-CVS20000313/gcc/libgcc2.h	Tue Mar 14 06:59:45 2000
@@ -181,6 +181,60 @@ typedef int word_type __attribute__ ((mo
 #define __NDW(a,b)	__ ## a ## hi ## b
 #endif
 
+extern DWtype __muldi3 (DWtype, DWtype);
+extern DWtype __divdi3 (DWtype, DWtype);
+extern UDWtype __udivdi3 (UDWtype, UDWtype);
+extern UDWtype __umoddi3 (UDWtype, UDWtype);
+extern DWtype __moddi3 (DWtype, DWtype);
+/* __udivmoddi4 is static inline when building other libgcc2 portions.  */
+#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
+     !defined (L_umoddi3) && !defined (L_moddi3))
+extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
+#endif
+
+/* __negdi2 is static inline when building other libgcc2 portions.  */
+#if !defined(L_divdi3) && !defined(L_moddi3)
+extern DWtype __negdi2 (DWtype);
+#endif
+
+extern DWtype __lshrdi3 (DWtype, word_type);
+extern DWtype __ashldi3 (DWtype, word_type);
+extern DWtype __ashrdi3 (DWtype, word_type);
+extern DWtype __ffsdi2 (DWtype);
+
+/* __udiv_w_sdiv is static inline when building other libgcc2 portions.  */
+#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
+     !defined(L_umoddi3) && !defined(L_moddi3))
+extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
+#endif
+
+extern word_type __cmpdi2 (DWtype, DWtype);
+extern word_type __ucmpdi2 (DWtype, DWtype);
+
+#if BITS_PER_UNIT == 8
+extern DWtype __fixdfdi (DFtype);
+extern DWtype __fixsfdi (SFtype);
+extern DFtype __floatdidf (DWtype);
+extern SFtype __floatdisf (DWtype);
+extern UWtype __fixunsdfsi (DFtype);
+extern UWtype __fixunssfsi (SFtype);
+extern DWtype __fixunsdfdi (DFtype);
+extern DWtype __fixunssfdi (SFtype);
+
+#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
+extern DWtype __fixxfdi (XFtype);
+extern DWtype __fixunsxfdi (XFtype);
+extern XFtype __floatdixf (DWtype);
+extern UWtype __fixunsxfsi (XFtype);
+#endif
+
+#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
+extern DWtype __fixunstfdi (TFtype);
+extern DWtype __fixtfdi (TFtype);
+extern TFtype __floatditf (DWtype);
+#endif
+#endif /* BITS_PER_UNIT == 8 */
+
 #define __muldi3	__NDW(mul,3)
 #define __divdi3	__NDW(div,3)
 #define __udivdi3	__NDW(udiv,3)
@@ -237,56 +291,5 @@ typedef union
 #include "longlong.h"
 
 #endif /* udiv or mul */
-
-extern DWtype __muldi3 (DWtype, DWtype);
-extern DWtype __divdi3 (DWtype, DWtype);
-extern UDWtype __udivdi3 (UDWtype, UDWtype);
-extern UDWtype __umoddi3 (UDWtype, UDWtype);
-extern DWtype __moddi3 (DWtype, DWtype);
-/* __udivmoddi4 is static inline when building other libgcc2 portions.  */
-#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
-     !defined (L_umoddi3) && !defined (L_moddi3))
-extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
-#endif
-
-/* __negdi2 is static inline when building other libgcc2 portions.  */
-#if !defined(L_divdi3) && !defined(L_moddi3)
-extern DWtype __negdi2 (DWtype);
-#endif
-
-extern DWtype __lshrdi3 (DWtype, word_type);
-extern DWtype __ashldi3 (DWtype, word_type);
-extern DWtype __ashrdi3 (DWtype, word_type);
-extern DWtype __ffsdi2 (DWtype);
-
-/* __udiv_w_sdiv is static inline when building other libgcc2 portions.  */
-#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
-     !defined(L_umoddi3) && !defined(L_moddi3))
-extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
-#endif
-
-extern word_type __cmpdi2 (DWtype, DWtype);
-extern word_type __ucmpdi2 (DWtype, DWtype);
-extern DFtype __floatdidf (DWtype);
-extern SFtype __floatdisf (DWtype);
-extern UWtype __fixunsdfsi (DFtype);
-extern UWtype __fixunssfsi (SFtype);
-extern DWtype __fixunsdfdi (DFtype);
-extern DWtype __fixdfdi (DFtype);
-extern DWtype __fixunssfdi (SFtype);
-extern DWtype __fixsfdi (SFtype);
-
-#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
-extern DWtype __fixxfdi (XFtype);
-extern DWtype __fixunsxfdi (XFtype);
-extern XFtype __floatdixf (DWtype);
-extern UWtype __fixunsxfsi (XFtype);
-#endif
-
-#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
-extern DWtype __fixunstfdi (TFtype);
-extern DWtype __fixtfdi (TFtype);
-extern TFtype __floatditf (DWtype);
-#endif
 
 #endif /* __LIBGCC2_H__ */

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