diff options
author | Richard Stallman <rms@gnu.org> | 1993-07-27 05:27:28 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-07-27 05:27:28 +0000 |
commit | a785e67e7bd8d20a3200eddb1d6d53996ab17e4f (patch) | |
tree | e23393d57c61258cb9f8dccade53d57880dd346b /gcc | |
parent | e5075818720b781f7da518311bfa0f9f3cf33572 (diff) | |
download | gcc-a785e67e7bd8d20a3200eddb1d6d53996ab17e4f.zip gcc-a785e67e7bd8d20a3200eddb1d6d53996ab17e4f.tar.gz gcc-a785e67e7bd8d20a3200eddb1d6d53996ab17e4f.tar.bz2 |
(assemble_variable): For array whose size comes from the initializer, determine proper alignment here.
(assemble_variable): For array whose size comes from
the initializer, determine proper alignment here.
(assemble_align): New function.
From-SVN: r4996
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/varasm.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index a65d75c..57024d5 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 |