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]

Remove TARGET_OPTION_TRANSLATE_TABLE


This patch removes the TARGET_OPTION_TRANSLATE_TABLE target macro.  I
think this is the last target macro to be removed as part of this
series of options/multilibs patches (previously removed were:
OVERRIDE_OPTIONS OPTIMIZATION_OPTIONS CAN_DEBUG_WITHOUT_FP
MODIFY_TARGET_NAME SWITCHES_NEED_SPACES SWITCH_CURTAILS_COMPILATION
SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG), although further
rearrangement of target hooks is still needed.

The basic problem with TARGET_OPTION_TRANSLATE_TABLE was its nature as
textual substitution that needed to happen in the course of splitting
the command line into options and could not operate at all on any sort
of logical option structure.  This patch uses several existing more
structured mechanisms to replace it:

* Some cases were one option as an exact alias of another, for which
  Alias declarations in the .opt files sufficed.  (In the RX case this
  does mean mnofpu rather than nofpu is now marked with Report, but I
  think it generally is right to consider the -m form of a target
  option the standard form and other forms legacy versions.  I haven't
  done anything to documentation to make -mnofpu otherwise canonical,
  however.  In the Darwin case -shared was mapped directly to
  -Zdynamiclib but I handled this through DRIVER_SELF_SPECS to avoid
  problematic interactions with the generic -shared definition in
  common.opt.)

* In some cases, one option enabled a sequence of other options in a
  reasonably straightforward way, and this was done this way rather
  than in cc1 because the other options are the ones used in multilib
  selection.  In these cases - mep and picochip - I used
  DRIVER_SELF_SPECS.  The precise order of options on the generated
  command line may have changed, but the previous code wouldn't have
  handled order-sensitive cases correctly anyway (with regard to
  options fully or partially overriding each other - full overriding
  sensitive to order, partial overriding not) and I don't think
  perturbations in this area are a problem.  The final multilibs
  changes will allow these cases to move to a more structured system
  of option implications while still having the desired multilib
  selection effects.

* By far the most complicated uses of TARGET_OPTION_TRANSLATE_TABLE
  were those for Darwin.  Many could be handled by Alias
  declarations.  Others were put in DRIVER_SELF_SPECS or CC1_SPEC as
  appropriate.  Cases generating -Wa,-static were handled via
  ASM_SPEC.  Finally, -filelist and -framework translated to "-Xlinker
  -filelist -Xlinker" and "-Xlinker -framework -Xlinker"; at least for
  the -filelist case there was a comment explaining this as being to
  allow the option to be passed to the linker even when there are
  apparently no input files on the command line.

  Specs cannot add -Xlinker options like that, as DRIVER_SELF_SPECS is
  processed after the set of input files has been determined.  I
  considered adding a driver set of hooks as described in
  <http://gcc.gnu.org/ml/gcc/2010-10/msg00294.html>, and a driver-only
  target-option hook that would be defined to process those two
  options and add input files appropriately.  But in the end I went
  with the simpler approach of still doing the -Xlinker conversion,
  but in GCC_DRIVER_HOST_INITIALIZATION (the macro of confused nature
  I discussed in
  <http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01007.html>), now
  defined always for Darwin target rather than only for Darwin nature;
  at least there it works on decoded options rather than through
  textual substitution before decoding.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  I also
built cc1 and xgcc for crosses to: mep-elf picochip-none rx-elf
i686-darwin powerpc-darwin.  I checked options passed to cc1 and
examined the decoded options in the debugger for various cases for
these targets, but at with my previous patch
<http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00479.html> it would be
useful for people to run further tests for those targets.  OK to
commit?

2010-11-09  Joseph Myers  <joseph@codesourcery.com>

	* doc/tm.texi.in (TARGET_OPTION_TRANSLATE_TABLE): Remove.
	* doc/tm.texi: Regenerate.
	* opts-common.c (tm.h): Don't include.
	(target_option_translations): Remove.
	(decode_cmdline_options_to_array): Don't handle translating
	options.
	* system.h (TARGET_OPTION_TRANSLATE_TABLE): Poison.
	* config/darwin-driver.c: Don't condition includes on
	CROSS_DIRECTORY_STRUCTURE.
	(darwin_default_min_version): Make static.
	(darwin_driver_init): New.  Call darwin_default_min_version if not
	CROSS_DIRECTORY_STRUCTURE.
	* config/darwin.h (TARGET_OPTION_TRANSLATE_TABLE): Remove.
	(DRIVER_SELF_SPECS, DARWIN_CC1_SPEC): Define.
	(ASM_SPEC): Add %{static}.
	(darwin_default_min_version): Don't declare.
	(darwin_driver_init): Declare.
	(GCC_DRIVER_HOST_INITIALIZATION): Define to call
	darwin_driver_init, independent of CROSS_DIRECTORY_STRUCTURE.
	* config/darwin.opt (all_load, allowable_client,
	arch_errors_fatal, bind_at_load, bundle, bundle_loader,
	dead_strip, dependency-file, dylib_file, dynamic, dynamiclib,
	exported_symbols_list, filelist, findirect-virtual-calls,
	flat_namespace, force_cpusubtype_ALL, force_flat_namespace,
	framework, fterminated-vtables, gfull, gused, image_base, init,
	install_name, multi_module, multiply_defined,
	multiply_defined_unused, no_dead_strip_inits_and_terms,
	seg_addr_table, seg_addr_table_filename, segaddr,
	segs_read_only_addr, segs_read_write_addr, single_module,
	umbrella, unexported_symbols_list, weak_reference_mismatches,
	Zall_load, Zarch_errors_fatal, Zbind_at_load, Zbundle,
	Zdead_strip, Zdynamic, Zdynamiclib, Zflat_namespace,
	Zforce_cpusubtype_ALL, Zforce_flat_namespace, Zmulti_module,
	Zno_dead_strip_inits_and_terms, Zsingle_module): New.
	* config/i386/darwin.h (CC1_SPEC): Add DARWIN_CC1_SPEC.
	(ASM_SPEC): Add %{static}.
	(SUBTARGET_OPTION_TRANSLATE_TABLE): Remove.
	* config/mep/mep.h (TARGET_OPTION_TRANSLATE_TABLE): Remove.
	(DRIVER_SELF_SPECS): Handle options formerly in
	TARGET_OPTION_TRANSLATE_TABLE.
	* config/mep/mep.opt (mfar): New.
	* config/picochip/picochip.h (TARGET_OPTION_TRANSLATE_TABLE):
	Remove.
	(DRIVER_SELF_SPECS): Define.  Handle options formerly in
	TARGET_OPTION_TRANSLATE_TABLE.
	* config/rs6000/darwin.h (CC1_SPEC): Handle -faltivec and
	-fno-altivec.
	(SUBTARGET_OPTION_TRANSLATE_TABLE): Remove.
	* config/rs6000/darwin.opt (Waltivec-long-deprecated, faltivec,
	ffix-and-continue, findirect-data): New.
	* config/rx/rx.h (TARGET_OPTION_TRANSLATE_TABLE): Remove.
	* config/rx/rx.opt (nofpu): Make into alias of mnofpu.
	(mnofpu): Define mask and use Report here.

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 166433)
+++ gcc/doc/tm.texi	(working copy)
@@ -99,26 +99,6 @@ from being defined in the @file{.h} file
 @c prevent bad page break with this line
 You can control the compilation driver.
 
-@defmac TARGET_OPTION_TRANSLATE_TABLE
-If defined, a list of pairs of strings, the first of which is a
-potential command line target to the @file{gcc} driver program, and the
-second of which is a space-separated (tabs and other whitespace are not
-supported) list of options with which to replace the first option.  The
-target defining this list is responsible for assuring that the results
-are valid.  Replacement options may not be the @code{--opt} style, they
-must be the @code{-opt} style.  It is the intention of this macro to
-provide a mechanism for substitution that affects the multilibs chosen,
-such as one option that enables many options, some of which select
-multilibs.  Example nonsensical definition, where @option{-malt-abi},
-@option{-EB}, and @option{-mspoo} cause different multilibs to be chosen:
-
-@smallexample
-#define TARGET_OPTION_TRANSLATE_TABLE \
-@{ "-fast",   "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
-@{ "-compat", "-EB -malign=4 -mspoo" @}
-@end smallexample
-@end defmac
-
 @defmac DRIVER_SELF_SPECS
 A list of specs for the driver itself.  It should be a suitable
 initializer for an array of strings, with no surrounding braces.
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 166433)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -99,26 +99,6 @@ from being defined in the @file{.h} file
 @c prevent bad page break with this line
 You can control the compilation driver.
 
-@defmac TARGET_OPTION_TRANSLATE_TABLE
-If defined, a list of pairs of strings, the first of which is a
-potential command line target to the @file{gcc} driver program, and the
-second of which is a space-separated (tabs and other whitespace are not
-supported) list of options with which to replace the first option.  The
-target defining this list is responsible for assuring that the results
-are valid.  Replacement options may not be the @code{--opt} style, they
-must be the @code{-opt} style.  It is the intention of this macro to
-provide a mechanism for substitution that affects the multilibs chosen,
-such as one option that enables many options, some of which select
-multilibs.  Example nonsensical definition, where @option{-malt-abi},
-@option{-EB}, and @option{-mspoo} cause different multilibs to be chosen:
-
-@smallexample
-#define TARGET_OPTION_TRANSLATE_TABLE \
-@{ "-fast",   "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
-@{ "-compat", "-EB -malign=4 -mspoo" @}
-@end smallexample
-@end defmac
-
 @defmac DRIVER_SELF_SPECS
 A list of specs for the driver itself.  It should be a suitable
 initializer for an array of strings, with no surrounding braces.
Index: gcc/opts-common.c
===================================================================
--- gcc/opts-common.c	(revision 166433)
+++ gcc/opts-common.c	(working copy)
@@ -24,7 +24,6 @@ along with GCC; see the file COPYING3.  
 #include "opts.h"
 #include "flags.h"
 #include "diagnostic.h"
-#include "tm.h" /* For TARGET_OPTION_TRANSLATE_TABLE.  */
 
 static void prune_options (struct cl_decoded_option **, unsigned int *);
 
@@ -567,17 +566,6 @@ decode_cmdline_option (const char **argv
   return result;
 }
 
-#ifdef TARGET_OPTION_TRANSLATE_TABLE
-static const struct {
-  const char *const option_found;
-  const char *const replacements;
-} target_option_translations[] =
-{
-  TARGET_OPTION_TRANSLATE_TABLE,
-  { 0, 0 }
-};
-#endif
-
 /* Decode command-line options (ARGC and ARGV being the arguments of
    main) into an array, setting *DECODED_OPTIONS to a pointer to that
    array and *DECODED_OPTIONS_COUNT to the number of entries in the
@@ -593,7 +581,7 @@ decode_cmdline_options_to_array (unsigne
 				 struct cl_decoded_option **decoded_options,
 				 unsigned int *decoded_options_count)
 {
-  unsigned int n, i, target_translate_from;
+  unsigned int n, i;
   struct cl_decoded_option *opt_array;
   unsigned int num_decoded_options;
   bool argv_copied = false;
@@ -613,7 +601,6 @@ decode_cmdline_options_to_array (unsigne
   opt_array[0].errors = 0;
   num_decoded_options = 1;
 
-  target_translate_from = 1;
   for (i = 1; i < argc; i += n)
     {
       const char *opt = argv[i];
@@ -627,81 +614,6 @@ decode_cmdline_options_to_array (unsigne
 	  continue;
 	}
 
-      if (i >= target_translate_from && (lang_mask & CL_DRIVER))
-	{
-#ifdef TARGET_OPTION_TRANSLATE_TABLE
-	  int tott_idx;
-
-	  for (tott_idx = 0;
-	       target_option_translations[tott_idx].option_found;
-	       tott_idx++)
-	    {
-	      if (strcmp (target_option_translations[tott_idx].option_found,
-			  argv[i]) == 0)
-		{
-		  unsigned int spaces = 0;
-		  unsigned int m = 0;
-		  const char *sp;
-		  char *np;
-
-		  for (sp = target_option_translations[tott_idx].replacements;
-		       *sp; sp++)
-		    {
-		      if (*sp == ' ')
-			{
-			  spaces++;
-			  while (*sp == ' ')
-			    sp++;
-			  sp--;
-			}
-		    }
-
-		  if (spaces)
-		    {
-		      int new_argc = argc + spaces;
-		      if (argv_copied)
-			argv = XRESIZEVEC (const char *, argv, new_argc + 1);
-		      else
-			{
-			  const char **new_argv = XNEWVEC (const char *,
-							   new_argc + 1);
-			  memcpy (new_argv, argv,
-				  (argc + 1) * sizeof (const char *));
-			  argv = new_argv;
-			  argv_copied = true;
-			}
-		      memmove (&argv[i] + spaces, &argv[i],
-			       (argc + 1 - i) * sizeof (const char *));
-		      argc = new_argc;
-		      opt_array = XRESIZEVEC (struct cl_decoded_option,
-					      opt_array, argc);
-		    }
-
-		  sp = target_option_translations[tott_idx].replacements;
-		  np = xstrdup (sp);
-
-		  while (1)
-		    {
-		      while (*np == ' ')
-			np++;
-		      if (*np == 0)
-			break;
-		      argv[i + m++] = np;
-		      while (*np != ' ' && *np)
-			np++;
-		      if (*np == 0)
-			break;
-		      *np++ = 0;
-		    }
-
-		  target_translate_from = i + m;
-		  gcc_assert (m == spaces + 1);
-		  break;
-		}
-	    }
-#endif
-	}
-
       n = decode_cmdline_option (argv + i, lang_mask,
 				 &opt_array[num_decoded_options]);
       num_decoded_options++;
Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 166433)
+++ gcc/system.h	(working copy)
@@ -776,7 +776,8 @@ extern void fancy_abort (const char *, i
 	STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD		   \
 	ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE		   \
 	ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES  \
-	SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG
+	SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG \
+	TARGET_OPTION_TRANSLATE_TABLE
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
Index: gcc/config/mep/mep.opt
===================================================================
--- gcc/config/mep/mep.opt	(revision 166433)
+++ gcc/config/mep/mep.opt	(working copy)
@@ -83,6 +83,9 @@ mel
 Target Mask(LITTLE_ENDIAN) RejectNegative
 Use little-endian byte order
 
+mfar
+Driver RejectNegative
+
 mio-volatile
 Target Mask(IO_VOLATILE) 
 __io vars are volatile by default
Index: gcc/config/mep/mep.h
===================================================================
--- gcc/config/mep/mep.h	(revision 166433)
+++ gcc/config/mep/mep.h	(working copy)
@@ -132,17 +132,6 @@ crtbegin.o%s"
 
 #define TARGET_VERSION fprintf (stderr, " (Toshiba Media Processor (MeP))");
 
-/* The MeP config tool will add TARGET_OPTION_TRANSLATE_TABLE here.  */
-#define TARGET_OPTION_TRANSLATE_TABLE \
-  {"-mall-opts", "-maverage -mmult -mdiv -mbitops -mleadz \
-                  -mabsdiff -mminmax -mclip -msatur -mdebug" }, \
-  {"-mno-opts", "-mno-average -mno-mult -mno-div -mno-bitops -mno-leadz \
-                  -mno-absdiff -mno-minmax -mno-clip -mno-satur -mno-debug" }, \
-  {"-mfar", "-ml -mtf -mc=far" } \
-/* start-target-option-table */ \
-, {"-mconfig=default", "-mconfig=default -mmult -mdiv -D__MEP_CONFIG_ISA=1" } \
-/* end-target-option-table */
-
 /* The MeP config tool will replace this as appropriate.  */
 #define DEFAULT_ENDIAN_SPEC "%{!meb: -mel}"
 
@@ -152,7 +141,13 @@ crtbegin.o%s"
 /* Don't add an endian option when building the libraries.  */
 #define DRIVER_SELF_SPECS \
   "%{!mlibrary:" DEFAULT_ENDIAN_SPEC "}", \
-  "%{mlibrary: " LIBRARY_CONFIG_SPEC " %{!mel:-meb}}"
+  "%{mlibrary: " LIBRARY_CONFIG_SPEC " %{!mel:-meb}}", \
+  "%{mall-opts:-maverage -mmult -mdiv -mbitops -mleadz \
+     -mabsdiff -mminmax -mclip -msatur -mdebug} %<mall-opts", \
+  "%{mno-opts:-mno-average -mno-mult -mno-div -mno-bitops -mno-leadz \
+     -mno-absdiff -mno-minmax -mno-clip -mno-satur -mno-debug} %<mno-opts", \
+  "%{mfar:-ml -mtf -mc=far} %<mfar", \
+  "%{mconfig=default:-mmult -mdiv -D__MEP_CONFIG_ISA=1}"
 
 /* The MeP config tool will add COPROC_SELECTION_TABLE here.  */
 /* start-coproc-selection-table */
Index: gcc/config/darwin.opt
===================================================================
--- gcc/config/darwin.opt	(revision 166433)
+++ gcc/config/darwin.opt	(working copy)
@@ -18,10 +18,128 @@
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
+; Various linker options have a -Z added so that they can get to specs
+; processing without interference.  Note that an option name with a
+; prefix that matches another option name, that also takes an
+; argument, being mapped to a -Z linker option, needs to be modified
+; so the prefix is different, otherwise a '*' after the shorter option
+; will match with the longer one.
+
+all_load
+Driver Alias(Zall_load)
+
+allowable_client
+Driver Separate Alias(Zallowable_client)
+
+arch_errors_fatal
+Driver Alias(Zarch_errors_fatal)
+
+bind_at_load
+Driver Alias(Zbind_at_load)
+
+bundle
+Driver Alias(Zbundle)
+
+bundle_loader
+Driver Separate Alias(Zbundle_loader)
+
+dead_strip
+Driver Alias(Zdead_strip)
+
+dependency-file
+C ObjC C++ ObjC++ Separate Alias(MF) MissingArgError(missing filename after %qs)
+
+dylib_file
+Driver Separate Alias(Zdylib_file)
+
+dynamic
+Driver Alias(Zdynamic)
+
+dynamiclib
+Driver Alias(Zdynamiclib)
+
+exported_symbols_list
+Driver Separate Alias(Zexported_symbols_list)
+
+filelist
+Driver RejectNegative Separate
+
+findirect-virtual-calls
+Driver RejectNegative
+
+flat_namespace
+Driver RejectNegative Alias(Zflat_namespace)
+
+force_cpusubtype_ALL
+Driver RejectNegative Alias(Zforce_cpusubtype_ALL)
+
+force_flat_namespace
+Driver RejectNegative Alias(Zforce_flat_namespace)
+
+framework
+Driver RejectNegative Separate
+
+fterminated-vtables
+Driver RejectNegative
+
+gfull
+Driver
+
+gused
+Driver
+
+image_base
+Driver Separate Alias(Zimage_base)
+
+init
+Driver Separate Alias(Zinit)
+
+install_name
+Driver Separate Alias(Zinstall_name)
+
 mconstant-cfstrings
 Target Report Var(darwin_constant_cfstrings) Init(1)
 Generate compile-time CFString objects
 
+multi_module
+Driver RejectNegative Alias(Zmulti_module)
+
+multiply_defined
+Driver RejectNegative Separate Alias(Zmultiply_defined)
+
+multiply_defined_unused
+Driver RejectNegative Separate Alias(Zmultiplydefinedunused)
+
+no_dead_strip_inits_and_terms
+Driver Alias(Zno_dead_strip_inits_and_terms)
+
+seg_addr_table
+Driver Separate Alias(Zseg_addr_table)
+
+seg_addr_table_filename
+Driver Separate Alias(Zfn_seg_addr_table_filename)
+
+segaddr
+Driver Separate Args(2) Alias(Zsegaddr)
+
+segs_read_only_addr
+Driver Separate Alias(Zsegs_read_only_addr)
+
+segs_read_write_addr
+Driver Separate Alias(Zsegs_read_write_addr)
+
+single_module
+Driver Alias(Zsingle_module)
+
+umbrella
+Driver Separate Alias(Zumbrella)
+
+unexported_symbols_list
+Driver Separate Alias(Zunexported_symbols_list)
+
+weak_reference_mismatches
+Driver Separate Alias(Zweak_reference_mismatches)
+
 Wnonportable-cfstrings
 Target Report Var(darwin_warn_nonportable_cfstrings) Init(1) Warning
 Warn if constant CFString objects contain non-portable characters
@@ -63,21 +181,51 @@ iframework
 Target RejectNegative C ObjC C++ ObjC++ Joined Separate 
 -iframework <dir>	Add <dir> to the end of the system framework include path
 
+Zall_load
+Driver
+
 Zallowable_client
 Driver Separate
 
+Zarch_errors_fatal
+Driver
+
+Zbind_at_load
+Driver
+
+Zbundle
+Driver
+
 Zbundle_loader
 Driver Separate
 
+Zdead_strip
+Driver
+
 Zdylib_file
 Driver Separate
 
+Zdynamic
+Driver
+
+Zdynamiclib
+Driver
+
 Zexported_symbols_list
 Driver Separate
 
 Zfn_seg_addr_table_filename
 Driver Separate
 
+Zflat_namespace
+Driver
+
+Zforce_cpusubtype_ALL
+Driver
+
+Zforce_flat_namespace
+Driver
+
 Zimage_base
 Driver Separate
 
@@ -87,12 +235,18 @@ Driver Separate
 Zinstall_name
 Driver Separate
 
+Zmulti_module
+Driver
+
 Zmultiply_defined
 Driver Separate
 
 Zmultiplydefinedunused
 Driver Separate
 
+Zno_dead_strip_inits_and_terms
+Driver
+
 Zseg_addr_table
 Driver Separate
 
@@ -105,6 +259,9 @@ Driver Separate
 Zsegs_read_write_addr
 Driver Separate
 
+Zsingle_module
+Driver
+
 Zumbrella
 Driver Separate
 
Index: gcc/config/i386/darwin.h
===================================================================
--- gcc/config/i386/darwin.h	(revision 166433)
+++ gcc/config/i386/darwin.h	(working copy)
@@ -110,10 +110,12 @@ extern int darwin_emit_branch_islands;
 #define CC1_SPEC "%(cc1_cpu) \
   %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
   %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
-  %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}"
+  %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} " \
+  DARWIN_CC1_SPEC
 
 #undef ASM_SPEC
-#define ASM_SPEC "-arch %(darwin_arch) -force_cpusubtype_ALL"
+#define ASM_SPEC "-arch %(darwin_arch) -force_cpusubtype_ALL \
+  %{static}"
 
 #define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}"
 #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC
@@ -141,11 +143,6 @@ extern int darwin_emit_branch_islands;
   { "darwin_crt2", "" },                                        \
   { "darwin_subarch", DARWIN_SUBARCH_SPEC },
 
-/* Use the following macro for any Darwin/x86-specific command-line option
-   translation.  */
-#define SUBTARGET_OPTION_TRANSLATE_TABLE \
-  { "", "" }
-
 /* The Darwin assembler mostly follows AT&T syntax.  */
 #undef ASSEMBLER_DIALECT
 #define ASSEMBLER_DIALECT ASM_ATT
Index: gcc/config/rx/rx.h
===================================================================
--- gcc/config/rx/rx.h	(revision 166433)
+++ gcc/config/rx/rx.h	(working copy)
@@ -619,10 +619,6 @@ extern int rx_float_compare_mode;
 #define ARG_POINTER_CFA_OFFSET(FNDECL)		4
 #define FRAME_POINTER_CFA_OFFSET(FNDECL)	4
 
-/* Translate -nofpu into -mnofpu so that it gets passed from gcc to cc1.  */
-#define TARGET_OPTION_TRANSLATE_TABLE \
-  {"-nofpu", "-mnofpu" }
-
 #define TARGET_USE_FPU		(! TARGET_NO_USE_FPU)
 
 /* This macro is used to decide when RX FPU instructions can be used.  */
Index: gcc/config/rx/rx.opt
===================================================================
--- gcc/config/rx/rx.opt	(revision 166433)
+++ gcc/config/rx/rx.opt	(working copy)
@@ -30,11 +30,11 @@ Target RejectNegative InverseMask(64BIT_
 Stores doubles in 32 bits.  This is the default.
 
 nofpu
-Target RejectNegative Mask(NO_USE_FPU) Report
+Target RejectNegative Alias(mnofpu)
 Disable the use of RX FPU instructions.  
 
 mnofpu
-Target RejectNegative Mask(NO_USE_FPU) MaskExists Undocumented
+Target RejectNegative Mask(NO_USE_FPU) Report Undocumented
 
 fpu
 Target RejectNegative InverseMask(NO_USE_FPU) Report
Index: gcc/config/rs6000/darwin.opt
===================================================================
--- gcc/config/rs6000/darwin.opt	(revision 166433)
+++ gcc/config/rs6000/darwin.opt	(working copy)
@@ -19,6 +19,20 @@
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
+Waltivec-long-deprecated
+Driver Alias(mwarn-altivec-long)
+
+faltivec
+Driver
+
+; -ffix-and-continue and -findirect-data are for compatibility for old
+; compilers.
+ffix-and-continue
+Driver RejectNegative Alias(mfix-and-continue)
+
+findirect-data
+Driver RejectNegative Alias(mfix-and-continue)
+
 m64
 Target RejectNegative Negative(m32) Mask(64BIT)
 Generate 64-bit code
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h	(revision 166433)
+++ gcc/config/rs6000/darwin.h	(working copy)
@@ -90,14 +90,18 @@ extern int darwin_emit_branch_islands;
 
 
 /* We want -fPIC by default, unless we're using -static to compile for
-   the kernel or some such.  */
+   the kernel or some such.  The "-faltivec" option should have been
+   called "-maltivec" all along.  */
 
 #define CC1_SPEC "\
   %(cc1_cpu) \
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
   %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
   %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
-  %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}}"
+  %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
+  %{faltivec:-maltivec -include altivec.h} %{fno-altivec:-mno-altivec} \
+  %<faltivec %<fno-altivec " \
+  DARWIN_CC1_SPEC
 
 #define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}"
 
@@ -146,18 +150,6 @@ extern int darwin_emit_branch_islands;
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START rs6000_darwin_file_start
 
-/* The "-faltivec" option should have been called "-maltivec" all
-   along.  -ffix-and-continue and -findirect-data is for compatibility
-   for old compilers.  */
-
-#define SUBTARGET_OPTION_TRANSLATE_TABLE				\
-  { "-ffix-and-continue", "-mfix-and-continue" },			\
-  { "-findirect-data", "-mfix-and-continue" },				\
-  { "-faltivec", "-maltivec -include altivec.h" },			\
-  { "-fno-altivec", "-mno-altivec" },					\
-  { "-Waltivec-long-deprecated",	"-mwarn-altivec-long" },	\
-  { "-Wno-altivec-long-deprecated", "-mno-warn-altivec-long" }
-
 /* Make both r2 and r13 available for allocation.  */
 #define FIXED_R2 0
 #define FIXED_R13 0
Index: gcc/config/picochip/picochip.h
===================================================================
--- gcc/config/picochip/picochip.h	(revision 166433)
+++ gcc/config/picochip/picochip.h	(working copy)
@@ -60,19 +60,19 @@ extern enum picochip_dfa_type picochip_s
 
 /* Translate requests for particular AEs into their respective ISA
    options. Note that byte access is enabled by default. */
-#define TARGET_OPTION_TRANSLATE_TABLE			      \
-  { "-mae=ANY",   "-mmul-type=none -mno-byte-access" },	      \
-  { "-mae=ANY2",  "-mmul-type=none -mno-byte-access" },	      \
-  { "-mae=ANY3",  "-mmul-type=none" },			      \
-  { "-mae=STAN",  "-mmul-type=none -mno-byte-access" },	      \
-  { "-mae=STAN2", "-mmul-type=mac -mno-byte-access" },	      \
-  { "-mae=STAN3", "-mmul-type=mac " },			      \
-  { "-mae=MAC",   "-mmul-type=mac -mno-byte-access" },	      \
-  { "-mae=MUL",   "-mmul-type=mul" },			      \
-  { "-mae=MEM",   "-mmul-type=mul" },			      \
-  { "-mae=MEM2",  "-mmul-type=mul" },			      \
-  { "-mae=CTRL",  "-mmul-type=mul" },			      \
-  { "-mae=CTRL2", "-mmul-type=mul" }
+#define DRIVER_SELF_SPECS					\
+  "%{mae=ANY:-mmul-type=none -mno-byte-access} %<mae=ANY",	\
+  "%{mae=ANY2:-mmul-type=none -mno-byte-access} %<mae=ANY2",	\
+  "%{mae=ANY3:-mmul-type=none} %<mae=ANY3",			\
+  "%{mae=STAN:-mmul-type=none -mno-byte-access} %<mae=STAN",	\
+  "%{mae=STAN2:-mmul-type=mac -mno-byte-access} %<mae=STAN2",	\
+  "%{mae=STAN3:-mmul-type=mac} %<mae=STAN3",			\
+  "%{mae=MAC:-mmul-type=mac -mno-byte-access} %<mae=MAC",	\
+  "%{mae=MUL:-mmul-type=mul} %<mae=MUL",			\
+  "%{mae=MEM:-mmul-type=mul} %<mae=MEM",			\
+  "%{mae=MEM2:-mmul-type=mul} %<mae=MEM2",			\
+  "%{mae=CTRL:-mmul-type=mul} %<mae=CTRL",			\
+  "%{mae=CTRL2:-mmul-type=mul} %<mae=CTRL2"
 
 /* Specify the default options, so that the multilib build doesn't
    need to provide special cases for the defaults. */
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 166433)
+++ gcc/config/darwin.h	(working copy)
@@ -123,71 +123,16 @@ see the files COPYING3 and COPYING.RUNTI
 /* True if pragma ms_struct is in effect.  */
 extern GTY(()) int darwin_ms_struct;
 
-/* This table intercepts weirdo options whose names would interfere
-   with normal driver conventions, and either translates them into
-   standardly-named options, or adds a 'Z' so that they can get to
-   specs processing without interference.
-
-   Do not expand a linker option to "-Xlinker -<option>", since that
-   forfeits the ability to control via spec strings later.  However,
-   as a special exception, do this translation with -filelist, because
-   otherwise the driver will think there are no input files and quit.
-   (The alternative would be to hack the driver to recognize -filelist
-   specially, but it's simpler to use the translation table.)
-
-   Note that an option name with a prefix that matches another option
-   name, that also takes an argument, needs to be modified so the
-   prefix is different, otherwise a '*' after the shorter option will
-   match with the longer one.
-
-   The SUBTARGET_OPTION_TRANSLATE_TABLE macro, which _must_ be defined
-   in gcc/config/{i386,rs6000}/darwin.h, should contain any additional
-   command-line option translations specific to the particular target
-   architecture.  */
-
-#define TARGET_OPTION_TRANSLATE_TABLE \
-  { "-all_load", "-Zall_load" },  \
-  { "-allowable_client", "-Zallowable_client" },  \
-  { "-arch_errors_fatal", "-Zarch_errors_fatal" },  \
-  { "-bind_at_load", "-Zbind_at_load" },  \
-  { "-bundle", "-Zbundle" },  \
-  { "-bundle_loader", "-Zbundle_loader" },  \
-  { "-weak_reference_mismatches", "-Zweak_reference_mismatches" },  \
-  { "-dead_strip", "-Zdead_strip" }, \
-  { "-no_dead_strip_inits_and_terms", "-Zno_dead_strip_inits_and_terms" }, \
-  { "-dependency-file", "-MF" }, \
-  { "-dylib_file", "-Zdylib_file" }, \
-  { "-dynamic", "-Zdynamic" },  \
-  { "-dynamiclib", "-Zdynamiclib" },  \
-  { "-exported_symbols_list", "-Zexported_symbols_list" },  \
-  { "-gfull", "-g -fno-eliminate-unused-debug-symbols" }, \
-  { "-gused", "-g -feliminate-unused-debug-symbols" }, \
-  { "-segaddr", "-Zsegaddr" }, \
-  { "-segs_read_only_addr", "-Zsegs_read_only_addr" }, \
-  { "-segs_read_write_addr", "-Zsegs_read_write_addr" }, \
-  { "-seg_addr_table", "-Zseg_addr_table" }, \
-  { "-seg_addr_table_filename", "-Zfn_seg_addr_table_filename" }, \
-  { "-umbrella", "-Zumbrella" }, \
-  { "-fapple-kext", "-fapple-kext -static -Wa,-static" }, \
-  { "-filelist", "-Xlinker -filelist -Xlinker" },  \
-  { "-findirect-virtual-calls", "-fapple-kext" }, \
-  { "-flat_namespace", "-Zflat_namespace" },  \
-  { "-force_cpusubtype_ALL", "-Zforce_cpusubtype_ALL" },  \
-  { "-force_flat_namespace", "-Zforce_flat_namespace" },  \
-  { "-framework", "-Xlinker -framework -Xlinker" },  \
-  { "-fterminated-vtables", "-fapple-kext" }, \
-  { "-image_base", "-Zimage_base" },  \
-  { "-init", "-Zinit" },  \
-  { "-install_name", "-Zinstall_name" },  \
-  { "-mkernel", "-mkernel -static -Wa,-static" }, \
-  { "-multiply_defined_unused", "-Zmultiplydefinedunused" },  \
-  { "-multiply_defined", "-Zmultiply_defined" },  \
-  { "-multi_module", "-Zmulti_module" },  \
-  { "-static", "-static -Wa,-static" },  \
-  { "-shared", "-Zdynamiclib" }, \
-  { "-single_module", "-Zsingle_module" },  \
-  { "-unexported_symbols_list", "-Zunexported_symbols_list" }, \
-  SUBTARGET_OPTION_TRANSLATE_TABLE
+#define DRIVER_SELF_SPECS					\
+  "%{gfull:-g -fno-eliminate-unused-debug-symbols} %<gfull",	\
+  "%{gused:-g -feliminate-unused-debug-symbols} %<gused",	\
+  "%{fapple-kext|mkernel:-static}",				\
+  "%{shared:-Zdynamiclib} %<shared"
+
+#define DARWIN_CC1_SPEC							\
+  "%{findirect-virtual-calls: -fapple-kext} %<findirect-virtual-calls " \
+  "%{fterminated-vtables: -fapple-kext} %<fterminated-vtables "		\
+  "%<filelist* %<framework*"
 
 #define SUBSUBTARGET_OVERRIDE_OPTIONS					\
   do {									\
@@ -416,7 +361,8 @@ extern GTY(()) int darwin_ms_struct;
 
 /* Default Darwin ASM_SPEC, very simple.  */
 #define ASM_SPEC "-arch %(darwin_arch) \
-  %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL}"
+  %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
+  %{static}"
 
 /* We still allow output of STABS.  */
 
@@ -1037,12 +983,10 @@ __enable_execute_stack (void *addr)     
 
 #define TARGET_HAS_TARGETCM 1
 
-#ifndef CROSS_DIRECTORY_STRUCTURE
-extern void darwin_default_min_version (unsigned int *decoded_options_count,
-					struct cl_decoded_option **decoded_options);
+extern void darwin_driver_init (unsigned int *decoded_options_count,
+				struct cl_decoded_option **decoded_options);
 #define GCC_DRIVER_HOST_INITIALIZATION \
-  darwin_default_min_version (&decoded_options_count, &decoded_options)
-#endif /* CROSS_DIRECTORY_STRUCTURE */
+  darwin_driver_init (&decoded_options_count, &decoded_options)
 
 /* The Apple assembler and linker do not support constructor priorities.  */
 #undef SUPPORTS_INIT_PRIORITY
Index: gcc/config/darwin-driver.c
===================================================================
--- gcc/config/darwin-driver.c	(revision 166433)
+++ gcc/config/darwin-driver.c	(working copy)
@@ -18,13 +18,14 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#ifndef CROSS_DIRECTORY_STRUCTURE
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "gcc.h"
 #include "opts.h"
+
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #include <sys/sysctl.h>
 #include "xregex.h"
 
@@ -32,7 +33,7 @@ along with GCC; see the file COPYING3.  
    libraries, default the -mmacosx-version-min flag to be the version
    of the system on which the compiler is running.  */
 
-void
+static void
 darwin_default_min_version (unsigned int *decoded_options_count,
 			    struct cl_decoded_option **decoded_options)
 {
@@ -138,3 +139,51 @@ darwin_default_min_version (unsigned int
 }
 
 #endif /* CROSS_DIRECTORY_STRUCTURE */
+
+/* Translate -filelist and -framework options in *DECODED_OPTIONS
+   (size *DECODED_OPTIONS_COUNT) to use -Xlinker so that they are
+   considered to be linker inputs in the case that no other inputs are
+   specified.  Handling these options in DRIVER_SELF_SPECS does not
+   suffice because specs are too late to add linker inputs, and
+   handling them in LINK_SPEC does not suffice because the linker will
+   not be called if there are no other inputs.  When native, also
+   default the -mmacosx-version-min flag.  */
+
+void
+darwin_driver_init (unsigned int *decoded_options_count,
+		    struct cl_decoded_option **decoded_options)
+{
+  unsigned int i;
+
+  for (i = 1; i < *decoded_options_count; i++)
+    {
+      if ((*decoded_options)[i].errors & CL_ERR_MISSING_ARG)
+	continue;
+      switch ((*decoded_options)[i].opt_index)
+	{
+	case OPT_filelist:
+	case OPT_framework:
+	  ++*decoded_options_count;
+	  *decoded_options = XRESIZEVEC (struct cl_decoded_option,
+					 *decoded_options,
+					 *decoded_options_count);
+	  memmove (*decoded_options + i + 2,
+		   *decoded_options + i + 1,
+		   ((*decoded_options_count - i - 2)
+		    * sizeof (struct cl_decoded_option)));
+	  generate_option (OPT_Xlinker, (*decoded_options)[i].arg, 1,
+			   CL_DRIVER, &(*decoded_options)[i + 1]);
+	  generate_option (OPT_Xlinker,
+			   (*decoded_options)[i].canonical_option[0], 1,
+			   CL_DRIVER, &(*decoded_options)[i]);
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+#ifndef CROSS_DIRECTORY_STRUCTURE
+  darwin_default_min_version (decoded_options_count, decoded_options);
+#endif
+}

-- 
Joseph S. Myers
joseph@codesourcery.com


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