* [Patch libobjc] Fix Darwin32 PPC struct size foo.
@ 2010-12-10 19:18 IainS
2010-12-10 19:21 ` Nicola Pero
2010-12-10 23:50 ` Mike Stump
0 siblings, 2 replies; 8+ messages in thread
From: IainS @ 2010-12-10 19:18 UTC (permalink / raw)
To: GCC Patches; +Cc: Nicola Pero
[-- Attachment #1: Type: text/plain, Size: 519 bytes --]
this reached the top of the TODO...
... It is understood that the scheme in use is non-ideal -
- but, given that we are not going to change it this side of 4.7 ...
this makes Darwin work with the existing design (so both m32 & m64 are
OK with GNU runtime).
OK for trunk?
Iain
libobjc:
* encoding.c (_darwin_rs6000_special_round_type_align): New.
(darwin_rs6000_special_round_type_align): Adjust to use new routine.
testsuite:
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Adjust
XFAILs.
[-- Attachment #2: 167684-libobjc-ppc-darwin.txt --]
[-- Type: text/plain, Size: 3828 bytes --]
Index: libobjc/encoding.c
===================================================================
--- libobjc/encoding.c (revision 167684)
+++ libobjc/encoding.c (working copy)
@@ -117,29 +117,56 @@ static int __attribute__ ((__unused__)) not_target
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
+#if __MACH__
+# if __LP64__
+# undef TARGET_ALIGN_NATURAL
+# define TARGET_ALIGN_NATURAL 1
+# endif
+
+/* On Darwin32, we need to recurse until we find the starting stuct type. */
+static int
+_darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec)
+{
+ const char *_stp , *_fields = TYPE_FIELDS (struc);
+ if (!_fields)
+ return MAX (comp, spec);
+ _stp = strip_array_types (_fields);
+ if (TYPE_MODE(_stp) == _C_COMPLEX)
+ _stp++;
+ switch (TYPE_MODE(_stp))
+ {
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ return MAX (MAX (comp, spec), objc_alignof_type (_stp) * BITS_PER_UNIT);
+ break;
+ case DFmode:
+ case _C_LNG_LNG:
+ case _C_ULNG_LNG:
+ return MAX (MAX (comp, spec), 64);
+ break;
+
+ default:
+ return MAX (comp, spec);
+ break;
+ }
+}
+
+/* See comment below. */
+#define darwin_rs6000_special_round_type_align(S,C,S2) \
+ (_darwin_rs6000_special_round_type_align ((char*)(S), (int)(C), (int)(S2)))
#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.
- 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. */
+ should look after the branch of 3.4 to fix this. */
#define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \
({ const char *_fields = TYPE_FIELDS (STRUCT); \
((_fields != 0 \
&& TYPE_MODE (strip_array_types (TREE_TYPE (_fields))) == DFmode) \
? MAX (MAX (COMPUTED, SPECIFIED), 64) \
: MAX (COMPUTED, SPECIFIED));})
-/* FIXME: The word 'fixme' is insufficient to explain the wrong-ness
- of this next macro definition. */
-#define darwin_rs6000_special_round_type_align(S,C,S2) \
- rs6000_special_round_type_align(S,C,S2)
-
/* Skip a variable name, enclosed in quotes ("). */
static inline
const char *
Index: gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c
===================================================================
--- gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c (revision 167684)
+++ gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c (working copy)
@@ -221,9 +221,9 @@ switchfiles (int fields)
fputs ("failed to create test files\n", stderr);
exit (1);
}
- /* FIXME: these tests should not be xfailed on PowerPC darwin or aix
- but they are because libobjc uses GCC's headers for trying to find
- the struct layout but it gets it wrong. */
+ /* FIXME: these tests should not be xfailed on aix but they are because
+ libobjc uses GCC's headers for trying to find the struct layout but it
+ gets it wrong. */
if (filecnt == 2
|| filecnt == 3
|| filecnt == 4
@@ -236,7 +236,7 @@ switchfiles (int fields)
|| filecnt == 22)
{
fprintf (outfile, "\
-/* { dg-do run { xfail { { \"powerpc*-*-darwin*\" && { ! lp64 } } || { \"powerpc*-*-aix*\" } } } } */\n\
+/* { dg-do run { xfail { \"powerpc*-*-aix*\" } } } */\n\
/* { dg-options \"-w -I%s -fgnu-runtime\" } */\n", srcdir);
}
/* FIXME: these should not be xfailed but they are because
[-- Attachment #3: Type: text/plain, Size: 3 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-10 19:18 [Patch libobjc] Fix Darwin32 PPC struct size foo IainS
@ 2010-12-10 19:21 ` Nicola Pero
2010-12-10 19:45 ` Andrew Pinski
2010-12-10 23:50 ` Mike Stump
1 sibling, 1 reply; 8+ messages in thread
From: Nicola Pero @ 2010-12-10 19:21 UTC (permalink / raw)
To: IainS; +Cc: GCC Patches
> this makes Darwin work with the existing design (so both m32 & m64 are
> OK with GNU runtime).
>
> OK for trunk?
OK for the libobjc side - ie, for the unfortunate but inevitable approach
of just hacking in "a fix" using the existing framework for 4.6. ;-)
The actual change is very Darwin-specific, so I think a Darwin maintainer needs
to OK it too.
Thanks
PS: please replace 'stuct' with 'struct' in the following comment before commit ;-) --
+/* On Darwin32, we need to recurse until we find the starting stuct type. */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-10 19:21 ` Nicola Pero
@ 2010-12-10 19:45 ` Andrew Pinski
2010-12-10 20:02 ` IainS
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Pinski @ 2010-12-10 19:45 UTC (permalink / raw)
To: Nicola Pero; +Cc: IainS, GCC Patches
On Fri, Dec 10, 2010 at 10:57 AM, Nicola Pero
<nicola.pero@meta-innovation.com> wrote:
>
>> this makes Darwin work with the existing design (so both m32 & m64 are
>> OK with GNU runtime).
>>
>> OK for trunk?
>
> OK for the libobjc side - ie, for the unfortunate but inevitable approach
> of just hacking in "a fix" using the existing framework for 4.6. ;-)
Yes this is just a hack. I did have a branch (which I have not
updated in awhile) to fix this hackier really.
-- Pinski
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-10 19:45 ` Andrew Pinski
@ 2010-12-10 20:02 ` IainS
0 siblings, 0 replies; 8+ messages in thread
From: IainS @ 2010-12-10 20:02 UTC (permalink / raw)
To: Andrew Pinski; +Cc: Nicola Pero, GCC Patches
On 10 Dec 2010, at 19:18, Andrew Pinski wrote:
> On Fri, Dec 10, 2010 at 10:57 AM, Nicola Pero
> <nicola.pero@meta-innovation.com> wrote:
>>
>>> this makes Darwin work with the existing design (so both m32 & m64
>>> are
>>> OK with GNU runtime).
>>>
>>> OK for trunk?
>>
>> OK for the libobjc side - ie, for the unfortunate but inevitable
>> approach
>> of just hacking in "a fix" using the existing framework for 4.6. ;-)
>
> Yes this is just a hack. I did have a branch (which I have not
> updated in awhile) to fix this hackier really.
Well, this doesn't increase the hack-factor (it simply makes the
existing hack work on another target).
we're all agreed on the need for change :-)
AFAIU, we don't think that a new ABI is feasible within 4.6 - so
rather than have another broken release, one might as well have a fix.
cheers
Iain
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-10 19:18 [Patch libobjc] Fix Darwin32 PPC struct size foo IainS
2010-12-10 19:21 ` Nicola Pero
@ 2010-12-10 23:50 ` Mike Stump
1 sibling, 0 replies; 8+ messages in thread
From: Mike Stump @ 2010-12-10 23:50 UTC (permalink / raw)
To: IainS; +Cc: GCC Patches, Nicola Pero
On Dec 10, 2010, at 10:22 AM, IainS wrote:
> this makes Darwin work with the existing design (so both m32 & m64 are OK with GNU runtime).
>
> OK for trunk?
Ok.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-12 15:05 Dominique Dhumieres
@ 2010-12-12 15:22 ` Nicola Pero
2010-12-12 15:22 ` IainS
0 siblings, 1 reply; 8+ messages in thread
From: Nicola Pero @ 2010-12-12 15:22 UTC (permalink / raw)
To: Dominique Dhumieres; +Cc: gcc-patches
> The only remaining failure on both ppc/intel is
>
> FAIL: objc.dg/exceptions-2.m -fnext-runtime (test for excess errors)
>
> with -m64.
Could you provide more information on the problem ? ie, what does objc.log say ? :-)
I'm sometime frustrated by seeing errors reported on the automated test
environments (eg, the recent failures of ObjC fast enumeration reported at
runtime on gnu/linux suse 64-bit) without being able to see any minimal
information on what the error actually is.
Are there any plans to encourage testers to make testsuite log files automatically
available with the test results ? :-)
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
2010-12-12 15:22 ` Nicola Pero
@ 2010-12-12 15:22 ` IainS
0 siblings, 0 replies; 8+ messages in thread
From: IainS @ 2010-12-12 15:22 UTC (permalink / raw)
To: Nicola Pero; +Cc: Dominique Dhumieres, gcc-patches
On 12 Dec 2010, at 12:32, Nicola Pero wrote:
>
>> The only remaining failure on both ppc/intel is
>>
>> FAIL: objc.dg/exceptions-2.m -fnext-runtime (test for excess errors)
>>
>> with -m64.
>
> Could you provide more information on the problem ? ie, what does
> objc.log say ? :-)
I'm on the case .. (a bit slow, domestic commitments at the moment )...
AFAIR, the m64 ABI does not support sjlj exceptions..
Iain
Executing on host: /Volumes/ScratchCS/gcc-4-6-trunk-build/gcc/xgcc -B/
Volumes/ScratchCS/gcc-4-6-trunk-build/gcc/ /GCC/gcc-live-trunk/gcc/
testsuite/objc.dg/exceptions-2.m -fnext-runtime -fobjc-exceptions -B/
Volumes/ScratchCS/gcc-4-6-trunk-build/i686-apple-darwin9/x86_64/
libobjc/.libs -L/Volumes/ScratchCS/gcc-4-6-trunk-build/i686-apple-
darwin9/x86_64/libobjc/.libs /GCC/gcc-live-trunk/gcc/testsuite/
objc.dg/../objc-obj-c++-shared/Object1.m -lobjc -m64 -o ./
exceptions-2.exe (timeout = 60)
Undefined symbols:
"_objc_exception_try_exit", referenced from:
_test in ccu08jHK.o
"_objc_exception_extract", referenced from:
_test in ccu08jHK.o
_test in ccu08jHK.o
"_objc_exception_try_enter", referenced from:
_test in ccu08jHK.o
_test in ccu08jHK.o
"_objc_exception_match", referenced from:
_test in ccu08jHK.o
ld: symbol(s) not found
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch libobjc] Fix Darwin32 PPC struct size foo.
@ 2010-12-12 15:05 Dominique Dhumieres
2010-12-12 15:22 ` Nicola Pero
0 siblings, 1 reply; 8+ messages in thread
From: Dominique Dhumieres @ 2010-12-12 15:05 UTC (permalink / raw)
To: gcc-patches
I have posted at http://gcc.gnu.org/ml/gcc-testresults/2010-12/msg01004.html
the results with this patch applied. It works as advertised!
The only remaining failure on both ppc/intel is
FAIL: objc.dg/exceptions-2.m -fnext-runtime (test for excess errors)
with -m64. There also some XPASS
objc.dg-struct-layout-encoding-1/t026_main.m on both ppc/intel and -m32/64,
XPASS: objc.dg-struct-layout-encoding-1/t030_main.m execution test
XPASS: objc.dg-struct-layout-encoding-1/t031_main.m execution test
on ppc both -m32/64 and
XPASS: objc.dg-struct-layout-encoding-1/t025_main.m execution test
XPASS: objc.dg-struct-layout-encoding-1/t027_main.m execution test
XPASS: objc.dg-struct-layout-encoding-1/t028_main.m execution test
XPASS: objc.dg-struct-layout-encoding-1/t029_main.m execution test
on ppc -m64.
Thanks,
Dominique
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-12-12 12:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10 19:18 [Patch libobjc] Fix Darwin32 PPC struct size foo IainS
2010-12-10 19:21 ` Nicola Pero
2010-12-10 19:45 ` Andrew Pinski
2010-12-10 20:02 ` IainS
2010-12-10 23:50 ` Mike Stump
2010-12-12 15:05 Dominique Dhumieres
2010-12-12 15:22 ` Nicola Pero
2010-12-12 15:22 ` IainS
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).