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]

Patch to fix i960 build (version 2)


[ This version uses the v850 solution instead of the c4x solution. ]

Currently attempting to build a i960 cross-compiler results in:

gcc -DCROSS_COMPILE -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H  -o f771 f/bad.o f/bit.o f/bld.o f/com.o f/data.o f/equiv.o f/expr.o f/global.o f/implic.o f/info.o f/intrin.o f/lab.o f/lex.o f/malloc.o f/name.o f/parse.o f/proj.o f/src.o f/st.o f/sta.o f/stb.o f/stc.o f/std.o f/ste.o f/storag.o f/stp.o f/str.o f/sts.o f/stt.o f/stu.o f/stv.o f/stw.o f/symbol.o f/target.o f/top.o f/type.o f/version.o f/where.o main.o libbackend.a obstack.o       ../libiberty/libiberty.a
Undefined			first referenced
 symbol  			    in file
c_lex                               libbackend.a(i960.o)
ld: fatal: Symbol referencing errors. No output written to f771

This patch implements the same approach to the problem as used
in the v850 port.

ChangeLog:

Wed Mar 14 21:01:37 EST 2001  John Wehle  (john@feith.com)

	* i960.h (i960_maxbitalignment,
	i960_last_maxbitalignment): Declare.
	* i960.c (i960_maxbitalignment,
	i960_last_maxbitalignment): Make global.
	(process_pragma): Delete.
	(i960_pr_align, i960_pr_noalign): Move from here ...
	* i960-c.c: ... to this new file.
	* t-960bare (i960-c.o): New rule.
	* t-vxworks960 (i960-c.o): Likewise.
	* config.gcc (i960-*-*): Define c_target_objs and
	cxx_target_objs.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/config/i960/i960.h.ORIGINAL	Thu Mar  1 22:41:20 2001
--- gcc/config/i960/i960.h	Wed Mar 14 20:28:01 2001
*************** Boston, MA 02111-1307, USA.  */
*** 131,136 ****
--- 131,140 ----
    fprintf (asm_out_file, "\t.type\t0x%x;", A)
  
  /* Handle pragmas for compatibility with Intel's compilers.  */
+ 
+ extern int i960_maxbitalignment;
+ extern int i960_last_maxbitalignment;
+ 
  #define REGISTER_TARGET_PRAGMAS(PFILE) do {			\
    cpp_register_pragma (PFILE, 0, "align", i960_pr_align);	\
    cpp_register_pragma (PFILE, 0, "noalign", i960_pr_noalign);	\
*** gcc/config/i960/i960.c.ORIGINAL	Thu Sep  7 18:24:33 2000
--- gcc/config/i960/i960.c	Wed Mar 14 20:24:39 2001
*************** rtx i960_compare_op0, i960_compare_op1;
*** 55,62 ****
  /* Used to implement #pragma align/noalign.  Initialized by OVERRIDE_OPTIONS
     macro in i960.h.  */
  
! static int i960_maxbitalignment;
! static int i960_last_maxbitalignment;
  
  /* Used to implement switching between MEM and ALU insn types, for better
     C series performance.  */
--- 55,62 ----
  /* Used to implement #pragma align/noalign.  Initialized by OVERRIDE_OPTIONS
     macro in i960.h.  */
  
! int i960_maxbitalignment;
! int i960_last_maxbitalignment;
  
  /* Used to implement switching between MEM and ALU insn types, for better
     C series performance.  */
*************** static int ret_label = 0;
*** 88,222 ****
  ((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0						      \
    && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node))    \
   || current_function_varargs)
- 
- /* Handle pragmas for compatibility with Intel's compilers.  */
- 
- /* NOTE: ic960 R3.0 pragma align definition:
- 
-    #pragma align [(size)] | (identifier=size[,...])
-    #pragma noalign [(identifier)[,...]]
-      
-    (all parens are optional)
-      
-    - size is [1,2,4,8,16]
-    - noalign means size==1
-    - applies only to component elements of a struct (and union?)
-    - identifier applies to structure tag (only)
-    - missing identifier means next struct
-      
-    - alignment rules for bitfields need more investigation.
- 
-    This implementation only handles the case of no identifiers.  */
- 
- void
- i960_pr_align (pfile)
-      cpp_reader *pfile ATTRIBUTE_UNUSED;
- {
-   tree number;
-   enum cpp_ttype type;
-   int align;
- 
-   type = c_lex (&number);
-   if (type == CPP_OPEN_PAREN)
-     type = c_lex (&number);
-   if (type == CPP_NAME)
-     {
-       warning ("sorry, not implemented: #pragma align NAME=SIZE");
-       return;
-     }
-   if (type != CPP_NUMBER)
-     {
-       warning ("malformed #pragma align - ignored");
-       return;
-     }
- 
-   align = TREE_INT_CST_LOW (number);
-   switch (align)
-     {
-     case 0:
-       /* Return to last alignment.  */
-       align = i960_last_maxbitalignment / 8;
-       /* Fall through.  */
-     case 16:
-     case 8:
-     case 4:
-     case 2:
-     case 1:
-       i960_last_maxbitalignment = i960_maxbitalignment;
-       i960_maxbitalignment = align * 8;
-       break;
-       
-     default:
-       /* Silently ignore bad values.  */
-       break;
-     }
- }
- 
- void
- i960_pr_noalign (pfile)
-      cpp_reader *pfile ATTRIBUTE_UNUSED;
- {
-   enum cpp_ttype type;
-   tree number;
- 
-   type = c_lex (&number);
-   if (type == CPP_OPEN_PAREN)
-     type = c_lex (&number);
-   if (type == CPP_NAME)
-     {
-       warning ("sorry, not implemented: #pragma noalign NAME");
-       return;
-     }
- 
-   i960_last_maxbitalignment = i960_maxbitalignment;
-   i960_maxbitalignment = 8;
- }
- 
- int
- process_pragma (p_getc, p_ungetc, pname)
-      int (*  p_getc) PARAMS ((void));
-      void (* p_ungetc) PARAMS ((int));
-      const char *pname;
- {
-   register int c;
-   char buf[20];
-   char *s = buf;
-   int align;
- 
-   /* Should be pragma 'far' or equivalent for callx/balx here.  */
-   if (strcmp (pname, "align") != 0)
-     return 0;
-   
-   do
-     {
-       c = p_getc ();
-     }
-   while (c == ' ' || c == '\t');
- 
-   if (c == '(')
-     c = p_getc ();
-   
-   while (c >= '0' && c <= '9')
-     {
-       if (s < buf + sizeof buf - 1)
- 	*s++ = c;
-       c = p_getc ();
-     }
-   
-   *s = '\0';
- 
-   /* We had to read a non-numerical character to get out of the
-      while loop---often a newline.  So, we have to put it back to
-      make sure we continue to parse everything properly.  */
-   
-   p_ungetc (c);
- 
-   align = atoi (buf);
- 
-   
-   
-   return 1;
- }
  
  /* Initialize variables before compiling any files.  */
  
--- 88,93 ----
*** /dev/null	Wed Mar 14 20:40:29 2001
--- gcc/config/i960/i960-c.c	Wed Mar 14 20:25:09 2001
***************
*** 0 ****
--- 1,116 ----
+ /* Intel 80960 specific, C compiler specific functions.
+    Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000
+    Free Software Foundation, Inc.
+    Contributed by Steven McGeady, Intel Corp.
+    Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
+    Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #include "config.h"
+ #include "system.h"
+ #include "cpplib.h"
+ #include "tree.h"
+ #include "c-pragma.h"
+ #include "c-lex.h"
+ #include "toplev.h"
+ #include "ggc.h"
+ #include "tm_p.h"
+ 
+ /* Handle pragmas for compatibility with Intel's compilers.  */
+ 
+ /* NOTE: ic960 R3.0 pragma align definition:
+ 
+    #pragma align [(size)] | (identifier=size[,...])
+    #pragma noalign [(identifier)[,...]]
+      
+    (all parens are optional)
+      
+    - size is [1,2,4,8,16]
+    - noalign means size==1
+    - applies only to component elements of a struct (and union?)
+    - identifier applies to structure tag (only)
+    - missing identifier means next struct
+      
+    - alignment rules for bitfields need more investigation.
+ 
+    This implementation only handles the case of no identifiers.  */
+ 
+ void
+ i960_pr_align (pfile)
+      cpp_reader *pfile ATTRIBUTE_UNUSED;
+ {
+   tree number;
+   enum cpp_ttype type;
+   int align;
+ 
+   type = c_lex (&number);
+   if (type == CPP_OPEN_PAREN)
+     type = c_lex (&number);
+   if (type == CPP_NAME)
+     {
+       warning ("sorry, not implemented: #pragma align NAME=SIZE");
+       return;
+     }
+   if (type != CPP_NUMBER)
+     {
+       warning ("malformed #pragma align - ignored");
+       return;
+     }
+ 
+   align = TREE_INT_CST_LOW (number);
+   switch (align)
+     {
+     case 0:
+       /* Return to last alignment.  */
+       align = i960_last_maxbitalignment / 8;
+       /* Fall through.  */
+     case 16:
+     case 8:
+     case 4:
+     case 2:
+     case 1:
+       i960_last_maxbitalignment = i960_maxbitalignment;
+       i960_maxbitalignment = align * 8;
+       break;
+       
+     default:
+       /* Silently ignore bad values.  */
+       break;
+     }
+ }
+ 
+ void
+ i960_pr_noalign (pfile)
+      cpp_reader *pfile ATTRIBUTE_UNUSED;
+ {
+   enum cpp_ttype type;
+   tree number;
+ 
+   type = c_lex (&number);
+   if (type == CPP_OPEN_PAREN)
+     type = c_lex (&number);
+   if (type == CPP_NAME)
+     {
+       warning ("sorry, not implemented: #pragma noalign NAME");
+       return;
+     }
+ 
+   i960_last_maxbitalignment = i960_maxbitalignment;
+   i960_maxbitalignment = 8;
+ }
*** gcc/config/i960/t-960bare.ORIGINAL	Wed Aug  4 23:27:47 1999
--- gcc/config/i960/t-960bare	Wed Mar 14 20:31:11 2001
*************** xp-bit.c: $(srcdir)/config/fp-bit.c
*** 21,26 ****
--- 21,29 ----
  	echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
  	cat $(srcdir)/config/fp-bit.c >> xp-bit.c
  
+ i960-c.o: $(srcdir)/config/i960/i960-c.c
+ 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ 
  MULTILIB_OPTIONS=mnumerics/msoft-float mlong-double-64
  MULTILIB_DIRNAMES=float soft-float ld64
  MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc mnumerics=mjf msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf
*** gcc/config/i960/t-vxworks960.ORIGINAL	Wed Aug  4 23:27:47 1999
--- gcc/config/i960/t-vxworks960	Wed Mar 14 20:31:36 2001
*************** xp-bit.c: $(srcdir)/config/fp-bit.c
*** 24,29 ****
--- 24,32 ----
  	echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
  	cat $(srcdir)/config/fp-bit.c >> xp-bit.c
  
+ i960-c.o: $(srcdir)/config/i960/i960-c.c
+ 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ 
  MULTILIB_OPTIONS=mnumerics/msoft-float mlong-double-64
  MULTILIB_DIRNAMES=float soft-float ld64
  MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf
*** gcc/config.gcc.ORIGINAL	Mon Mar 12 18:02:06 2001
--- gcc/config.gcc	Wed Mar 14 20:34:28 2001
*************** i960-wrs-vxworks5 | i960-wrs-vxworks5.0*
*** 1538,1560 ****
--- 1538,1568 ----
  	tmake_file=i960/t-vxworks960
  	use_collect2=yes
  	thread_file='vxworks'
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  i960-wrs-vxworks5* | i960-wrs-vxworks)
  	tm_file="${tm_file} dbxcoff.h i960/i960-coff.h i960/vx960-coff.h"
  	tmake_file=i960/t-vxworks960
  	use_collect2=yes
  	thread_file='vxworks'
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  i960-wrs-vxworks*)
  	tm_file="${tm_file} i960/vx960.h"
  	tmake_file=i960/t-vxworks960
  	use_collect2=yes
  	thread_file='vxworks'
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  i960-*-coff*)
  	tm_file="${tm_file} dbxcoff.h i960/i960-coff.h libgloss.h"
  	tmake_file=i960/t-960bare
  	use_collect2=yes
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  i960-*-rtems)
  	tmake_file="i960/t-960bare t-rtems"
*************** i960-*-rtems)
*** 1563,1571 ****
--- 1571,1583 ----
  	if test x$enable_threads = xyes; then
  	  thread_file='rtems'
  	fi
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  i960-*-*)			# Default i960 environment.
  	use_collect2=yes
+ 	c_target_objs="i960-c.o"
+ 	cxx_target_objs="i960-c.o"
  	;;
  ia64*-*-elf*)
  	tm_file=ia64/elf.h
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------


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