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]

inhibit_libc definition patch


One of the problems i've run into several times (several recent
vintages of gcc, at several employers 8-) is the fact that the a
cross-compiler cannot be built without any target headers, which is
(as far as I can tell) caused by misplaced or outright missing
definitions for inhibit_libc.

Others have noticed this problem, and posted to the list about it.  An
example:

	http://gcc.gnu.org/ml/gcc/1999-06n/msg00729.html

Other have pointed out that e.g. frame.c and crtstuff.c also have
compilation issues, because of missing definition.

I've looked in the archives, and I didn't see any thing that explained
a reason that this problem shouldn't be solved with a solution not
unlike the one in the URL quoted above.  (I have seen other people
suggesting interesting patches relating to inhibit_libc, e.g.,
http://gcc.gnu.org/ml/gcc/1999-06n/msg00729.html, but as far as I can
tell from the list archives and the state of the current sources,
these haven't had much impact either.


If the sources (as opposed to the configure script) are supposed to
automatically define inhibit_libc (in the CROSS_COMPILE case), as is
currently done _after_ inhibit_libc's use in libgcc2.c, i'd expect
that:

	* inhibit_libc should be defined consistently, and

	* inhibit_libc should be defined before code which checks
	  it checks it.

Assuming that those are correct, i've included a patch below which
moves the "#define inhibit_libc" chunk from libgcc2.c to the top of
tsystem.h.


the patch below has been checked by configuring with host=sparc
solaris 2.7, and target=mips64-elf, then building with "gmake
ALL_TARGET_MODULES= (to suppress builds of 'egcs' subdirs other than
'gcc').

If it's not acceptable or The Right Thing, it'd really be nice to know
what the right thing is.  8-)


cgd
===================================================================
ChangLog entry:

2000-04-28  Chris Demetriou  <cgd@sibyte.com>

	libgcc2.c (inhibit_libc): Don't define inhibit_libc here.
	tsystem.h (inhibit_libc): Define inhibit_libc here if
	not already defined and if CROSS_COMPILE is defined (same
	conditions under which it used to be defined in libgcc2.c).

Index: gcc/tsystem.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tsystem.h,v
retrieving revision 1.1
diff -c -r1.1 tsystem.h
*** tsystem.h	2000/02/01 21:30:51	1.1
--- tsystem.h	2000/04/28 20:38:17
***************
*** 22,27 ****
--- 22,34 ----
  #ifndef __GCC_TSYSTEM_H__
  #define __GCC_TSYSTEM_H__
  
+ /* In a cross-compilation situation, default to inhibiting compilation
+    of routines that use libc.  */
+ 
+ #if defined(CROSS_COMPILE) && !defined(inhibit_libc)
+ #define inhibit_libc
+ #endif
+ 
  /* GCC supplies this header. */
  #include <stddef.h>
  
Index: ./gcc/libgcc2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/libgcc2.c,v
retrieving revision 1.90
diff -c -r1.90 libgcc2.c
*** libgcc2.c	2000/04/15 16:34:38	1.90
--- libgcc2.c	2000/04/28 20:38:18
***************
*** 42,54 ****
  #undef abort
  #endif
  
- /* In a cross-compilation situation, default to inhibiting compilation
-    of routines that use libc.  */
- 
- #if defined(CROSS_COMPILE) && !defined(inhibit_libc)
- #define inhibit_libc
- #endif
- 
  #include "libgcc2.h"
  
  #if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
--- 42,47 ----


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