This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
darwin aligned .comm support
- From: mrs at apple dot com (Mike Stump)
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Mar 2007 12:25:04 -0700 (PDT)
- Subject: darwin aligned .comm support
Darwin now has aligned .comm support, so, we can now take advantage of
it on darwin9. We also fix MAX_OFILE_ALIGNMENT as it was expressed
incorrectly in bytes before.
Checked into mainline and 4.2.
2007-03-28 Mike Stump <mrs@apple.com>
* config/darwin9.h (ASM_OUTPUT_ALIGNED_COMMON): Add.
* config/darwin.h (MAX_OFILE_ALIGNMENT): Fix.
* config/rs6000/darwin.h (ASM_OUTPUT_ALIGNED_COMMON): Removed #undef.
2007-03-28 Mike Stump <mrs@apple.com>
* gcc.dg/darwin-comm.c: Add.
Doing diffs in .:
--- ./config/darwin.h.~1~ 2007-03-20 19:04:46.000000000 -0700
+++ ./config/darwin.h 2007-03-28 18:11:08.000000000 -0700
@@ -674,11 +674,11 @@ extern GTY(()) int darwin_ms_struct;
} \
} while (0)
-/* The maximum alignment which the object file format can support.
- For Mach-O, this is 2^15. */
+/* The maximum alignment which the object file format can support in
+ bits. For Mach-O, this is 2^15 bytes. */
#undef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT 0x8000
+#define MAX_OFILE_ALIGNMENT (0x8000 * 8)
/* Declare the section variables. */
#ifndef USED_FOR_TARGET
--- ./config/darwin9.h.~1~ 2007-02-02 21:30:14.000000000 -0800
+++ ./config/darwin9.h 2007-03-28 18:09:17.000000000 -0700
@@ -20,3 +20,14 @@
/* The linker can generate branch islands. */
#define DARWIN_LINKER_GENERATES_ISLANDS 1
+
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
+ do { \
+ unsigned HOST_WIDE_INT _new_size = (SIZE); \
+ fprintf ((FILE), ".comm "); \
+ assemble_name ((FILE), (NAME)); \
+ if (_new_size == 0) _new_size = 1; \
+ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
+ _new_size, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
+ } while (0)
--- config/rs6000/darwin.h.~1~ 2007-03-27 19:32:28.000000000 -0700
+++ config/rs6000/darwin.h 2007-03-29 08:31:25.000000000 -0700
@@ -242,8 +242,6 @@
/* This says how to output an assembler line to define a global common
symbol. */
-/* ? */
-#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
do { \
unsigned HOST_WIDE_INT _new_size = SIZE; \
--- ./testsuite/gcc.dg/darwin-comm.c.~1~ 2007-03-28 18:38:39.000000000 -0700
+++ ./testsuite/gcc.dg/darwin-comm.c 2007-03-28 18:31:51.000000000 -0700
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-darwin9* } } */
+/* { dg-final { scan-assembler ".comm _foo,1,15" } } */
+
+char foo __attribute__ ((aligned(32768)));
--------------