From 265a000dbbb824228a757d81c1887ccea41acc5d Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Mon, 6 Sep 2010 09:27:55 +0000 Subject: [PATCH] fix libobjc ppc64 abi for darwin. libobjc: * encoding.c: Add TARGET_ALIGN_NATURAL definition for m64 powerpc darwin. Add a comment as to why, update FIXME comments. testsuite: * objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Update XFAILs. From-SVN: r163906 --- gcc/testsuite/ChangeLog | 5 +++++ .../struct-layout-encoding-1_generate.c | 2 +- libobjc/ChangeLog | 5 +++++ libobjc/encoding.c | 15 +++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3d92fcbd68..c077339b2a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-09-06 Iain Sandoe + + * objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: + Update XFAILs. + 2010-09-06 Alexander Monakov PR rtl-optimization/44919 diff --git a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c index 361cf7a2e43..3ac4179c047 100644 --- a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c +++ b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c @@ -236,7 +236,7 @@ switchfiles (int fields) || filecnt == 22) { fprintf (outfile, "\ -/* { dg-do run { xfail powerpc*-*-darwin* powerpc*-*-aix* } } */\n\ +/* { dg-do run { xfail { { \"powerpc*-*-darwin*\" && { ! lp64 } } || { \"powerpc*-*-aix*\" } } } } */\n\ /* { dg-options \"-w -I%s -fgnu-runtime\" } */\n", srcdir); } /* FIXME: these should not be xfailed but they are because diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 763420edb3e..c82b08d5d90 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,8 @@ +2010-09-06 Iain Sandoe + + * encoding.c: Add TARGET_ALIGN_NATURAL definition for m64 powerpc darwin. + Add a comment as to why, update FIXME comments. + 2010-09-06 Nicola Pero * makefile.dos: Obsolete file removed. diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 4ae29a769c1..c743d865e17 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -105,13 +105,24 @@ static int __attribute__ ((__unused__)) not_target_flags = 0; #undef ALTIVEC_VECTOR_MODE #define ALTIVEC_VECTOR_MODE(MODE) (0) +/* Furthermore, some (powerpc) targets also use TARGET_ALIGN_NATURAL + in their alignment macros. Currently[4.5/6], rs6000.h points this + to a static variable, initialized by target overrides. This is reset + in linux64.h but not in darwin64.h. The macro is not used by *86*. */ + +#if __MACH__ && __LP64__ +# undef TARGET_ALIGN_NATURAL +# define TARGET_ALIGN_NATURAL 1 +#endif /* FIXME: while this file has no business including tm.h, this definitely has no business defining this macro but it is only way around without really rewritting this file, - should look after the branch of 3.4 to fix this. */ + should look after the branch of 3.4 to fix this. + FIXME1: It's also out of date, darwin no longer has the same alignment + 'special' as aix - this is probably the origin of the m32 breakage. */ #define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \ - ({ const char *_fields = TYPE_FIELDS (STRUCT); \ + ({ const char *_fields = TYPE_FIELDS (STRUCT); \ ((_fields != 0 \ && TYPE_MODE (strip_array_types (TREE_TYPE (_fields))) == DFmode) \ ? MAX (MAX (COMPUTED, SPECIFIED), 64) \