summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-23 20:02:57 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-23 20:02:57 +0000
commitd0691b8b452818c49dc5277d5a39a475fc015b87 (patch)
tree7820d324d67e845b78023c85751c65923ae591a0 /gcc
parente3c4abfb798fb3d16e1e9da09e4def0d9b8a577c (diff)
downloadgcc-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')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/darwin-protos.h3
-rw-r--r--gcc/config/darwin.c36
-rw-r--r--gcc/config/darwin.h3
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/ext/instantiate2.C3
-rw-r--r--gcc/testsuite/gcc.target/i386/darwin-zerofill.c9
7 files changed, 67 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bd919224658..0d5f1a568a2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-23 Mike Stump <mikestump@comcast.net>
+
+ 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.
+
2010-03-23 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/43413
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index b9865ccd4ee..5675044df7a 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -90,3 +90,6 @@ extern void darwin_asm_output_anchor (rtx symbol);
extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
extern void darwin_patch_builtins (void);
+extern void darwin_output_aligned_bss (FILE *, tree, const char *,
+ unsigned HOST_WIDE_INT size,
+ unsigned int align);
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"
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 763040bfe4c..ca32669353b 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -728,6 +728,9 @@ int darwin_label_is_anonymous_local_objc_name (const char *name);
} \
} while (0)
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+ darwin_output_aligned_bss(FILE, DECL, NAME, SIZE, ALIGN)
+
/* The maximum alignment which the object file format can support in
bits. For Mach-O, this is 2^15 bytes. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e01b7ad5a1f..4dd6d086ed6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-23 Mike Stump <mikestump@comcast.net>
+
+ PR target/33120
+ * 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.
+
2010-03-22 Jason Merrill <jason@redhat.com>
PR c++/43333
diff --git a/gcc/testsuite/g++.dg/ext/instantiate2.C b/gcc/testsuite/g++.dg/ext/instantiate2.C
index 97ef45c874d..02a54fee1c6 100644
--- a/gcc/testsuite/g++.dg/ext/instantiate2.C
+++ b/gcc/testsuite/g++.dg/ext/instantiate2.C
@@ -8,7 +8,8 @@ template <class T> struct A {
template <class T> T A<T>::t = 0;
static template struct A<int>;
-// { dg-final { scan-assembler "\n_?_ZN1AIiE1tE(:|\n|\t)" } }
+// { dg-final { scan-assembler "\n_?_ZN1AIiE1tE(:|\n|\t)" { target { ! *-apple-darwin* } } } }
+// { dg-final { scan-assembler ".zerofill __DATA, __bss2, __ZN1AIiE1tE" { target *-apple-darwin* } } }
void test_int() { A<int>::t = 42; }
// { dg-final { scan-assembler-not "\n_?_ZN1AIcE1tE(:|\n|\t)" } }
diff --git a/gcc/testsuite/gcc.target/i386/darwin-zerofill.c b/gcc/testsuite/gcc.target/i386/darwin-zerofill.c
new file mode 100644
index 00000000000..73221347a9c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/darwin-zerofill.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target i?86-apple-darwin* x86_64-apple-darwin* } } */
+/* { dg-options "-fno-common" } */
+
+/* { dg-final { scan-assembler ".zerofill __DATA, __bss11, _ji, 4000000, 11" } } */
+/* { dg-final { scan-assembler ".zerofill __TEXT, __bss8, _cj, 4000000, 8" } } */
+/* PR33120 */
+
+int ji[1000000] __attribute((aligned(2048)));
+const int cj[1000000] __attribute((aligned(256)));