re PR target/26427 (with -fsection-anchors with zero sized structs)
authorMike Stump <mrs@apple.com>
Thu, 8 Jun 2006 22:23:17 +0000 (22:23 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Thu, 8 Jun 2006 22:23:17 +0000 (22:23 +0000)
PR target/26427
* config/darwin.c (darwin_asm_output_anchor): Disable
-fsection-anchors on darwin for now.
* config/darwin.h (TARGET_ASM_OUTPUT_ANCHOR): Likewise.
* rs6000/rs6000.c (optimization_options): Likewise.

testsuite:
* gcc.dg/pr26427.c: Test to ensure that -fsection-anchors doesn't
produce bad code on darwin.

From-SVN: r114498

gcc/ChangeLog
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr26427.c [new file with mode: 0644]

index ca5851cc2559df7ffe5dd460b110b94d3fc67625..ce53bb296270dda410bd56461e98a66ab2fbd7a1 100644 (file)
@@ -1,3 +1,11 @@
+2006-06-08  Mike Stump  <mrs@apple.com>
+
+       PR target/26427
+       * config/darwin.c (darwin_asm_output_anchor): Disable
+       -fsection-anchors on darwin for now.
+       * config/darwin.h (TARGET_ASM_OUTPUT_ANCHOR): Likewise.
+       * rs6000/rs6000.c (optimization_options): Likewise.
+
 2006-06-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR target/27421
index 5ffe744ef78ec6e21203037ca4fb88e59102d781..541b772a7a462d955fb0f2987bee323247a88958 100644 (file)
@@ -1524,6 +1524,8 @@ darwin_binds_local_p (tree decl)
   return default_binds_local_p_1 (decl, 0);
 }
 
+#if 0
+/* See TARGET_ASM_OUTPUT_ANCHOR for why we can't do this yet.  */
 /* The Darwin's implementation of TARGET_ASM_OUTPUT_ANCHOR.  Define the
    anchor relative to ".", the current section position.  We cannot use
    the default one because ASM_OUTPUT_DEF is wrong for Darwin.  */
@@ -1536,6 +1538,7 @@ darwin_asm_output_anchor (rtx symbol)
   fprintf (asm_out_file, ", . + " HOST_WIDE_INT_PRINT_DEC "\n",
           SYMBOL_REF_BLOCK_OFFSET (symbol));
 }
+#endif
 
 /* Set the darwin specific attributes on TYPE.  */
 void
index dcfab427bdc090913eba3cc0b8104712a8b0d7bc..941f60b357d5ac38925d0d450de130fe80b877fa 100644 (file)
@@ -812,8 +812,6 @@ enum machopic_addr_class {
        goto DONE;                                                                      \
       }
 
-#define TARGET_ASM_OUTPUT_ANCHOR darwin_asm_output_anchor
-
 /* Experimentally, putting jump tables in text is faster on SPEC.
    Also this is needed for correctness for coalesced functions.  */
 
@@ -852,6 +850,7 @@ void add_framework_path (char *);
 #define TARGET_POSIX_IO
 
 /* All new versions of Darwin have C99 functions.  */
+
 #define TARGET_C99_FUNCTIONS 1
 
 #define WINT_TYPE "int"
@@ -859,7 +858,20 @@ void add_framework_path (char *);
 /* Every program on darwin links against libSystem which contains the pthread
    routines, so there's no need to explicitly call out when doing threaded
    work.  */
+
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS ""
 
+/* Darwin can't support anchors until we can cope with the adjustments
+   to size that ASM_DECLARE_OBJECT_NAME and ASM_DECLARE_CONSTANT_NAME
+   when outputting members of an anchor block and the linker can be
+   taught to keep them together or we find some other suitable
+   code-gen technique.  */
+
+#if 0
+#define TARGET_ASM_OUTPUT_ANCHOR darwin_asm_output_anchor
+#else
+#define TARGET_ASM_OUTPUT_ANCHOR NULL
+#endif
+
 #endif /* CONFIG_DARWIN_H */
index 3a8e78a7f18098e43c191746557f2e50692b3533..dd41f62a59c068e697633478b8fec977acd4e50e 100644 (file)
@@ -1633,7 +1633,7 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
   /* Enable section anchors by default.
      Skip section anchors for Objective C and Objective C++
      until front-ends fixed.  */
-  if (lang_hooks.name[4] != 'O')
+  if (!TARGET_MACHO && lang_hooks.name[4] != 'O')
     flag_section_anchors = 1;
 }
 
index 53c280a0dbf3514ce00bc497814c5d2b02c3a667..344a9f072aec63bac10cae6e8bef713cf59aa7af 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-08  Mike Stump  <mrs@apple.com>
+
+       PR target/26427
+       * gcc.dg/pr26427.c: Test to ensure that -fsection-anchors doesn't
+       produce bad code on darwin.
+
 2006-06-08  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        PR fortran/27958
diff --git a/gcc/testsuite/gcc.dg/pr26427.c b/gcc/testsuite/gcc.dg/pr26427.c
new file mode 100644 (file)
index 0000000..3077221
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-warning "this target does not support" } */
+/* { dg-do run { target { *-*-darwin* } } } */
+/* { dg-options { -fsection-anchors -O } } */
+/* PR target/26427 */
+
+struct a {};
+static const int d = 1;
+static const struct a b = {};
+static const int c = 1;
+int f(const int *, const struct a *, const int*, const int*);
+
+int g(void) {
+  return f(&c, &b, &d, &c);
+}
+
+int f(const int *b, const struct a *c, const int *d, const int *e) {
+  return *b == *d;
+}
+
+int main(void) {
+  if (!g())
+    __builtin_abort();
+  return 0;
+}