Hi!

We ICE with -Wp,-pie, as -pie (and -shared/--pie/--shared) are marked as
Common options, but aren't handled in the cc1/cc1plus/etc. options handling.

Fixed by making those options Driver specific, and for the time being add
their help strings to display_help.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Alternatively there is a second (untested) patch.

2012-01-17  Jakub Jelinek  <ja...@redhat.com>

        PR driver/47249
        * common.opt (-pie, -shared, pie, shared): Change from Common to
        Driver.
        * gcc.c (display_help): Display help for -pie and -shared.

--- gcc/common.opt.jj   2012-01-13 21:47:35.000000000 +0100
+++ gcc/common.opt      2012-01-16 13:44:44.905958270 +0100
@@ -1,6 +1,6 @@
 ; Options for the language- and target-independent parts of the compiler.
 
-; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
 ; Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
@@ -313,7 +313,7 @@ Common Alias(pedantic)
 Common Alias(pedantic-errors)
 
 -pie
-Common Alias(pie)
+Driver Alias(pie)
 
 -pipe
 Driver Alias(pipe)
@@ -367,7 +367,7 @@ Common Alias(p)
 Driver Alias(save-temps)
 
 -shared
-Common Alias(shared)
+Driver Alias(shared)
 
 -specs
 Driver Separate Alias(specs=)
@@ -2380,7 +2380,7 @@ x
 Driver Joined Separate
 
 shared
-Common RejectNegative Negative(pie)
+Driver RejectNegative Negative(pie)
 Create a shared library
 
 shared-libgcc
@@ -2413,7 +2413,7 @@ symbolic
 Driver
 
 pie
-Common RejectNegative Negative(shared)
+Driver RejectNegative Negative(shared)
 Create a position independent executable
 
 z
--- gcc/gcc.c.jj        2012-01-01 19:59:36.000000000 +0100
+++ gcc/gcc.c   2012-01-16 14:12:39.761217387 +0100
@@ -2988,6 +2988,8 @@ display_help (void)
   fputs (_("  -S                       Compile only; do not assemble or 
link\n"), stdout);
   fputs (_("  -c                       Compile and assemble, but do not 
link\n"), stdout);
   fputs (_("  -o <file>                Place the output into <file>\n"), 
stdout);
+  fputs (_("  -pie                     Create a position independent 
executable\n"), stdout);
+  fputs (_("  -shared                  Create a shared library\n"), stdout);
   fputs (_("\
   -x <language>            Specify the language of the following input files\n\
                            Permissible languages include: c c++ assembler 
none\n\

        Jakub
2012-01-17  Jakub Jelinek  <ja...@redhat.com>

        PR driver/47249
        * opts.c (common_handle_option): Reject OPT_pie and OPT_shared.

--- gcc/opts.c.jj       2012-01-13 21:47:35.000000000 +0100
+++ gcc/opts.c  2012-01-16 14:46:22.126400331 +0100
@@ -1744,6 +1744,12 @@ common_handle_option (struct gcc_options
       opts->x_warn_maybe_uninitialized = value;
       break;
 
+    case OPT_pie:
+    case OPT_shared:
+      error ("command line option %qs is valid only for the driver",
+            decoded->orig_option_with_args_text);
+      break;
+
     default:
       /* If the flag was handled in a standard way, assume the lack of
         processing here is intentional.  */

Reply via email to