re PR target/26427 (with -fsection-anchors with zero sized structs)

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
This commit is contained in:
Mike Stump 2006-06-08 22:23:17 +00:00 committed by Mike Stump
parent 07ea59afb1
commit 23f99493bc
6 changed files with 56 additions and 3 deletions

View 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

View 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

View 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 */

View 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;
}

View 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

View File

@ -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;
}