It has been noticed that the 2.7.0 version of gnu-objc will not
produce a working copy of libobjects on linux. The problem appears to
be with the function construction functions (__builtin_return and its
compatriots) which are used by part of the gnu objc library. It is
not a problem with just libobjects or the Objc compiler; the behavior
is provoked by the attached c program.
Along with the sample c code, you will find assembly listings for
testd.c compiled under 2.6.3 and 2.7.0. The 2.6.3 vesion works; the
2.7.0 version causes a floating point exception message to be printed.
You will note that the 2.6.3 version contains an 'fldz' instruction
after the call to the routine tt; the 2.7.0 assembly does not.
It is unclear to me where this problem is coming from since it has
also been reported that it does not exist under various releases of
netbsd on Intel hardware. I would assume that the compiler produces
much the same instruction sequence on this platfrom as on Linux, so it
may be that the fp error is not trapped by the netbsd implementation.
In any case, I am firing this message at the gcc, objc, and Linux
community in the hopes that someone will be able to resolve it. For
the moment, if you wish to run with the 2.7.0 compiler on Linux I
suggest you use a 2.6.3 compiled libobjc. I've done this and it
appears to be OK.
Thanx,
Al
=======================================================================
= Allan Clearwaters Phone: 44+(684)569292 =
= MCT Ltd. Fax: 44+(684)561153 =
= 62 Albert Rd. North Email: al...@mct.co.uk =
= Malvern, Worcs. =
= England WR14 2TL =
=======================================================================
---------------------------- testd.c ------------------------------
/*
Allan Clearwaters, MCT. Ltd., Malvern, England
This is a small test file that demostrates the "Floatingpoint Execption" problem
that is currently a feature of gnuobjc-2.7.0 on Linux.
Environment:
i486 with 16 meg running Linux 1.2.11
gcc-2.7.0 and gcc-2.6.3 configured for i486-linuxaout
Command line:
gcc -o testd testd.c
*/
#include <stdio.h>
static void tt( void )
{
printf( "\nin tt\n");
fflush( stdout );
{
int size;
void *ptr1;
__builtin_return( __builtin_apply( aFunc,
__builtin_apply_args(),0 ));
{
int i;
test( tt );
exit(0);
.file "testd.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
LC0:
.ascii "\12in tt\12\0"
.align 4
_tt:
pushl %ebp
movl %esp,%ebp
pushl $LC0
call _printf
addl $4,%esp
pushl $__IO_stdout_
call _fflush
addl $4,%esp
L1:
movl %ebp,%esp
popl %ebp
ret
.align 4
.globl _test
_test:
pushl %ebp
movl %esp,%ebp
subl $128,%esp
pushl %esi
pushl %ebx
leal 8(%ebp),%eax
movl %eax,-12(%ebp)
leal -12(%ebp),%eax
movl (%eax),%eax
movl %esp,%ebx
movl %esp,%eax
movl 8(%ebp),%esi
call *%esi
fldz
movl %eax,-128(%ebp)
movl %edx,-124(%ebp)
fstpt -120(%ebp)
movl %ebx,%esp
leal -128(%ebp),%ecx
movl (%ecx),%eax
movl 4(%ecx),%edx
fldt 8(%ecx)
fstp %st(0)
jmp L2
.align 4,0x90
L2:
leal -136(%ebp),%esp
popl %ebx
popl %esi
movl %ebp,%esp
popl %ebp
ret
.align 4
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
call ___main
pushl $_tt
call _test
addl $4,%esp
pushl $0
call _exit
addl $4,%esp
.align 4,0x90
L3:
movl %ebp,%esp
popl %ebp
ret
------------------- assembly listing for gcc-2.7.0 ---------------------
.file "testd.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
LC0:
.ascii "\12in tt\12\0"
.align 4
_tt:
pushl %ebp
movl %esp,%ebp
pushl $LC0
call _printf
addl $4,%esp
pushl $__IO_stdout_
call _fflush
addl $4,%esp
L1:
movl %ebp,%esp
popl %ebp
ret
.align 4
.globl _test
_test:
pushl %ebp
movl %esp,%ebp
subl $140,%esp
pushl %esi
pushl %ebx
movl %eax,-20(%ebp)
movl %edx,-16(%ebp)
movl %ecx,-12(%ebp)
leal 8(%ebp),%eax
movl %eax,-24(%ebp)
leal -24(%ebp),%ecx
movl (%ecx),%eax
movl %esp,%ebx
movl %esp,%edx
movl 4(%ecx),%eax
movl 8(%ecx),%edx
movl 12(%ecx),%ecx
movl 8(%ebp),%esi
call *%esi
movl %eax,-140(%ebp)
movl %edx,-136(%ebp)
fstpt -132(%ebp)
movl %ebx,%esp
leal -140(%ebp),%ecx
movl (%ecx),%eax
movl 4(%ecx),%edx
fldt 8(%ecx)
fstp %st(0)
jmp L2
.align 4,0x90
L2:
leal -148(%ebp),%esp
popl %ebx
popl %esi
movl %ebp,%esp
popl %ebp
ret
.align 4
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
call ___main
pushl $_tt
call _test
addl $4,%esp
pushl $0
call _exit
addl $4,%esp
.align 4,0x90
L3:
movl %ebp,%esp
popl %ebp
ret
--
=======================================================================
= Allan Clearwaters Phone: 44+(684)569292 =
= MCT Ltd. Fax: 44+(684)561153 =
= 62 Albert Rd. North Email: al...@mct.co.uk =
= Malvern, Worcs. =
= England WR14 2TL =
=======================================================================