This patch, for 4.7 and relative to a tree with
<http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01709.html> applied,
stops the pdp11 handle_option hook from using global state.

Tested building cc1 and xgcc for cross to pdp11-none.  Will commit to
trunk for 4.7 in the absence of target maintainer objections.

2011-03-06  Joseph Myers  <jos...@codesourcery.com>

        * config/pdp11/pdp11.c (pdp11_handle_option): Access target_flags
        via opts pointer.  Don't assert that global structures are in use.

diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/pdp11/pdp11.c 
gcc-mainline/gcc/config/pdp11/pdp11.c
--- gcc-mainline-1/gcc/config/pdp11/pdp11.c     2011-02-24 08:08:11.000000000 
-0800
+++ gcc-mainline/gcc/config/pdp11/pdp11.c       2011-03-06 17:07:03.000000000 
-0800
@@ -247,19 +247,17 @@ static const struct default_options pdp1
 /* Implement TARGET_HANDLE_OPTION.  */
 
 static bool
-pdp11_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+pdp11_handle_option (struct gcc_options *opts,
+                    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
                     const struct cl_decoded_option *decoded,
                     location_t loc ATTRIBUTE_UNUSED)
 {
   size_t code = decoded->opt_index;
 
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set == &global_options_set);
-
   switch (code)
     {
     case OPT_m10:
-      target_flags &= ~(MASK_40 | MASK_45);
+      opts->x_target_flags &= ~(MASK_40 | MASK_45);
       return true;
 
     default:

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to