dpatel      03/02/03 19:13:05

  Modified:    live/gcc3/gcc ChangeLog c-common.c c-common.h c-decl.c
                        c-lex.c c-objc-common.c c-opts.c c-pch.c cppfiles.c
                        cpphash.h cpplib.c cpplib.h cpppch.c dbxout.c
                        debug.h flags.h gcc.c stringpool.c toplev.c tree.c
               live/gcc3/gcc/config darwin.h
               live/gcc3/gcc/cp lang-specs.h
  Log:
  + 2003-01-28  Devang Patel  <[EMAIL PROTECTED]>
  +
  +       * c-common.h (dbg_dir): extern for new global variable.
  +       (cinfo_file_name): extern for new global variable.
  +       (dbg_ss_init): extern for new function.
  +       (c_common_write_context): same.
  +       (cb_clear_write_symbols): same.
  +       (cb_restore_write_symbols): same.
  +       (cb_start_symbol_repository): same.
  +       (cb_end_symbol_repository): same.
  +       (c_valid_cinfo): same.
  +       (cb_is_builtin_identifier): same.
  +       * cpphash.h (cpp_cinfo_state): New enum.
  +       (cpp_reader): New fields 'found_cinfo' and 'cinfo_state'.
  +       (suppress_dbg_info): New extern for function suppress_dbg_info.
  +       * cpplib.h (cpp_options): New field 'warn_invalid_sr'.
  +       (cpp_callbacks): New fields. 'restore_write_symbols', 'clear_write_symbols',
  +       'start_symbol_repository', 'end_symbol_repository' and 
'is_builtin_identifier'.
  +       (cpp_stab_checksum): New struct.
  +       (cpp_write_stabs_checksum): New function prototype.
  +       (cpp_read_stabs_checksum): same.
  +       (cpp_get_stabs_checksum): same.
  +       * debug.h (gcc_debug_hooks): New fields. 'restore_write_symbols', 
'clear_write_symbols',
  +       'start_symbol_repository' and 'end_symbol_repository'.
  +       * flags.h: New flags 'orig_write_symbols' and 'flag_guniq'.
  +       * c-common.c (dbg_dir): New global variable.
  +       (cinfo_file_name): same.
  +       (cb_restore_write_symbols): New function.
  +       (cb_clear_write_symbols): same.
  +       (cb_start_symbol_repository): same.
  +       (cb_end_symbol_repository): same.
  +       * c-lex.c (init_c_lex): Set call back functions for separate symbol 
repositories.
  +       (c_common_parse_file): Initialize symbol separation.
  +       (cinfo_file): New variable.
  +       (context_ident): New variable.
  +       (dbg_ss_init): New function.
  +       (c_common_write_context): New function.
  +       * c-objc-common.c (c_objc_common_finish_file): Write context information.
  +       * c-opts.c (COMMAND_LINE_OPTIONS):  New options '-Winvalid_sr' and 
'-foutput-dbg'.
  +       (missing_arg) : Add missing argument check for OPT__output_dbg.
  +       (c_common_decode_option): Handle OPT__output_dbg and OPT_Winvalid_sr.
  +       * cppfiles.c (struct include_file): New filed 'suppress_dbg'.
  +       (stack_include_file): Clear write_symbols if found_cinfo flag is set.
  +       (find_include_file): Set found_cinfo flag if valid context info found.
  +       Search for .cinfo in hashtable before searching actual .h file.
  +       (find_framework_file): Set found_cinfo flag if valid context info found.
  +       (find_subframework_file): Set found_cinfo flag if valid context info found.
  +       (_cpp_execute_include): Clear found_cinfo flag.
  +       (c_valid_cinfo): New function.
  +       (suppress_dbg_info): New function.
  +       * cpplib.c (_cpp_pop_buffer): Restore debugging info generation state.
  +       * cpppch.c (count_defs): Do not count builtin idenfitiers when cinfo_state 
is CINFO_WRITE.
  +       (write_defs): Do not write builtin identifiers when cinfo_state is 
CINFO_WRITE.
  +       (stabs_checksum): New static variable.
  +       (cpp_write_stabs_checksum): New function.
  +       (cpp_read_stabs_checksum): New function.
  +       (cpp_get_stabs_checksum): New function.
  +       (cpp_calculate_stabs_checksum): New function.
  +       * dbxout.c (dbxout_restore_write_symbols): New function.
  +       (dbxout_clear_write_symbols): New function.
  +       (dbxout_start_symbol_repository): New function.
  +       (dbxout_end_symbol_repository): New function.
  +       (dbx_debug_hooks): New fields 'dbxout_restore_write_symbols', 
'dbxout_clear_write_symbols',
  +       'dbxout_start_symbol_repository', 'dbxout_end_symbol_repository'.
  +       (xcoff_debug_hooks): New slots.
  +       (dbxout_start_source_file): Do not emit BINCL stab if debug info generation 
is disabled
  +       for now.
  +       (dbxout_end_source_file): Same.
  +       * toplev.c (orig_write_symbols): New.
  +       (flag_guniq): New.
  +       (documented_lang_options): New option "-Winvalid-sr".
  +       (decode_g_options): Decode -guniq. Save write_symbols value in 
orig_write_symbols.
  +       (finalize): Emit EINCL stab for main input file.  */
  
  Reviewed by: Mike Stump
  
  Revision  Changes    Path
  1.28      +74 -0     src/live/gcc3/gcc/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/ChangeLog,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ChangeLog 2003/01/30 00:31:23     1.27
  +++ ChangeLog 2003/02/04 03:12:55     1.28
  @@ -1,3 +1,77 @@
  +2003-02-03  Devang Patel  <[EMAIL PROTECTED]>
  +
  +     * c-common.h (dbg_dir): extern for new global variable.
  +     (cinfo_file_name): extern for new global variable.
  +     (dbg_ss_init): extern for new function.
  +     (c_common_write_context): same.
  +     (cb_clear_write_symbols): same.
  +     (cb_restore_write_symbols): same.
  +     (cb_start_symbol_repository): same.
  +     (cb_end_symbol_repository): same.
  +     (c_valid_cinfo): same.
  +     (cb_is_builtin_identifier): same.
  +     * cpphash.h (cpp_cinfo_state): New enum.
  +     (cpp_reader): New fields 'found_cinfo' and 'cinfo_state'.
  +     (suppress_dbg_info): New extern for function suppress_dbg_info.
  +     * cpplib.h (cpp_options): New field 'warn_invalid_sr'.
  +     (cpp_callbacks): New fields. 'restore_write_symbols', 'clear_write_symbols',
  +     'start_symbol_repository', 'end_symbol_repository' and 'is_builtin_identifier'.
  +     (cpp_stab_checksum): New struct.
  +     (cpp_write_stabs_checksum): New function prototype.
  +     (cpp_read_stabs_checksum): same.
  +     (cpp_get_stabs_checksum): same.
  +     * debug.h (gcc_debug_hooks): New fields. 'restore_write_symbols', 
'clear_write_symbols',
  +     'start_symbol_repository' and 'end_symbol_repository'.
  +     * flags.h: New flags 'orig_write_symbols' and 'flag_guniq'.
  +     * c-common.c (dbg_dir): New global variable.
  +     (cinfo_file_name): same.
  +     (cb_restore_write_symbols): New function.
  +     (cb_clear_write_symbols): same.
  +     (cb_start_symbol_repository): same.
  +     (cb_end_symbol_repository): same.
  +     * c-lex.c (init_c_lex): Set call back functions for separate symbol 
repositories.
  +     (c_common_parse_file): Initialize symbol separation.
  +     (cinfo_file): New variable.
  +     (context_ident): New variable.
  +     (dbg_ss_init): New function.
  +     (c_common_write_context): New function.
  +     * c-objc-common.c (c_objc_common_finish_file): Write context information.
  +     * c-opts.c (COMMAND_LINE_OPTIONS):  New options '-Winvalid_sr' and 
'-foutput-dbg'.
  +     (missing_arg) : Add missing argument check for OPT__output_dbg.
  +     (c_common_decode_option): Handle OPT__output_dbg and OPT_Winvalid_sr.
  +     * cppfiles.c (struct include_file): New filed 'suppress_dbg'.
  +     (stack_include_file): Clear write_symbols if found_cinfo flag is set.
  +     (find_include_file): Set found_cinfo flag if valid context info found.
  +     Search for .cinfo in hashtable before searching actual .h file.
  +     (find_framework_file): Set found_cinfo flag if valid context info found.
  +     (find_subframework_file): Set found_cinfo flag if valid context info found.
  +     (_cpp_execute_include): Clear found_cinfo flag.
  +     (c_valid_cinfo): New function.
  +     (suppress_dbg_info): New function.
  +     * cpplib.c (_cpp_pop_buffer): Restore debugging info generation state.
  +     * cpppch.c (count_defs): Do not count builtin idenfitiers when cinfo_state is 
CINFO_WRITE.
  +     (write_defs): Do not write builtin identifiers when cinfo_state is CINFO_WRITE.
  +     (stabs_checksum): New static variable.
  +     (cpp_write_stabs_checksum): New function.
  +     (cpp_read_stabs_checksum): New function.
  +     (cpp_get_stabs_checksum): New function.
  +     (cpp_calculate_stabs_checksum): New function.
  +     * dbxout.c (dbxout_restore_write_symbols): New function.
  +     (dbxout_clear_write_symbols): New function.
  +     (dbxout_start_symbol_repository): New function.
  +     (dbxout_end_symbol_repository): New function.
  +     (dbx_debug_hooks): New fields 'dbxout_restore_write_symbols', 
'dbxout_clear_write_symbols',
  +     'dbxout_start_symbol_repository', 'dbxout_end_symbol_repository'.
  +     (xcoff_debug_hooks): New slots.
  +     (dbxout_start_source_file): Do not emit BINCL stab if debug info generation is 
disabled 
  +     for now.
  +     (dbxout_end_source_file): Same.
  +     * toplev.c (orig_write_symbols): New.
  +     (flag_guniq): New.
  +     (documented_lang_options): New option "-Winvalid-sr".
  +     (decode_g_options): Decode -guniq. Save write_symbols value in 
orig_write_symbols.
  +     (finalize): Emit EINCL stab for main input file.  */
  +     
   2003-01-23  Mike Stump  <[EMAIL PROTECTED]>
   
        * regclass.c (init_reg_autoinc): New function.
  
  
  
  1.87      +67 -1     src/live/gcc3/gcc/c-common.c
  
  Index: c-common.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-common.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- c-common.c        2003/01/22 06:02:34     1.86
  +++ c-common.c        2003/02/04 03:12:56     1.87
  @@ -37,6 +37,7 @@
   #include "obstack.h"
   #include "cpplib.h"
   #include "target.h"
  +#include "debug.h"
   #include "langhooks.h"
   #include "except.h"          /* For USING_SJLJ_EXCEPTIONS.  */
   #include "tree-inline.h"
  @@ -227,6 +228,15 @@
   
   const char *pch_file;
   
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Directory name where separate debug repository and context
  +   available. NULL if Symbol Separation is not used.  */
  +const char *dbg_dir;
  +
  +/* Context information file name */
  +char *cinfo_file_name;
  +/* APPLE LOCAL end Symbol Separation */
  +
   /* Nonzero if an ISO standard was selected.  It rejects macros in the
      user's namespace.  */
   int flag_iso;
  @@ -7146,8 +7156,64 @@
                                            (build_unary_op (ADDR_EXPR, constructor, 
1)));
   }     
   /* APPLE LOCAL end constant cfstrings */
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Call debugger hooks to restore state of debugging symbol generation.
  +   This is called at the end of header processing whose symbol repository was
  +   available and valid.  */
  +void
  +cb_restore_write_symbols ()
  +{
  +  (*debug_hooks->restore_write_symbols) ();
  +}
  +
  +/* Call debugger hooks to clear state of debugging symbol generation.
  +   This is called to stop generation of debugging info. for a header whose
  +   valid context information is available.  */
  +void
  +cb_clear_write_symbols (filename, checksum)
  +     const char *filename;
  +     unsigned long checksum;
  +{
  +  (*debug_hooks->clear_write_symbols) (filename, checksum);
  +}
  +
  +/* Call debugger hooks to mark start of symbol repository.
  +   Similar to start_source_file. Only difference is that checksum is added 
  +   with BINCL stabs.  */
  +void
  +cb_start_symbol_repository (lineno, filename, checksum)
  +     unsigned int lineno;
  +     const char *filename;
  +     unsigned long checksum;
  +{
  +  (*debug_hooks->start_symbol_repository) (lineno, filename, checksum);
  +}
  +
  +/* Call debugger hoooks to makr end of symbol repository.
  +   Identical to end_source_file.  */
  +void
  +cb_end_symbol_repository (lineno)
  +     unsigned int lineno;
  +{
  +  (*debug_hooks->end_symbol_repository) (lineno);
  +}
  +
  +/* Decide if hashnode points to a tree used for builtin identifier.
  +   This is used during context info writing to avoid collecting information
  +   about builtins in cinfo files.  */
  +int
  +cb_is_builtin_identifier (p)
  +     hashnode *p;
  +{
  +  if (DECL_BUILT_IN_CLASS (HT_IDENT_TO_GCC_IDENT (p)))
  +    return 1;
  +  else
  +    return 0;
  +}
  +/* APPLE LOCAL end Symbol Separation */
   
  -/* APPLE LOCAL begin PFE */
  +/* APPLE LOCAL begin PFE*/
   /* Replaces c_common_nodes_and_builtin() when doing a pfe load operation.  */
   void
   pfe_c_common_nodes_and_builtins ()
  
  
  
  1.61      +23 -0     src/live/gcc3/gcc/c-common.h
  
  Index: c-common.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-common.h,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- c-common.h        2002/12/18 00:31:49     1.60
  +++ c-common.h        2003/02/04 03:12:56     1.61
  @@ -407,6 +407,15 @@
   
   extern const char *pch_file;
   
  +/* APPLE LOCAL begin Symbol Separation */
  +/* The directory name where separate debug repository and context
  +   available. NULL if Symbol Separation is not used.  */
  +extern const char *dbg_dir;
  +
  +/* The context info file name.  */
  +extern char *cinfo_file_name;
  +/* APPLE LOCAL end Symbol Separation */
  +
   /* Nonzero if an ISO standard was selected.  It rejects macros in the
      user's namespace.  */
   
  @@ -1389,5 +1398,19 @@
   /* APPLE LOCAL begin constant cfstrings */
   extern tree build_cfstring_ascii             PARAMS ((tree));
   /* APPLE LOCAL end constant cfstrings */
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +extern void dbg_ss_init                         PARAMS ((void));
  +extern void c_common_write_context              PARAMS ((void));
  +extern void cb_clear_write_symbols              PARAMS ((const char *, unsigned 
long));
  +extern void cb_restore_write_symbols            PARAMS ((void));
  +extern void cb_start_symbol_repository          PARAMS ((unsigned int,
  +                                                      const char *,
  +                                                      unsigned long));
  +extern void cb_end_symbol_repository            PARAMS ((unsigned int));
  +extern int c_valid_cinfo                        PARAMS ((cpp_reader *, 
  +                                                      const char *));
  +extern int cb_is_builtin_identifier             PARAMS ((hashnode *));
  +/* APPLE LOCAL end Symbol Separation */
   
   #endif /* ! GCC_C_COMMON_H */
  
  
  
  1.123     +1 -0      src/live/gcc3/gcc/c-decl.c
  
  Index: c-decl.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-decl.c,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- c-decl.c  2003/01/22 06:02:35     1.122
  +++ c-decl.c  2003/02/04 03:12:57     1.123
  @@ -302,6 +302,7 @@
   static void c_expand_body               PARAMS ((tree, int, int));
   static void warn_if_shadowing                PARAMS ((tree, tree));
   static bool flexible_array_type_p    PARAMS ((tree));
  +
   
   /* States indicating how grokdeclarator() should handle declspecs marked
      with __attribute__((deprecated)).  An object declared as
  
  
  
  1.46      +88 -1     src/live/gcc3/gcc/c-lex.c
  
  Index: c-lex.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-lex.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- c-lex.c   2002/12/18 00:31:50     1.45
  +++ c-lex.c   2003/02/04 03:12:57     1.46
  @@ -138,6 +138,19 @@
         cb->undef = cb_undef;
       }
   
  +  /* APPLE LOCAL begin Symbol Separation */
  +  /* Set up call back routines. These routines are used when separate symbol
  +     repositories are used.  */
  +  if (write_symbols != NO_DEBUG)
  +    {
  +      cb->restore_write_symbols = cb_restore_write_symbols;
  +      cb->clear_write_symbols = cb_clear_write_symbols;
  +      cb->is_builtin_identifier = cb_is_builtin_identifier;
  +      cb->start_symbol_repository = cb_start_symbol_repository;
  +      cb->end_symbol_repository = cb_end_symbol_repository;
  +    }
  +  /* APPLE LOCAL end Symbol Separation */
  +
     /* Start it at 0.  */
     lineno = 0;
   
  @@ -162,7 +175,7 @@
     /* APPLE LOCAL begin PFE */
     /* During a PFE load, we emit the SO stabs entry before we thaw
        prefix header stabs info.  */
  -  if (!PFE_LOADING)
  +  if (!PFE_LOADING && !dbg_dir)
       (*debug_hooks->start_source_file) (lineno, input_filename);
     /* APPLE LOCAL end PFE */
     cpp_finish_options (parse_in);
  @@ -176,6 +189,10 @@
     /* APPLE LOCAL end PFE */
   
     pch_init();
  +
  +  /* APPLE LOCAL Symbol Separation */
  +  /* Initialize Symbol Sepration. Create .cinfo file and save current cpp state.  */
  +  dbg_ss_init ();
     
     yyparse ();
     free_parser_stacks ();
  @@ -1191,3 +1208,73 @@
          || *IDENTIFIER_POINTER (rid) == '_');
   }
   /* APPLE LOCAL end AltiVec */
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +/* File pointer for context information file.  */
  +static FILE *cinfo_file;
  +
  +/* Identity marker for context information file.  */
  +static const char context_ident[8] = "0.cinfo0";
  +
  +/* Initialize symbol separtion. 
  +   If creating new symbol repository then write preprocessor state  in .cinfo file.
  +   Create .cinfo file based on main input file name in the location specified by 
  +   dbg_dir.  */
  +void
  +dbg_ss_init ()
  +{
  +  FILE *f;
  +  int dir_len, len;
  +  if (dbg_dir)
  +    {
  +      char *basename;
  +      int main_inputfilename_len, i = strlen (main_input_filename);
  +      main_inputfilename_len = i;
  +      dir_len = strlen (dbg_dir);
  +
  +      /* Search backward for first '/' */
  +      while (main_input_filename[i] != '/' && i > 0)
  +     i--;
  +
  +      basename = &main_input_filename[i];
  +      len = main_inputfilename_len - i;
  +
  +      /* 6 = strlen (".cinfo") */
  +      cinfo_file_name = (char *) xmalloc (dir_len + len + 6 + 2);
  +      strcpy (cinfo_file_name, dbg_dir);
  +      memcpy (&cinfo_file_name[dir_len], "/", 1);
  +      memcpy (&cinfo_file_name[dir_len + 1], basename, len);
  +      memcpy (&cinfo_file_name[dir_len + 1 + len], ".cinfo", 6);
  +      cinfo_file_name[dir_len + 1 + len + 6] = NULL;
  +
  +      f = fopen (cinfo_file_name, "w+b");
  +      if (f == NULL)
  +     fatal_io_error ("can't open %s", cinfo_file_name);
  +
  +      cinfo_file = f;
  +      cpp_calculate_stabs_checksum (main_input_filename);
  +
  +      (*debug_hooks->start_symbol_repository) (lineno, input_filename, 
  +                                            cpp_get_stabs_checksum ());
  +
  +      /* Write identification bytes.  */
  +      if (fwrite (context_ident, sizeof (context_ident), 1, f) != 1)
  +     fatal_io_error ("can't write to %s", cinfo_file_name);
  +
  +      cpp_save_state (parse_in, f);
  +    }
  +}
  +
  +/* Write context information in .cinfo file.
  +   Use PCH routines directly. But set and restore cinfo_state before using them.  */
  +void
  +c_common_write_context ()
  +{
  +  (*debug_hooks->end_symbol_repository) (lineno);
  +  parse_in->cinfo_state = CINFO_WRITE;
  +  cpp_write_pch_deps (parse_in, cinfo_file);
  +  cpp_write_stabs_checksum (parse_in, cinfo_file);
  +  parse_in->cinfo_state - CINFO_NONE;
  +  fclose (cinfo_file);
  +}
  +/* APPLE LOCAL end Symbol Separation */
  
  
  
  1.22      +5 -0      src/live/gcc3/gcc/c-objc-common.c
  
  Index: c-objc-common.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-objc-common.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- c-objc-common.c   2002/12/18 00:31:50     1.21
  +++ c-objc-common.c   2003/02/04 03:12:57     1.22
  @@ -378,6 +378,11 @@
     if (pch_file)
       c_common_write_pch ();
   
  +  /* APPLE LOCAL Symbol Separation */
  +  /* Write context information.  */
  +  if (dbg_dir)
  +    c_common_write_context ();
  +
     expand_deferred_fns ();
   
     if (static_ctors)
  
  
  
  1.10      +19 -1     src/live/gcc3/gcc/c-opts.c
  
  Index: c-opts.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-opts.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- c-opts.c  2003/01/10 22:51:49     1.9
  +++ c-opts.c  2003/02/04 03:12:57     1.10
  @@ -165,7 +165,9 @@
     OPT("Wimplicit-int",               CL_C,     OPT_Wimplicit_int)                 \
     OPT("Wimport",                CL_ALL,   OPT_Wimport)                            \
     OPT("Winvalid-pch",           CL_ALL,   OPT_Winvalid_pch)               \
  -  /* APPLE LOCAL -Wlong-double */  \
  +  /* APPLE LOCAL Symbol Separation */                                        \
  +  OPT("Winvalid-sr",            CL_ALL,   OPT_Winvalid_sr)                \
  +  /* APPLE LOCAL -Wlong-double */                                            \
     OPT("Wlong-double",                CL_ALL,   OPT_Wlong_double)                  \
     OPT("Wlong-long",          CL_ALL,   OPT_Wlong_long)                    \
     OPT("Wmain",                       CL_C,     OPT_Wmain)                         \
  @@ -261,6 +263,8 @@
     OPT("fnonnull-objects",    CL_CXX,   OPT_fnonnull_objects)              \
     OPT("foperator-names",     CL_CXX,   OPT_foperator_names)               \
     OPT("foptional-diags",     CL_CXX,   OPT_foptional_diags)               \
  +  /* APPLE LOCAL Symbol Separation */  \
  +  OPT("foutput-dbg=",                CL_ALL | CL_ARG, OPT__output_dbg)            \
     OPT("fpch-deps",           CL_ALL,   OPT_fpch_deps)                     \
     OPT("fpermissive",         CL_CXX,   OPT_fpermissive)                   \
     OPT("fpreprocessed",               CL_ALL,   OPT_fpreprocessed)                 \
  @@ -376,6 +380,8 @@
   
     switch (cl_options[opt_index].opt_code)
       {
  +    /* APPLE LOCAL Symbol Separation */
  +    case OPT__output_dbg:
       case OPT__output_pch:
       case OPT_Wformat_eq:
       case OPT_d:
  @@ -668,6 +674,12 @@
         print_help ();
         break;
   
  +    /* APPLE LOCAL begin Symbol Separation */
  +    case OPT__output_dbg:
  +      dbg_dir = arg;
  +      break;
  +    /* APPLE LOCAL end Symbol Separation */
  +
       case OPT__output_pch:
         pch_file = arg;
         break;
  @@ -928,6 +940,12 @@
         warn_long_double = on;
         break;
         /* APPLE LOCAL end -Wlong-double */
  +
  +      /* APPLE LOCAL begin Symbol Separation */
  +    case OPT_Winvalid_sr:
  +      cpp_opts->warn_invalid_sr = on;
  +      break;
  +      /* APPLE LOCAL end Symbol Separation */
   
       case OPT_Winvalid_pch:
         cpp_opts->warn_invalid_pch = on;
  
  
  
  1.2       +3 -1      src/live/gcc3/gcc/c-pch.c
  
  Index: c-pch.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/c-pch.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- c-pch.c   2002/12/18 00:31:50     1.1
  +++ c-pch.c   2003/02/04 03:12:57     1.2
  @@ -140,7 +140,9 @@
     
     if (memcmp (ident, pch_ident, sizeof (pch_ident)) != 0)
       {
  -      if (cpp_get_options (pfile)->warn_invalid_pch)
  +      /* APPLE LOCAL Symbol Separtion */
  +      if (cpp_get_options (pfile)->warn_invalid_pch 
  +       || cpp_get_options (pfile)->warn_invalid_sr)
        {
          if (memcmp (ident, pch_ident, 5) == 0)
            /* It's a PCH, for the right language, but has the wrong version.
  
  
  
  1.60      +149 -8    src/live/gcc3/gcc/cppfiles.c
  
  Index: cppfiles.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cppfiles.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- cppfiles.c        2003/02/04 00:10:44     1.59
  +++ cppfiles.c        2003/02/04 03:12:57     1.60
  @@ -124,6 +124,11 @@
                                      precompiled header.
                                   3: file is always a valid precompiled
                                      header.  */
  +  /* APPLE LOCAL begin Symbol Separation */
  +  unsigned char suppress_dbg;   /* 0: Default. Do nothing.
  +                                1: file has separate debugging information
  +                                   available. Do not generate again.  */
  +  /* APPLE LOCAL end Symbol Separation */
   };
   
   /* Variable length record files on VMS will have a stat size that includes
  @@ -539,6 +544,15 @@
       /* We don't want MI guard advice for the main file.  */
       inc->include_count++;
   
  +  /* APPLE LOCAL begin Symbol Separation */
  +  if (pfile->found_cinfo)
  +    {
  +      inc->suppress_dbg = 1;
  +      if (pfile->cb.clear_write_symbols)
  +     pfile->cb.clear_write_symbols (inc->name, cpp_get_stabs_checksum ());
  +    }
  +  /* APPLE LOCAL end Symbol Separation */
  +
     /* Push a buffer.  */
     fp = cpp_push_buffer (pfile, inc->buffer, inc->st.st_size,
                        /* from_stage3 */ CPP_OPTION (pfile, preprocessed), 0);
  @@ -829,9 +843,14 @@
     struct include_file *file;
     char *name, *n;
   
  +  /* APPLE LOCAL begin Symbol Separation */
  +  if (c_valid_cinfo (pfile, fname))
  +    pfile->found_cinfo = true;
  +  /* APPLE LOCAL end Symbol Separtion */
  +
     if (IS_ABSOLUTE_PATHNAME (fname))
       return open_file_pch (pfile, fname);
  -
  +  
     /* For #include_next, skip in the search path past the dir in which
        the current file was found, but if it was found via an absolute
        path use the normal search logic.  */
  @@ -853,15 +872,35 @@
     /* APPLE LOCAL -header-mapfile bandaid for buffer overflows */
     name = (char *) alloca (strlen (fname) + pfile->max_include_len + 2 + 500);
   
  -/* APPLE LOCAL begin header search */
  +  /* APPLE LOCAL begin header search */
     if ((type != IT_INCLUDE_NEXT) && 
         (CPP_OPTION (pfile, bracket_include) == CPP_OPTION (pfile, quote_include)))
       {
  -    /* handle everything but gcc's include_next and -I- extensions */
  -    if ((file = find_include_file_in_hashtable (pfile, fname, name, header->type, 
path)))
  -      return file;
  +      /* APPLE LOCAL begin Symbol Separation */
  +      size_t namelen = strlen (fname);
  +      char *cinfoname = alloca (namelen + 8);
  +      memcpy (cinfoname, fname, namelen);
  +      memcpy (cinfoname + namelen, ".cinfo", 7);
  +      cinfoname[namelen+7] = NULL;
  +      /* handle everything but gcc's include_next and -I- extensions */
  +      if ((file = find_include_file_in_hashtable (pfile, cinfoname, name, 
header->type, path)))
  +     {
  +       size_t dirlen = strlen ((file->foundhere)->name);
  +       char *cinfo_fullname = alloca (namelen + dirlen + 1);
  +       memcpy (cinfo_fullname,  (file->foundhere)->name, dirlen);
  +       memcpy (cinfo_fullname + dirlen, "/", 1);
  +       memcpy (cinfo_fullname + dirlen + 1, fname, namelen);
  +       cinfo_fullname [dirlen + namelen + 1] = NULL;
  +       if (c_valid_cinfo (pfile, cinfo_fullname))
  +         pfile->found_cinfo = true;
  +       file = NULL;
  +     }
  +      /* APPLE LOCAL end Symbol Separation */
  +      /* handle everything but gcc's include_next and -I- extensions */
  +      if ((file = find_include_file_in_hashtable (pfile, fname, name, header->type, 
path)))
  +     return file;
       }
  -/* APPLE LOCAL end header search */
  +  /* APPLE LOCAL end header search */
   
     for (; path; path = path->next)
       {
  @@ -887,6 +926,11 @@
         else
        n = name;
   
  +      /* APPLE LOCAL begin Symbol Separation */
  +      if (c_valid_cinfo (pfile, fname))
  +     pfile->found_cinfo = true;
  +      /* APPLE LOCAL end Symbol Separtion */
  +
         file = open_file_pch (pfile, n);
         if (file)
        {
  @@ -997,6 +1041,11 @@
             else
            n = frname;
   
  +       /* APPLE LOCAL begin Symbol Separation */
  +       if (c_valid_cinfo (pfile, fname))
  +         pfile->found_cinfo = true;
  +       /* APPLE LOCAL end Symbol Separtion */
  +
             file = open_file (pfile, n);
             if (file)
            {
  @@ -1101,7 +1150,12 @@
               n = remap_filename (pfile, sfrname, path);
             else
               n = sfrname;
  -    
  +   
  +       /* APPLE LOCAL begin Symbol Separation */
  +       if (c_valid_cinfo (pfile, n))
  +         pfile->found_cinfo = true;
  +       /* APPLE LOCAL end Symbol Separtion */
  + 
             file = open_file (pfile, n);
             if (file)
               {
  @@ -1199,7 +1253,12 @@
        enum include_type type;
   {
     bool stacked = false;
  -  struct include_file *inc = find_include_file (pfile, header, type);
  +  struct include_file *inc;
  +
  +  /* APPLE LOCAL begin Symbol Separation */
  +  pfile->found_cinfo = false;
  +
  +  inc = find_include_file (pfile, header, type);
   
     /* APPLE LOCAL begin framework headers */
   #ifdef FRAMEWORK_HEADERS
  @@ -2075,3 +2134,85 @@
   }
   #endif
   /* APPLE LOCAL end header search */
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +static const char context_ident[8] = "gContext";
  +
  +/* See if valid .cinfo file exists for given filename.
  +   Use cpp_valid_state() (from PCH) to validate preprocessor state.  */
  +int
  +c_valid_cinfo (pfile, filename)
  +     cpp_reader *pfile;
  +     const char *filename;
  +{
  +  if (1)
  +    {
  +      size_t namelen = strlen (filename);
  +      char *cinfoname = alloca (namelen + 7);
  +      int fd, sizeread, result;
  +      char ident[8];
  +
  +      memcpy (cinfoname, filename, namelen);
  +      memcpy (cinfoname + namelen, ".cinfo", 7);
  +
  +      /* file = validate_context (pfile, filename, pchname);*/
  +      fd = open (cinfoname, O_RDONLY, S_IRWXU);
  +      if (fd == -1)
  +     return 0;
  +
  +      sizeread = read (fd, ident, sizeof (context_ident));
  +      if (sizeread == -1)
  +     {
  +       cpp_error (pfile, DL_WARNING, "can't read %s", cinfoname); 
  +       return 0;
  +     }
  +      else if (sizeread != sizeof (context_ident))
  +     return 0;
  +  
  +      if (memcmp (ident, context_ident, sizeof (context_ident)) != 0)
  +     {
  +       /*
  +         if (cpp_get_options (pfile)->warn_invalid_context)
  +           {
  +           }
  +       */
  +       return 0;
  +     }
  +
  +      /* Check the preprocessor macros are the same as when the PCH was
  +      generated.  */
  +  
  +      result = cpp_valid_state (pfile, cinfoname, fd);
  +#if 1
  +      if (result == 0)
  +     {
  +       printf ("using ss for %s\n", filename);
  +       cpp_read_stabs_checksum (pfile, fd);
  +       return 1;
  +     }
  +      else 
  +     return 0;
  +#else
  +      if (result == -1)
  +     return 0;
  +      else
  +     if (result == 0)
  +       {
  +         printf ("using ss for %s\n", filename);
  +         cpp_read_stabs_checksum (pfile, fd);
  +         return 1;
  +       }
  +#endif
  +    }
  +}
  +
  +/* Return 1 if include has suppress_dbg set.  */
  +int
  +suppress_dbg_info (inc)
  +     struct include_file *inc;
  +{
  +  if (!inc)
  +    return 0;
  +  return inc->suppress_dbg;
  +}
  +/* APPLE LOCAL end Symbol Separation */
  
  
  
  1.25      +23 -0     src/live/gcc3/gcc/cpphash.h
  
  Index: cpphash.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cpphash.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- cpphash.h 2003/01/02 21:49:34     1.24
  +++ cpphash.h 2003/02/04 03:12:58     1.25
  @@ -331,6 +331,19 @@
     const uchar *saved_cur, *saved_rlimit;
   };
   
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Indicate state of context info processing.
  +   Context info processing shares code with PCH, but it does not need
  +   everything PCH does. Use this context info states to exclude not
  +   required stuff.  */
  +enum cpp_cinfo_state 
  +  {
  +    CINFO_NONE,
  +    CINFO_READ,   /* Reading context information */
  +    CINFO_WRITE   /* Writing context information */
  +  };
  +/* APPLE LOCAL end Symbol Separation */
  +
   /* A cpp_reader encapsulates the "state" of a pre-processor run.
      Applying cpp_get_token repeatedly yields a stream of pre-processor
      tokens.  Usually, there is only one cpp_reader object active.  */
  @@ -461,6 +474,14 @@
     /* A saved list of the defined macros, for dependency checking
        of precompiled headers.  */
     struct cpp_savedstate *savedstate;
  +
  +  /* APPLE LOCAL begin Symbol Separation */
  +  /* Indicate if valid context information was found during header search.  */
  +  bool found_cinfo;
  +
  +  /* State of context information read/write operation.  */
  +  enum cpp_cinfo_state cinfo_state;
  +  /* APPLE LOCAL end Symbol Separation */
   };
   
   /* Character classes.  Based on the more primitive macros in safe-ctype.h.
  @@ -534,6 +555,8 @@
   extern void _cpp_cleanup_includes    PARAMS ((cpp_reader *));
   extern void _cpp_pop_file_buffer     PARAMS ((cpp_reader *,
                                                 struct include_file *));
  +/* APPLE LOCAL Symbol Separation */
  +extern int suppress_dbg_info            PARAMS ((struct include_file *));
   
   /* In cppexp.c */
   extern bool _cpp_parse_expr          PARAMS ((cpp_reader *));
  
  
  
  1.46      +6 -0      src/live/gcc3/gcc/cpplib.c
  
  Index: cpplib.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cpplib.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- cpplib.c  2003/01/02 21:49:34     1.45
  +++ cpplib.c  2003/02/04 03:12:58     1.46
  @@ -2153,6 +2153,12 @@
        {
          _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
   
  +       /* APPLE LOCAL begin Symbol Separation */
  +       if (suppress_dbg_info (inc))
  +         if (pfile->cb.restore_write_symbols)
  +           pfile->cb.restore_write_symbols ();
  +       /* APPLE LOCAL end Symbol Separation */
  +
          /* If this is the main file, there may be some -include
             files left to push.  */
          if (!pfile->buffer->prev)
  
  
  
  1.36      +24 -0     src/live/gcc3/gcc/cpplib.h
  
  Index: cpplib.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cpplib.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- cpplib.h  2002/12/18 00:31:52     1.35
  +++ cpplib.h  2003/02/04 03:12:58     1.36
  @@ -454,6 +454,11 @@
   
     /* True if dependencies should be restored from a precompiled header.  */
     bool restore_pch_deps;
  +
  +  /* APPLE LOCAL begin Symbol Separation */
  +  /* True to warn about symbol repositories we couldn't use.  */
  +  bool warn_invalid_sr;
  +  /* APPLE LOCAL end Symbol Separation */
   };
   
   /* Call backs.  */
  @@ -473,6 +478,14 @@
     void (*register_builtins) PARAMS ((cpp_reader *));
     int (*valid_pch) PARAMS ((cpp_reader *, const char *, int));
     void (*read_pch) PARAMS ((cpp_reader *, const char *, int, const char *));
  +
  +  /* APPLE LOCAL begin Symbol Separation */
  +  void (*restore_write_symbols)   PARAMS ((void));
  +  void (*clear_write_symbols)     PARAMS ((const char *, unsigned long));
  +  void (*start_symbol_repository) PARAMS ((unsigned int, const char *, unsigned 
long));
  +  void (*end_symbol_repository)   PARAMS ((unsigned int));
  +  int (*is_builtin_identifier)    PARAMS ((cpp_hashnode *));
  +  /* APPLE LOCAL end Symbol Separation */
   };
   
   /* Name under which this program was invoked.  */
  @@ -548,6 +561,17 @@
       enum builtin_type GTY ((tag ("1"))) builtin; 
     } GTY ((desc ("0"))) value;
   };
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +struct cpp_stab_checksum GTY(())
  +{
  +  unsigned long checksum;
  +};
  +extern void cpp_write_stabs_checksum        PARAMS ((struct cpp_reader *, FILE *));
  +extern void cpp_read_stabs_checksum         PARAMS ((struct cpp_reader *, int));
  +extern unsigned long cpp_get_stabs_checksum PARAMS ((void));
  +extern void cpp_calculate_stabs_checksum    PARAMS ((const char *));
  +/* APPLE LOCAL end Symbol Separation */
   
   /* Call this first to get a handle to pass to other functions.  */
   extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang));
  
  
  
  1.3       +73 -5     src/live/gcc3/gcc/cpppch.c
  
  Index: cpppch.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cpppch.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cpppch.c  2003/01/02 21:49:34     1.2
  +++ cpppch.c  2003/02/04 03:12:58     1.3
  @@ -234,6 +234,12 @@
        struct cpp_string news;
        void **slot;
        
  +     /* APPLE LOCAL begin Symbol Separation */
  +     if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier)
  +       if (pfile->cb.is_builtin_identifier (hn))
  +         return 1;
  +     /* APPLE LOCAL end Symbol Separation */
  +
        news.len = NODE_LEN (hn);
        news.text = NODE_NAME (hn);
        slot = htab_find (ss->definedhash, &news);
  @@ -274,6 +280,12 @@
        struct cpp_string news;
        void **slot;
        
  +     /* APPLE LOCAL begin Symbol Separation */
  +     if (pfile->cinfo_state == CINFO_WRITE && pfile->cb.is_builtin_identifier)
  +       if (pfile->cb.is_builtin_identifier (hn))
  +         return 1;
  +     /* APPLE LOCAL end Symbol Separation */
  +
        news.len = NODE_LEN (hn);
        news.text = NODE_NAME (hn);
        slot = htab_find (ss->definedhash, &news);
  @@ -370,8 +382,8 @@
      - anything that was not defined then, but is defined now, was not
        used by the PCH.
   
  -   NAME is used to print warnings if `warn_invalid_pch' is set in the
  -   reader's flags.
  +   NAME is used to print warnings if `warn_invalid_pch' or `warn_invalid_sr'
  +   is set in the reader's flags.
   */
   
   int
  @@ -415,7 +427,8 @@
          || h->type != NT_MACRO
          || h->flags & NODE_POISONED)
        {
  -       if (CPP_OPTION (r, warn_invalid_pch))
  +       /* APPLE LOCAL Symbol Separtion */
  +       if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
            cpp_error (r, DL_WARNING,
                       "%s: not used because `%.*s' not defined",
                       name, m.name_length, namebuf);
  @@ -427,7 +440,8 @@
         if (m.definition_length != ustrlen (newdefn)
          || memcmp (namebuf, newdefn, m.definition_length) != 0)
        {
  -       if (CPP_OPTION (r, warn_invalid_pch))
  +       /* APPLE LOCAL Symbol Separtion */
  +       if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
            cpp_error (r, DL_WARNING, 
               "%s: not used because `%.*s' defined as `%s' not `%.*s'",
                       name, m.name_length, namebuf, newdefn + m.name_length,
  @@ -452,7 +466,8 @@
         if (h->type != NT_VOID
          || h->flags & NODE_POISONED)
        {
  -       if (CPP_OPTION (r, warn_invalid_pch))
  +       /* APPLE LOCAL Symbol Separtion */
  +       if (CPP_OPTION (r, warn_invalid_pch) || CPP_OPTION (r, warn_invalid_sr))
            cpp_error (r, DL_WARNING, "%s: not used because `%s' is defined",
                       name, undeftab + i);
          goto fail;
  @@ -681,3 +696,56 @@
     cpp_errno (r, DL_ERROR, "while reading precompiled header");
     return -1;
   }
  +
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Hold checksum for the include file. It is included with BINCL and EINCL stabs.  
*/
  +static struct cpp_stab_checksum stabs_checksum;
  +
  +/* Write checksum in to input file (.cinfo).  */
  +void
  +cpp_write_stabs_checksum (pfile, f)
  +     struct cpp_reader *pfile;
  +     FILE *f;
  +{
  +
  +  if (fwrite (&stabs_checksum, sizeof (struct cpp_stab_checksum), 1, f) != 1)
  +    cpp_errno (pfile, DL_ERROR, "while writing checksum for context info file");
  +
  +}
  +
  +/* Read checksum using input file descriptor (.cifno).  */
  +void
  +cpp_read_stabs_checksum (pfile, fd)
  +     struct cpp_reader *pfile;
  +     int fd;
  +{
  +  size_t len = sizeof (struct cpp_stab_checksum);
  +
  +  stabs_checksum.checksum = 0;
  +  if (read (fd, &stabs_checksum, len) == -1)
  +    cpp_errno (pfile, DL_ERROR, "while reading checksum from context info file");
  +}
  +
  +/* Return checksum */
  +unsigned long
  +cpp_get_stabs_checksum ()
  +{
  +  return stabs_checksum.checksum;
  +}
  +
  +/* Calculate checksum for the header represented by input name.
  +   Use inode value as checksum.  */
  +void
  +cpp_calculate_stabs_checksum (name)
  +     const char *name;
  +{
  +  struct stat st;
  +  if (stat (name, &st) == 0)
  +    {
  +      /* Use timestamp from stat and mask one bit.  */
  +      stabs_checksum.checksum = (unsigned long) st.st_mtime | 0x10000000;
  +    }
  +  else
  +    stabs_checksum.checksum = 0xFF;
  +}
  +/* APPLE LOCAL end Symbol Separation */
  
  
  
  1.41      +87 -2     src/live/gcc3/gcc/dbxout.c
  
  Index: dbxout.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/dbxout.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- dbxout.c  2003/01/22 06:02:38     1.40
  +++ dbxout.c  2003/02/04 03:12:58     1.41
  @@ -492,6 +492,12 @@
   
   static void dbxout_init                      PARAMS ((const char *));
   static void dbxout_finish            PARAMS ((const char *));
  +/* APPLE LOCAL begin Symbol Separtion */
  +static void dbxout_restore_write_symbols   PARAMS ((void));
  +static void dbxout_clear_write_symbols     PARAMS ((const char *, unsigned long));
  +static void dbxout_start_symbol_repository PARAMS ((unsigned int, const char *, 
unsigned long));
  +static void dbxout_end_symbol_repository   PARAMS ((unsigned int));
  +/* APPLE LOCAL end Symbol Separation */
   static void dbxout_start_source_file PARAMS ((unsigned, const char *));
   static void dbxout_end_source_file   PARAMS ((unsigned));
   static void dbxout_typedefs          PARAMS ((tree));
  @@ -554,7 +560,13 @@
     dbxout_global_decl,                /* global_decl */
     debug_nothing_tree,                /* deferred_inline_function */
     debug_nothing_tree,                /* outlining_inline_function */
  -  debug_nothing_rtx          /* label */
  +  debug_nothing_rtx,         /* label */
  +  /* APPLE LOCAL begin Symbol Separation */
  +  dbxout_restore_write_symbols,
  +  dbxout_clear_write_symbols,
  +  dbxout_start_symbol_repository,
  +  dbxout_end_symbol_repository
  +  /* APPLE LOCAL end Symbol Separation */
   };
   #endif /* DBX_DEBUGGING_INFO  */
   
  @@ -580,7 +592,13 @@
     dbxout_global_decl,                /* global_decl */
     debug_nothing_tree,                /* deferred_inline_function */
     debug_nothing_tree,                /* outlining_inline_function */
  -  debug_nothing_rtx          /* label */
  +  debug_nothing_rtx,         /* label */
  +  /* APPLE LOCAL begin Symbol Separtion */
  +  debug_nothing_void,           /* restore write_symbols */
  +  debug_nothing_void,           /* clear write_symbols */
  +  debug_nothing_void,           /* start repository */
  +  debug_nothing_void            /* end repository */
  +  /* APPLE LOCAL end Symbol Separation */
   };
   #endif /* XCOFF_DEBUGGING_INFO  */
   
  @@ -750,6 +768,63 @@
       }
   }
   
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Restore write_symbols */
  +static void
  +dbxout_restore_write_symbols ()
  +{
  +  if (flag_guniq)
  +    write_symbols = orig_write_symbols;
  +}
  +
  +/* Clear write_symbols and emit EXCL stab.  */
  +static void
  +dbxout_clear_write_symbols (filename, checksum)
  +     const char *filename;
  +     unsigned long checksum;
  +{
  +  if (flag_guniq)
  +    {
  +      write_symbols = NO_DEBUG;
  +      fprintf (asmfile, "%s", ASM_STABS_OP);
  +      output_quoted_string (asmfile, filename);
  +      fprintf (asmfile, ",%d,0,0,%d\n", N_EXCL, checksum);
  +    }
  +}
  +
  +/* Start symbol repository */
  +/* Add checksum with BINCL.  */
  +static void
  +dbxout_start_symbol_repository (lineno, filename, checksum)
  +     unsigned int lineno ATTRIBUTE_UNUSED;
  +     const char *filename ATTRIBUTE_UNUSED; 
  +     unsigned long checksum ATTRIBUTE_UNUSED;
  +{
  +#ifdef DBX_USE_BINCL
  +  struct dbx_file *n = (struct dbx_file *) ggc_alloc (sizeof *n);
  +
  +  n->next = current_file;
  +  n->file_number = next_file_number++;
  +  n->next_type_number = 1;
  +  current_file = n;
  +  fprintf (asmfile, "%s", ASM_STABS_OP);
  +  output_quoted_string (asmfile, filename);
  +  fprintf (asmfile, ",%d,0,0,%d\n", N_BINCL, checksum);
  +#endif
  +}
  +
  +/* End symbol repository */
  +static void
  +dbxout_end_symbol_repository (lineno)
  +     unsigned int lineno ATTRIBUTE_UNUSED;
  +{
  +#ifdef DBX_USE_BINCL
  +  fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL);
  +  current_file = current_file->next;
  +#endif
  +}
  +/* APPLE LOCAL end Symbol Separation */
  +
   /* Change to reading from a new source file.  Generate a N_BINCL stab.  */
   
   static void
  @@ -758,6 +833,11 @@
        const char *filename ATTRIBUTE_UNUSED;
   {
   #ifdef DBX_USE_BINCL
  +  /* APPLE LOCAL begin Symbol Separation */
  +  if (write_symbols == NO_DEBUG)
  +    return;
  +  /* APPLE LOCAL end Symbol Separation */
  +
     struct dbx_file *n = (struct dbx_file *) ggc_alloc (sizeof *n);
   
     n->next = current_file;
  @@ -777,6 +857,11 @@
        unsigned int line ATTRIBUTE_UNUSED;
   {
   #ifdef DBX_USE_BINCL
  +  /* APPLE LOCAL begin Symbol Separation */
  +  if (write_symbols == NO_DEBUG)
  +    return;
  +  /* APPLE LOCAL end Symbol Separation */
  +
     fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL);
     current_file = current_file->next;
   #endif
  
  
  
  1.8       +7 -0      src/live/gcc3/gcc/debug.h
  
  Index: debug.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/debug.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- debug.h   2002/10/24 23:42:53     1.7
  +++ debug.h   2003/02/04 03:12:58     1.8
  @@ -101,6 +101,13 @@
     /* Called from final_scan_insn for any CODE_LABEL insn whose
        LABEL_NAME is non-null.  */
     void (* label) PARAMS ((rtx));
  +  
  +  /* APPLE LOCAL begin Symbol Separation */
  +  void (* restore_write_symbols)   PARAMS ((void));
  +  void (* clear_write_symbols)     PARAMS ((const char *, unsigned long));
  +  void (* start_symbol_repository) PARAMS ((unsigned int, const char *, unsigned 
logn));
  +  void (* end_symbol_repository)   PARAMS ((unsigned int));
  +  /* APPLE LOCAL end Symbol Separation */
   };
   
   extern const struct gcc_debug_hooks *debug_hooks;
  
  
  
  1.40      +7 -0      src/live/gcc3/gcc/flags.h
  
  Index: flags.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/flags.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- flags.h   2002/11/20 20:49:12     1.39
  +++ flags.h   2003/02/04 03:12:58     1.40
  @@ -41,6 +41,13 @@
   /* Specify which kind of debugging info to generate.  */
   extern enum debug_info_type write_symbols;
   
  +/* APPLE LOCAL begin Symbol Separation */
  +extern enum debug_info_type orig_write_symbols;
  +
  +/* Nonzero means, try to look for separate symbol repositories.  */
  +extern int flag_guniq;
  +/* APPLE LOCAL end Symbol Separation */
  +
   enum debug_info_level
   {
     DINFO_LEVEL_NONE,  /* Write no debugging info.  */
  
  
  
  1.162     +22 -7     src/live/gcc3/gcc/gcc.c
  
  Index: gcc.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/gcc.c,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- gcc.c     2003/01/22 06:02:41     1.161
  +++ gcc.c     2003/02/04 03:12:58     1.162
  @@ -781,8 +781,10 @@
      compiling multiple architectures and the output is a .o or an
      executable. */
   static char *ofile_merge_spec = "\
  -%{!fdump=*:%{!M:%{!MM:%{!E:%{!precomp:%{!S:lipo -create %F \
  -                          %{c:%W{o}%{!o:-o %w%b%O}}%{!c:-o %w%u%O}\n}}}}}}";
  +%{!fdump=*:%{!M:%{!MM:%{!E:%{!precomp:%{!S:\
  +  lipo -create %F%{c:%W{o}%{!o:%{!foutput-dbg*:-o %w%b%O} %{foutput-dbg*:-o 
%w%i%O}}}\
  +                 %{!c:%{!foutput-dbg*:-o %w%u%O} %{foutput-dbg*:-o 
%w%i%O}}\n}}}}}}";
  +
   static char *exec_merge_spec = "\
   %{!fdump=*:%{!M:%{!MM:%{!E:%{!precomp:%{!S:%{!c:lipo -create %F \
                                  %{o}%{!o:-o a.out}\n}}}}}}}";
  @@ -812,6 +814,13 @@
   static const char *trad_capable_cpp =
   "cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}";
   
  +/* When making PCH file use this.  */
  +static const char *pch = 
  +"%{!foutput-dbg*:-o %g.s %{!o*:--output-pch=%i.pch} %W{^o*:--output-pch=%*}%V}";
  +
  +/* APPLE LOCAL Symbol Separation  */
  +static const char *dbg_ss= "%{foutput-dbg*: -gfull %(invoke_as)}";
  +
   /* APPLE LOCAL begin cpp-precomp */
   /* Encapsulate cpp-precomp's name and basic options in a subspec.  */
   static const char *cpp_precomp =
  @@ -887,7 +896,10 @@
   
   static const char *asm_options =
   /* APPLE LOCAL fat builds */
  -"%a %Y %{@:-o %f%u%O}%{!@:%{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}}";
  +"%a %Y \
  + %{@:-o %f%u%O}\
  + %{!@:%{c:%W{o*}%{!o*:%{!foutput-dbg*:-o %w%b%O} %{foutput-dbg*:-o %w%i%O}}}\
  +      %{!c:%{!foutput-dbg*:-o %d%w%u%O} %{foutput-dbg*:%W{o*}%{!o*:-o %w%i%O}}}}";
   
   /* APPLE LOCAL PFE */
   /* Suppress assembling when doing a PFE dump.  ilr */
  @@ -1088,12 +1100,10 @@
          %{save-temps|traditional-cpp:\
            %(trad_capable_cpp) %(cpp_options) %b.i \n\
                cc1 -fpreprocessed %b.i %(cc1_options)\
  -                    -o %g.s %{!o*:--output-pch=%i.pch}\
  -                    %W{^o*:--output-pch=%*}%V}\
  +                    %(dbg_ss) %(pch)}\
            %{!save-temps:%{!traditional-cpp:\
              cc1 %(cpp_unique_options) %(cc1_options)\
  -                  -o %g.s %{!o*:--output-pch=%i.pch}\
  -                  %W{^o*:--output-pch=%*}%V}}}}}}", 0},
  +                    %(dbg_ss) %(pch)}}}}}}", 0},
     /* APPLE LOCAL end cpp-precomp */
     {".i", "@cpp-output", 0},
     {"@cpp-output",
  @@ -1260,6 +1270,8 @@
      {"--load-pch", "-fload=", "aj"},
      {"--dump-pch", "-fdump=", "aj"},
      {"--validate-pch", "-fvalidate", 0},
  +   /* APPLE LOCAL Symbol Separation */
  +   {"--output-dbg", "-foutput-dbg=", "aj"},
      {"--", "-f", "*j"}
    };
   
  @@ -1668,6 +1680,9 @@
     /* APPLE LOCAL cpp-precomp */
     INIT_STATIC_SPEC ("cpp_precomp",           &cpp_precomp),
     INIT_STATIC_SPEC ("cpp_precomp_options",   &cpp_precomp_options),
  +  INIT_STATIC_SPEC ("pch",                   &pch),
  +  /* APPLE LOCAL Symbol Separtion */
  +  INIT_STATIC_SPEC ("dbg_ss",                        &dbg_ss),
     INIT_STATIC_SPEC ("cc1",                   &cc1_spec),
     INIT_STATIC_SPEC ("cc1_options",           &cc1_options),
     INIT_STATIC_SPEC ("cc1plus",                       &cc1plus_spec),
  
  
  
  1.13      +1 -0      src/live/gcc3/gcc/stringpool.c
  
  Index: stringpool.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/stringpool.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- stringpool.c      2002/12/18 00:31:56     1.12
  +++ stringpool.c      2003/02/04 03:12:59     1.13
  @@ -131,6 +131,7 @@
     return HT_IDENT_TO_GCC_IDENT (ht_node);
   }
   
  +
   /* If an identifier with the name TEXT (a null-terminated string) has
      previously been referred to, return that node; otherwise return
      NULL_TREE.  */
  
  
  
  1.170     +34 -0     src/live/gcc3/gcc/toplev.c
  
  Index: toplev.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/toplev.c,v
  retrieving revision 1.169
  retrieving revision 1.170
  diff -u -r1.169 -r1.170
  --- toplev.c  2003/01/22 06:02:44     1.169
  +++ toplev.c  2003/02/04 03:12:59     1.170
  @@ -343,6 +343,14 @@
      types of debugging information.  */
   extern enum debug_info_type write_symbols = NO_DEBUG;
   
  +/* APPLE LOCAL begin Symbol Separation */
  +/* Original value of write_symbols.  */
  +enum debug_info_type orig_write_symbols = NO_DEBUG;
  +
  +/* Nonzero means, try to look for separate symbol repositories.  */
  +int flag_guniq = 0;
  +/* APPLE LOCAL end Symbol Separation */
  +
   /* Level of debugging information we are producing.  See flags.h
      for the definitions of the different possible levels.  */
   enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
  @@ -1440,6 +1448,10 @@
     { "-Wno-import", "" },
     { "-Winvalid-pch",
       N_("Warn about PCH files that are found but not used") },
  +  /* APPLE LOCAL begin Symbol Separation */
  +  { "-Winvalid-sr",
  +    N_("Warn about Symbol Repositories that are found but not used") },
  +  /* APPLE LOCAL end Symbol Separation */
     { "-Wlong-long","" },
     { "-Wno-long-long",
       N_("Do not warn about using 'long long' when -pedantic") },
  @@ -4417,6 +4429,18 @@
   #endif
   /* APPLE LOCAL end gdb only used symbols ilr */
   
  +/* APPLE LOCAL begin Symbol Separation */
  +  if (strncmp (arg, "uniq", 4) == 0 || strncmp (arg, "-uniq", 5) == 0)
  +    {
  +      flag_guniq = 1;
  +      char *p = (char *)arg + (*(char *)arg == '-') + 4;
  +      if (*p == '-')
  +     ++p;
  +      g_all_len = p - arg;
  +      arg += g_all_len;
  +    }
  +/* APPLE LOCAL end Symbol Separation */
  +
     /* Look up ARG in the table.  */
     for (da = debug_args; da->arg; da++)
       {
  @@ -4517,6 +4541,9 @@
        }
       }
   
  +  /* APPLE LOCAL Symbol Separation */
  +  /* Save original value */
  +  orig_write_symbols = write_symbols;
     if (! da->arg)
       return 0;
   
  @@ -5831,6 +5858,13 @@
     /* Close non-debugging input and output files.  Take special care to note
        whether fclose returns an error, since the pages might still be on the
        buffer chain while the file is open.  */
  +
  +  /* APPLE LOCAL begin Symbol Separation */
  +  /* BINCL/EINCL do not match. They do not match in FSF also. */
  +  if (!dbg_dir)
  +    (*debug_hooks->end_source_file) (lineno);
  +  /* APPLE LOCAL end Symbol Separation */
  +
     /* APPLE LOCAL begin PFE ff */
     /* Make sure we don't close stdout (which asm_out_file is mapped to
        during a dump) so that we can write PFE diagnostics out if 
  
  
  
  1.53      +1 -0      src/live/gcc3/gcc/tree.c
  
  Index: tree.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/tree.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- tree.c    2002/12/18 00:31:57     1.52
  +++ tree.c    2003/02/04 03:12:59     1.53
  @@ -50,6 +50,7 @@
   /* obstack.[ch] explicitly declined to prototype this.  */
   extern int _obstack_allocated_p PARAMS ((struct obstack *h, PTR obj));
   
  +#define GATHER_STATISTICS
   #ifdef GATHER_STATISTICS
   /* Statistics-gathering stuff.  */
   typedef enum
  
  
  
  1.194     +2 -2      src/live/gcc3/gcc/config/darwin.h
  
  Index: darwin.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/config/darwin.h,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- darwin.h  2003/01/23 22:54:17     1.193
  +++ darwin.h  2003/02/04 03:13:04     1.194
  @@ -206,7 +206,7 @@
      specifying the handling of options understood by generic Unix
      linkers, and for positional arguments like libraries.  */
   #define LINK_COMMAND_SPEC "\
  -%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
  +%{!foutput-dbg*:%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
       %{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
       %{!Zdynamiclib:-arch %T %{@:-arch_multiple}} \
       %{Zdynamiclib:-arch_only %T} \
  @@ -216,7 +216,7 @@
       %{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
       %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%G %L}} \
       %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} \
  -    %{!--help:%{!no-c++filt|c++filt:| c++filt3 }} }}}}}}}}"
  +    %{!--help:%{!no-c++filt|c++filt:| c++filt3 }} }}}}}}}}}"
   
   /* Note that the linker
      output is always piped through c++filt (unless -no-c++filt is
  
  
  
  1.31      +1 -2      src/live/gcc3/gcc/cp/lang-specs.h
  
  Index: lang-specs.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/cp/lang-specs.h,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- lang-specs.h      2002/12/18 00:32:13     1.30
  +++ lang-specs.h      2003/02/04 03:13:05     1.31
  @@ -45,8 +45,7 @@
                %(cpp_options) %2 %b.ii \n}\
         cc1plus %{save-temps:-fpreprocessed %b.ii}\
              %{!save-temps:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}\
  -     %(cc1_options) %2 %{+e1*}\
  -        -o %g.s %{!o*:--output-pch=%i.pch} %W{^o*:--output-pch=%*}%V}}}",
  +     %(cc1_options) %2 %{+e1*} %(dbg_ss) %(pch)}}}",
        CPLUSPLUS_CPP_SPEC},
     {"@c++",
      /* cc1plus has an integrated ISO C preprocessor.  We should invoke
  
  
  


Reply via email to