> Part of the problem why it isn't put there by gcc 4.7 because the
> initializer is not a bss_initializer_p initializer. And this is
> because GNAT explicitly disables this in misc.c:
>
> /* Initialize options structure OPTS.  */
>
> static void
> gnat_init_options_struct (struct gcc_options *opts)
> {
>   /* Uninitialized really means uninitialized in Ada.  */
>   opts->x_flag_zero_initialized_in_bss = 0;
> }

Are you sure?  There should be no initializer, i.e. DECL_INITIAL == NULL_TREE.

The flag_zero_initialized_in_bss thing looks orthogonal to me.

> However, if the above code is removed (i.e.
> flag_zero_initialized_in_bss == 1, the default),
> categorize_decl_for_section returns SECCAT_BSS for BigArray, but the
> variable is still not put in .bss. This is because there is no special
> TARGET_ASM_SELECT_SECTION for Tru64, so default_select_section is
> called and it returns data_section.
>
> But at that point, bss_section==NULL anyway, because
> BSS_SECTION_ASM_OP is not defined for Tru64, even though ECOFF does
> support BSS sections.
>
> So I think that to fix this "properly" (and assumibng , support for
> .bss should be added to Tru64 by defining BSS_SECTION_ASM_OP, and
> implementing TARGET_ASM_SELECT_SECTION.

If the assembler does have a BSS_SECTION_ASM_OP, which isn't clear.  But we had 
a patch in our tree to work around this and which did something equivalent.
Attached.  We never submitted it because it introduced regressions in C++ IIRC.

> The same happens for rs6000-ibm-aix6.1, which also doesn't have
> BSS_SECTION_ASM_OP, even though there should be BSS support for XCOFF
> (http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.
>files%2Fdoc%2Faixfiles%2FXCOFF.htm).

That's certainly more annoying on AIX than on Tru64.

-- 
Eric Botcazou
diff --git a/gcc/config/alpha/osf5.h b/gcc/config/alpha/osf5.h
index facc89e..816031e 100644
--- a/gcc/config/alpha/osf5.h
+++ b/gcc/config/alpha/osf5.h
@@ -21,6 +21,26 @@ along with GCC; see the file COPYING3.  If not see
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT	(MASK_FPREGS | MASK_LONG_DOUBLE_128)
 
+/* This says how to output assembler code to declare an uninitialized
+   internal linkage data object.  */
+#undef ASM_OUTPUT_ALIGNED_LOCAL
+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
+do { 									\
+  fputs ("\t.lcomm ", (FILE));						\
+  assemble_name ((FILE), (NAME));					\
+  fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED, (SIZE));		\
+  fprintf ((FILE), ",%d\n", exact_log2 ((ALIGN) / BITS_PER_UNIT));	\
+} while (0)
+
+/* This says how to output assembler code to declare an uninitialized
+   external linkage data object.  According to the Tru64 5.1 assembler
+   manual, .lcomm works for global objects too.  */
+#undef ASM_OUTPUT_ALIGNED_BSS
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
+do {									\
+  ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);			\
+} while (0)
+
 /* In Tru64 UNIX V5.1, Compaq introduced a new assembler
    (/usr/lib/cmplrs/cc/adu) which currently (versions between 3.04.29 and
    3.04.32) breaks mips-tfile.  Passing the undocumented -oldas flag reverts

Reply via email to