]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/16304 (bootstrap failure on AIX 4.3.3: cannot build strstream in libstdc++)
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 16 Jan 2005 16:01:28 +0000 (16:01 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 16 Jan 2005 16:01:28 +0000 (16:01 +0000)
PR target/16304
* defaults.h (TARGET_DEFERRED_OUTPUT_DEFS): Provide default.
* toplev.c (compile_file): Call process_pending_assemble_output_defs
just before targetm.asm_out.file_end.
* tree.h (process_pending_assemble_output_defs): Declare.
* varasm.c (assemble_output_def, process_pending_assemble_output_defs):
New functions.
(assemble_alias): Defer generation of assembly code for defines when
TARGET_DEFERRED_OUTPUT_DEFS is true.
* config/rs6000/aix41.h (TARGET_DEFERRED_OUTPUT_DEFS): Define.
* config/rs6000/aix43.h (TARGET_DEFERRED_OUTPUT_DEFS): Define.
* doc/tm.texi (TARGET_DEFERRED_OUTPUT_DEFS): document.

From-SVN: r93728

gcc/ChangeLog
gcc/config/rs6000/aix41.h
gcc/config/rs6000/aix43.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/toplev.c
gcc/tree.h
gcc/varasm.c

index 890993c48b19fc7be23cb5f2044d0f1f4b1e3875..0f486538bf24a86d589605b51a65c43dfc75aab6 100644 (file)
@@ -1,3 +1,18 @@
+2005-01-16  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR target/16304
+       * defaults.h (TARGET_DEFERRED_OUTPUT_DEFS): Provide default.
+       * toplev.c (compile_file): Call process_pending_assemble_output_defs
+       just before targetm.asm_out.file_end.
+       * tree.h (process_pending_assemble_output_defs): Declare.
+       * varasm.c (assemble_output_def, process_pending_assemble_output_defs):
+       New functions.
+       (assemble_alias): Defer generation of assembly code for defines when
+       TARGET_DEFERRED_OUTPUT_DEFS is true.
+       * config/rs6000/aix41.h (TARGET_DEFERRED_OUTPUT_DEFS): Define.
+       * config/rs6000/aix43.h (TARGET_DEFERRED_OUTPUT_DEFS): Define.
+       * doc/tm.texi (TARGET_DEFERRED_OUTPUT_DEFS): document.
+
 2005-01-15  Ralf Corsepius  <ralf.corsepius@rtems.org>
 
        * config/mips/rtems.h (MIPS_DEFAULT_GVALUE): Set to 0.
index 373c10c22ffaca7f48c9b0fd1f9539ad341510fe..542f92841cb8cbdf8236c3b5fdb81ddeea1e7c0b 100644 (file)
@@ -98,3 +98,7 @@
 #undef RS6000_CALL_GLUE
 #define RS6000_CALL_GLUE "{cror 31,31,31|nop}"
 
+/* The IBM AIX 4.x assembler doesn't support forward references in
+   .set directives.  We handle this by deferring the output of .set
+   directives to the end of the compilation unit.  */
+#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) true
index a76e694c1ee71dca295c44f9d7acb890da4f0e8b..50bd304dd7ca818f5fa4ad8dd94a3b0737971b25 100644 (file)
@@ -187,3 +187,8 @@ do {                                                                        \
 
 #undef LD_INIT_SWITCH
 #define LD_INIT_SWITCH "-binitfini"
+
+/* The IBM AIX 4.x assembler doesn't support forward references in
+   .set directives.  We handle this by deferring the output of .set
+   directives to the end of the compilation unit.  */
+#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) true
index fff782f21bad5994de45e6c58f63db49a5659e4c..d603547952542ad72eb9de7cda1e5146f912f435 100644 (file)
@@ -139,6 +139,12 @@ do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
 #endif
 #endif
 
+/* Decide whether to defer emitting the assembler output for an equate
+   of two values.  The default is to not defer output.  */
+#ifndef TARGET_DEFERRED_OUTPUT_DEFS
+#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) false
+#endif
+
 /* This is how to output the definition of a user-level label named
    NAME, such as the label on a static function or variable NAME.  */
 
index 16d66f23f8e06ced5fdda4264c8dfef6aa4d5995..73b8ec25cb1123fbac80d7ff8eee0b0472c138be 100644 (file)
@@ -6953,6 +6953,15 @@ If @code{SET_ASM_OP} is defined, a default definition is provided which is
 correct for most systems.
 @end defmac
 
+@defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value})
+A C statement that evaluates to true if the assembler code which defines
+(equates) the symbol whose tree node is @var{decl_of_name} to have the value
+of the tree node @var{decl_of_value} should be emitted near the end of the
+current compilation unit.  The default is to not defer output of defines.
+This macro affects defines output by @samp{ASM_OUTPUT_DEF} and
+@samp{ASM_OUTPUT_DEF_FROM_DECLS}.
+@end defmac
+
 @defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
 A C statement to output to the stdio stream @var{stream} assembler code
 which defines (equates) the weak symbol @var{name} to have the value
index 655406d793993d14ea33d0396c8012fce343c60c..04f43c4f8eb80f1083051531522ed92d761edfea 100644 (file)
@@ -1860,6 +1860,9 @@ compile_file (void)
 
   dw2_output_indirect_constants ();
 
+  /* Flush any pending equate directives.  */
+  process_pending_assemble_output_defs ();
+
   if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
     {
       timevar_push (TV_DUMP);
index 58559b558564d6a4e0f9e3698e7b3a5491c8446b..7a3ec264ea469995dc3222e3c5160e44ca81d65b 100644 (file)
@@ -2982,6 +2982,7 @@ enum tls_model decl_tls_model (tree);
 extern void resolve_unique_section (tree, int, int);
 extern void mark_referenced (tree);
 extern void notice_global_symbol (tree);
+extern void process_pending_assemble_output_defs (void);
 
 /* In stmt.c */
 extern void emit_nop (void);
index 98d93fef9df9041d9d4a3ae87f1b3264ad9d134a..c3a8a2f581f7eeda13df628732ef3a8b87d7bed3 100644 (file)
@@ -4386,20 +4386,67 @@ globalize_decl (tree decl)
   (*targetm.asm_out.globalize_label) (asm_out_file, name);
 }
 
+/* Some targets do not allow a forward or undefined reference in a
+   ASM_OUTPUT_DEF.  Thus, a mechanism is needed to defer the output
+   of this assembler code.  The output_def_pair struct holds the
+   declaration and target for a deferred output define.  */
+struct output_def_pair GTY(())
+{
+  tree decl;
+  tree target;
+};
+typedef struct output_def_pair *output_def_pair;
+
+/* Variable array of deferred output defines.  */
+static GTY ((param_is (struct output_def_pair))) varray_type output_defs;
+
+#ifdef ASM_OUTPUT_DEF
+/* Output the assembler code for a define (equate) using ASM_OUTPUT_DEF
+   or ASM_OUTPUT_DEF_FROM_DECLS.  The function defines the symbol whose
+   tree node is DECL to have the value of the tree node TARGET.  */
+
+static void
+assemble_output_def (tree decl ATTRIBUTE_UNUSED, tree target ATTRIBUTE_UNUSED)
+{
+#ifdef ASM_OUTPUT_DEF_FROM_DECLS
+  ASM_OUTPUT_DEF_FROM_DECLS (asm_out_file, decl, target);
+#else
+  ASM_OUTPUT_DEF (asm_out_file,
+                 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
+                 IDENTIFIER_POINTER (target));
+#endif
+}
+#endif
+
+/* Process the varray of pending assembler defines.  */
+
+void
+process_pending_assemble_output_defs (void)
+{
+#ifdef ASM_OUTPUT_DEF
+  size_t i;
+  output_def_pair p;
+
+  for (i = 0; i < VARRAY_ACTIVE_SIZE (output_defs); i++)
+    {
+      p = VARRAY_GENERIC_PTR (output_defs, i);
+      assemble_output_def (p->decl, p->target);
+    }
+
+  output_defs = NULL;
+#endif
+}
+
 /* Emit an assembler directive to make the symbol for DECL an alias to
    the symbol for TARGET.  */
 
 void
 assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
 {
-  const char *name;
-
   /* We must force creation of DECL_RTL for debug info generation, even though
      we don't use it here.  */
   make_decl_rtl (decl, NULL);
 
-  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-
 #ifdef ASM_OUTPUT_DEF
   /* Make name accessible from other files, if appropriate.  */
 
@@ -4409,16 +4456,28 @@ assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
       maybe_assemble_visibility (decl);
     }
 
-#ifdef ASM_OUTPUT_DEF_FROM_DECLS
-  ASM_OUTPUT_DEF_FROM_DECLS (asm_out_file, decl, target);
-#else
-  ASM_OUTPUT_DEF (asm_out_file, name, IDENTIFIER_POINTER (target));
-#endif
+  if (TARGET_DEFERRED_OUTPUT_DEFS (decl, target))
+    {
+      output_def_pair p;
+
+      if (!output_defs)
+       VARRAY_GENERIC_PTR_INIT (output_defs, 10, "output defs");
+       
+      p = ggc_alloc (sizeof (struct output_def_pair));
+      p->decl = decl;
+      p->target = target;
+      VARRAY_PUSH_GENERIC_PTR (output_defs, p);
+    }
+  else
+    assemble_output_def (decl, target);
 #else /* !ASM_OUTPUT_DEF */
 #if defined (ASM_OUTPUT_WEAK_ALIAS) || defined (ASM_WEAKEN_DECL)
   if (DECL_WEAK (decl))
     {
+      const char *name;
       tree *p, t;
+
+      name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
 #ifdef ASM_WEAKEN_DECL
       ASM_WEAKEN_DECL (asm_out_file, decl, name, IDENTIFIER_POINTER (target));
 #else