From: tir@maa486.hut.fi (Timo Riikonen)
Subject: gcc2.1 & cross-compiling
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 29 Jul 1992 16:45:00 GMT

version: gcc-2.1
Host: 386-mach3.0		(BSD-UNIX 4.3, MK74, UX35)
Result0: Same as host
Result1: 860-sysv3
Result2: 860-mach3

Result0 passed and works (modifications: touch c-parse.y).
Results 1 & 2 failed at installing (see modifications).


RESULT1
=======
Cutted from `make LANGUAGES=c install`
if [ -f libgcc2.ready ] ; then  true;  else  touch libgcc2.ready;  fi
rm -f tmplibgcc2.a
set -e;  for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2  _lshrdi3 _lshldi3 _ashldi3 _ashrdi3   _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf  _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi  _varargs _eprintf _builtin_new _builtin_New _builtin_del  _bb _shtab _clear_cache _trampoline __main _exit;  do  echo ${name};  ./gcc -O2 -DCROSS_COMPILE   -g -B./ -g1 -I. -I. -I./config -c -DL${name}  ./libgcc2.c -o ${name}.o;  if [ $? -eq 0 ] ; then true; else exit 1; fi;  /usr/l
ocal/i860-sysv3/bin/ar rc tmplibgcc2.a ${name}.o;  rm -f ${name}.o;  done
_muldi3
In file included from ./libgcc2.c:31:
./tm.h:159: warning: `USE_CONST_SECTION' redefined
./config/svr3.h:184: warning: this is the location of the previous definition
libgcc2.c:33:no such 386 instruction: `addu'
libgcc2.c:34:invalid character '.' in opcode
libgcc2.c:35:no such 386 instruction: `addu'
libgcc2.c:36:invalid character '.' in opcode
libgcc2.c:37:invalid character '.' in opcode
. 
. 
. 


I changed:
*** svr3.h~	Thu Mar 19 22:40:09 1992
--- svr3.h	Wed Jul 29 14:24:58 1992
***************
*** 211,216 ****
--- 211,220 ----
    INIT_SECTION_FUNCTION						\
    FINI_SECTION_FUNCTION
  
+ #ifndef BSS_SECTION_FUNCTION
+ #define BSS_SECTION_FUNCTION {}
+ #endif BSS_SECTION_FUNCTION
+ 
  #define INIT_SECTION_FUNCTION					\
  void								\
  init_section ()						\
***************
*** 249,255 ****
      }									\
  }
  
! #if 0
  #define CTORS_SECTION_FUNCTION						\
  void									\
  ctors_section ()							\
--- 253,259 ----
      }									\
  }
  
! #if 1
  #define CTORS_SECTION_FUNCTION						\
  void									\
  ctors_section ()							\
***************
*** 281,287 ****
     global destructors.  */
  #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       				\
    do {									\
-     fini_section ();                   				\
      fprintf (FILE, "%s\t ", ASM_LONG);					\
      assemble_name (FILE, NAME);              				\
      fprintf (FILE, "\n");						\
--- 293,298 ----


That fini_section wasn't defined and FINI_SECTION_FUNCTION macro
didn't work there.



RESULT2
=======

Changes:
*** /dev/null	Tue Jul 28 17:37:54 1992
--- i860mach.h	Wed Jul 29 10:22:29 1992
***************
*** 0 ****
--- 1,13 ----
+ /* Configuration for an i860 running Mach as the target machine.  */
+ 
+ #include "i860.h"
+ 
+ #undef TARGET_VERSION
+ #define TARGET_VERSION fprintf (stderr, " (i860 Mach3.x)");
+ 
+ #undef CPP_PREDEFINES
+ #define CPP_PREDEFINES "-Dunix -Di860 -DMACH"
+ 
+ /* Specify extra dir to search for include files.  */
+ #define SYSTEM_INCLUDE_DIR "/usr/mach/include"
+ 


*** configure~	Mon Mar 23 21:38:23 1992
--- configure	Wed Jul 29 10:28:19 1992
***************
*** 270,275 ****
--- 270,280 ----
  		tm_file=i486v4.h
  		tmake_file=t-svr4
  		;;
+ 	i860-*-mach*)
+ 		xm_file=xm-i860.h
+ 		tm_file=i860mach.h
+ 		tmake_file=t-libc-ok
+ 		;;
  	i860-*-sysv3*)
  		xm_file=xm-i86v3.h
  		xmake_file=x-i860v3


Both of the results passed the compilation (with warnings).
And both them failed to compile hello_world program on host computer. 

Stupid question:
Is the cross-compiled gcc supposed to work only on that processor?
The other alternative is that it would work on host processor, but
would compile binaries for the other processor.

-- 
Timo,		Timo.Riikonen@hut.fi

csh prompt% rm congressional-ethics
rm: congressional-ethics nonexistent

Newsgroups: gnu.gcc.bug