diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-23 20:02:57 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-23 20:02:57 +0000 |
commit | d0691b8b452818c49dc5277d5a39a475fc015b87 (patch) | |
tree | 7820d324d67e845b78023c85751c65923ae591a0 /gcc/config/darwin.c | |
parent | e3c4abfb798fb3d16e1e9da09e4def0d9b8a577c (diff) | |
download | gcc-d0691b8b452818c49dc5277d5a39a475fc015b87.tar.gz |
PR target/33120
* config/darwin.h (ASM_OUTPUT_ALIGNED_BSS): Add.
* config/darwin.c (darwin_output_aligned_bss): Add.
* config/darwin-protos.h: Add darwin_output_aligned_bss.
testsuite:
* g++.dg/ext/instantiate2.C: Update for .zerofill as it doesn't
follow the usual conventions for symbol definitions.
* gcc.target/i386/darwin-zerofill.c: Add.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157677 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/darwin.c')
-rw-r--r-- | gcc/config/darwin.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 101da9305c7..da12c057ca9 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1788,5 +1788,41 @@ darwin_patch_builtins (void) #undef PATCH_BUILTIN_VARIADIC } +void +darwin_output_aligned_bss(FILE *fp, tree decl, const char *name, + unsigned HOST_WIDE_INT size, unsigned int align) +{ + bool weak = (DECL_P (decl) + && DECL_WEAK (decl) + && !lookup_attribute ("weak_import", + DECL_ATTRIBUTES (decl))); + if (size == 0) + size = 1; + align = floor_log2 (align / BITS_PER_UNIT); + if (DECL_ONE_ONLY (decl) || weak) { + if (TREE_READONLY (decl) || TREE_CONSTANT (decl)) + switch_to_section (darwin_sections[const_data_coal_section]); + else + switch_to_section (darwin_sections[data_coal_section]); + ASM_OUTPUT_ALIGN (fp, align); + ASM_DECLARE_OBJECT_NAME (fp, name, decl); + ASM_OUTPUT_SKIP (fp, size); + return; + } + + fputs (".zerofill ", fp); + /* We uniquely name sections based upon the alignment as otherwise + all symbols in the section would get that alignment. */ + if (TREE_READONLY (decl) || TREE_CONSTANT (decl)) + fputs ("__TEXT, ", fp); + else + fputs ("__DATA, ", fp); + fprintf (fp, "__bss%d, ", align); + assemble_name (fp, name); + fprintf (fp, ", "HOST_WIDE_INT_PRINT_UNSIGNED", %u\n", + size, align); + (* targetm.encode_section_info) (decl, DECL_RTL (decl), false); + machopic_define_symbol (DECL_RTL (decl)); +} #include "gt-darwin.h" |