re PR driver/31107 (--target-help doesn't say which options are compiler, assembler...
authorRichard Sandiford <richard@codesourcery.com>
Thu, 26 Apr 2007 07:15:41 +0000 (07:15 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 26 Apr 2007 07:15:41 +0000 (07:15 +0000)
gcc/
PR driver/31107
* doc/invoke.texi (%:print-asm-header): Document.
* gcc.c (asm_options): Use %:print-asm-header() for --target-help
and -ftarget-help.
(static_spec_functions): Add print-asm-header.
(main): Print a banner before the --target-help linker options.
(print_asm_header_spec_function): New function.

From-SVN: r124175

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/gcc.c

index 6ccb3e3db318837d61d84d2f32affc526c859579..5dec3751ec024f739436e7b2b2a84245a4b5b364 100644 (file)
@@ -1,3 +1,13 @@
+2007-04-26  Richard Sandiford  <richard@codesourcery.com>
+
+       PR driver/31107
+       * doc/invoke.texi (%:print-asm-header): Document.
+       * gcc.c (asm_options): Use %:print-asm-header() for --target-help
+       and -ftarget-help.
+       (static_spec_functions): Add print-asm-header.
+       (main): Print a banner before the --target-help linker options.
+       (print_asm_header_spec_function): New function.
+
 2007-04-25  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/31403
index fb9607605621f086f51cdb739d2719319d614bae..cc5feb9c8fbbd4efa989649005e840a8d874a35b 100644 (file)
@@ -7663,6 +7663,19 @@ is a small example of its usage:
 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
 @end smallexample
 
+@item @code{print-asm-header}
+The @code{print-asm-header} function takes no arguments and simply
+prints a banner like:
+
+@smallexample
+Assember options
+================
+
+Use "-Wa,OPTION" to pass "OPTION" to the assembler.
+@end smallexample
+
+It is used to separate compiler options from assembler options
+in the @option{--target-help} output.
 @end table
 
 @item %@{@code{S}@}
index 3d826d94d680f3af02896481dd77ea6b251e2f22..10468026939eb995fbd969cd022d60d62269ed65 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -361,6 +361,7 @@ static const char *if_exists_else_spec_function (int, const char **);
 static const char *replace_outfile_spec_function (int, const char **);
 static const char *version_compare_spec_function (int, const char **);
 static const char *include_spec_function (int, const char **);
+static const char *print_asm_header_spec_function (int, const char **);
 \f
 /* The Specs Language
 
@@ -821,7 +822,8 @@ static const char *cc1_options =
  %{coverage:-fprofile-arcs -ftest-coverage}";
 
 static const char *asm_options =
-"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
+"%{ftarget-help:%:print-asm-header()} \
+%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
 
 static const char *invoke_as =
 #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT
@@ -1617,6 +1619,7 @@ static const struct spec_function static_spec_functions[] =
   { "replace-outfile",         replace_outfile_spec_function },
   { "version-compare",         version_compare_spec_function },
   { "include",                 include_spec_function },
+  { "print-asm-header",                print_asm_header_spec_function },
 #ifdef EXTRA_SPEC_FUNCTIONS
   EXTRA_SPEC_FUNCTIONS
 #endif
@@ -6708,6 +6711,13 @@ main (int argc, char **argv)
       putenv_from_prefixes (&exec_prefixes, "COMPILER_PATH", false);
       putenv_from_prefixes (&startfile_prefixes, LIBRARY_PATH_ENV, true);
 
+      if (print_subprocess_help == 1)
+       {
+         printf (_("\nLinker options\n==============\n\n"));
+         printf (_("Use \"-Wl,OPTION\" to pass \"OPTION\""
+                   " to the linker.\n\n"));
+         fflush (stdout);
+       }
       value = do_spec (link_command_spec);
       if (value < 0)
        error_count = 1;
@@ -7883,3 +7893,16 @@ include_spec_function (int argc, const char **argv)
 
   return NULL;
 }
+
+/* %:print-asm-header spec function.  Print a banner to say that the
+   following output is from the assembler.  */
+
+static const char *
+print_asm_header_spec_function (int arg ATTRIBUTE_UNUSED,
+                               const char **argv ATTRIBUTE_UNUSED)
+{
+  printf (_("Assember options\n================\n\n"));
+  printf (_("Use \"-Wa,OPTION\" to pass \"OPTION\" to the assembler.\n\n"));
+  fflush (stdout);
+  return NULL;
+}