foo override patch for emit_library_call() in expand_main_function()

David O'Brien obrien@NUXI.com
Fri Nov 5 14:17:00 GMT 1999


In the FreeBSD Native case, the decision to call call emit_library_call()
cannot be made at compile time, but must be done at compile time.  This
is due to the needs of our dual ELF/a.out capiblity.

This patch has been bootstrapped on both FreeBSD 4.0-CURRENT and Solaris 7.

-- 
-- David    (obrien@FreeBSD.org)


Fri Nov 05 14:43:05 1999  David E. O'Brien  <obrien@FreeBSD.org>

	* function.c (expand_main_function): Allow the call to
	emit_library_call to be overridden, even at run-time.


diff -ruN egcs-19991102.orig/gcc/function.c egcs-19991102/gcc/function.c
--- egcs-19991102.orig/gcc/function.c	Sun Oct 31 17:11:20 1999
+++ egcs-19991102/gcc/function.c	Wed Nov  3 23:30:35 1999
@@ -5864,12 +5864,19 @@
 #define HAS_INIT_SECTION
 #endif
 
+#ifndef GEN_CALL__MAIN
+#define GEN_CALL__MAIN \
+  do {									\
+    emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0,	\
+		       VOIDmode, 0);					\
+  } while (0)
+#endif
+
 void
 expand_main_function ()
 {
-#if !defined (HAS_INIT_SECTION)
-  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, NAME__MAIN), 0,
-		     VOIDmode, 0);
+#if defined(INVOKE__main) || !defined (HAS_INIT_SECTION)
+  GEN_CALL__MAIN;
 #endif /* not HAS_INIT_SECTION */
 }
 


More information about the Gcc-patches mailing list