summaryrefslogtreecommitdiffstats
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-07-27 05:27:28 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-07-27 05:27:28 +0000
commitb4cf14c6deb7e3ae4fdf73299d89ff00c265d187 (patch)
treee23393d57c61258cb9f8dccade53d57880dd346b /gcc/varasm.c
parenteb69adcedede4616434d522ba1242ca2ae4ac3d1 (diff)
downloadppe42-gcc-b4cf14c6deb7e3ae4fdf73299d89ff00c265d187.tar.gz
ppe42-gcc-b4cf14c6deb7e3ae4fdf73299d89ff00c265d187.zip
(assemble_variable): For array whose size comes from
the initializer, determine proper alignment here. (assemble_align): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4996 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a65d75c86cc..57024d5e157 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -666,6 +666,16 @@ assemble_zeros (size)
ASM_OUTPUT_SKIP (asm_out_file, size);
}
+/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
+
+void
+assemble_align (align)
+ int align;
+{
+ if (align > BITS_PER_UNIT)
+ ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
+}
+
/* Assemble a string constant with the specified C string as contents. */
void
@@ -971,6 +981,13 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
/* Compute and output the alignment of this data. */
align = DECL_ALIGN (decl);
+ /* In the case for initialing an array whose length isn't specified,
+ where we have not yet been able to do the layout,
+ figure out the proper alignment now. */
+ if (dont_output_data && DECL_SIZE (decl) == 0
+ && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
+ align = MAX (align, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
+
/* Some object file formats have a maximum alignment which they support.
In particular, a.out format supports a maximum alignment of 4. */
#ifndef MAX_OFILE_ALIGNMENT
OpenPOWER on IntegriCloud