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]
Other format: [Raw text]

3.4 PATCH: Provide target hook for special handling of collect2 flags


This patch is part of a larger set to integrate support for the IRIX 6 O32
ABI

	http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01065.html

but submitting independent parts individually for ease of review.

Whether or not to use collect2 depends on the ABI: the native O32 as cannot
handle named sections, while the N32/N64 as (and gas) can.  To handle both
situations in a single compiler/collect2, I've chosen the following
approach:

* use_collect2=yes is always enabled in config.gcc, but flag_gnu_linker is
  overridden in override_options (only enabled in a later patch in this
  series)

* do_collecting is now overridden in a new hook for collect2
  (COLLECT_PARSE_FLAG) which parses command line options and may perform
  special actions depending on them.  One cannot use target flags since
  they are not available to collect2.

This patch has currently no effect, since use_collect2 is yet unset in
config.gcc, so do_collecting already defaults to 0 for the N32/N64 ABIs.

Bootstrapped with the entire patchset above on mips-sgi-irix6.5; ok for
mainline if no regressions?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Fri Sep 12 00:12:52 2003  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* collect2.c (COLLECT_PARSE_FLAG): Provide default.
	(main): Use it.
	* doc/tm.texi (COLLECT_PARSE_FLAG): Document it.
	* config/mips/iris6.h (COLLECT_PARSE_FLAG): Define.

Index: gcc/collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.153
diff -u -p -b -r1.153 collect2.c
--- gcc/collect2.c	19 Jul 2003 14:47:00 -0000	1.153
+++ gcc/collect2.c	16 Sep 2003 14:00:11 -0000
@@ -150,6 +150,10 @@ int do_collecting = 1;
 int do_collecting = 0;
 #endif
 
+#ifndef COLLECT_PARSE_FLAG
+#define COLLECT_PARSE_FLAG(FLAG)
+#endif
+
 /* Nonzero if we should suppress the automatic demangling of identifiers
    in linker error messages.  Set from COLLECT_NO_DEMANGLE.  */
 int no_demangle;
@@ -853,8 +857,11 @@ main (int argc, char **argv)
     int i;
 
     for (i = 1; argv[i] != NULL; i ++)
+      {
       if (! strcmp (argv[i], "-debug"))
 	debug = 1;
+	COLLECT_PARSE_FLAG (argv[i]);
+      }
     vflag = debug;
   }
 
Index: gcc/config/mips/iris6.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision 1.67
diff -u -p -r1.67 iris6.h
--- gcc/config/mips/iris6.h	12 Aug 2003 20:50:29 -0000	1.67
+++ gcc/config/mips/iris6.h	17 Sep 2003 18:44:30 -0000
@@ -459,4 +459,13 @@ while (0)
 -_SYSTYPE_SVR4 -woff 131 \
 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
 
+/* We need to disable collecting for the N32 and N64 ABIs.  */
+#define COLLECT_PARSE_FLAG(FLAG)				\
+do {								\
+  if (! strcmp (FLAG, "-n32") || ! strcmp (FLAG, "-64"))	\
+    do_collecting = 0;						\
+  if (! strcmp (FLAG, "-32") || ! strcmp (FLAG, "-o32"))	\
+    do_collecting = 1;						\
+} while (0)
+ 
 #define MIPS_TFMODE_FORMAT mips_extended_format
Index: gcc/doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.255
diff -u -p -b -r1.255 tm.texi
--- gcc/doc/tm.texi	4 Sep 2003 03:18:03 -0000	1.255
+++ gcc/doc/tm.texi	16 Sep 2003 14:00:28 -0000
@@ -7140,6 +7140,12 @@ This macro is effective only in a native
 part of a cross compiler always uses @command{nm} for the target machine.
 @end defmac
 
+@defmac COLLECT_PARSE_FLAG (@var{flag})
+Define this macro to be C code that examines @command{collect2} command
+line option @var{flag} and performs special actions if
+@command{collect2} needs to behave differently depending on @var{flag}.
+@end defmac
+
 @defmac REAL_NM_FILE_NAME
 Define this macro as a C string constant containing the file name to use
 to execute @command{nm}.  The default is to search the path normally for


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