This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada in gcc-3.4.3 on x86_64
- From: "Dean Kolosiek" <kolosiekweb04 at qwest dot net>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 03 Jan 2005 03:30:04 -0700
- Subject: Re: Ada in gcc-3.4.3 on x86_64
I followed the build instructions at http://gcc.gnu.org/install/build.html
which does not mention make -C gcc gnatlib_and_tools
That worked, and I reproduced a problem I saw in 3.3.3. When calling
a C function from Ada there is no code generated to set %al to the number
of xmm registers being passed. Variadic C functions use %al to compute a
jump into a table of movaps instructions to save the xmm registers. The
result is a jump to a random location.
The Ada I see it in is from the GtkAda package, gtk_generates.adb. The
declaration is
function Widget_New
(T : Glib.GType; Addr : System.Address := System.Null_Address)
return System.Address;
pragma Import (C, Widget_New, "gtk_widget_new");
The instructions generated for a call to gtk_widget_new, after a previous
function call, are:
call gtk_window_get_type
xorl %esi, %esi
movq %rax, %rdi
call gtk_widget_new
At this point %al is the lowest byte of %rax, the return value of the
previous function call. (%rax is also being used to set the first parameter
to gtk_widget_new in %rdi.)
This is code generated at the top of a variadic C function which uses %al
to compute a jump: void variadic (int a, ...)
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
subq $72, %rsp
.LCFI2:
movq %rsi, -168(%rbp)
movq %rdx, -160(%rbp)
movq %rcx, -152(%rbp)
movq %r8, -144(%rbp)
movq %r9, -136(%rbp)
movzbl %al, %eax
movq %rax, -192(%rbp)
movq -192(%rbp), %rdx
leaq 0(,%rdx,4), %rax
movq $.L2, -192(%rbp)
subq %rax, -192(%rbp)
leaq -1(%rbp), %rax
movq -192(%rbp), %rdx
jmp *%rdx
movaps %xmm7, -15(%rax)
movaps %xmm6, -31(%rax)
movaps %xmm5, -47(%rax)
movaps %xmm4, -63(%rax)
movaps %xmm3, -79(%rax)
movaps %xmm2, -95(%rax)
movaps %xmm1, -111(%rax)
movaps %xmm0, -127(%rax)
.L2:
movl %edi, -180(%rbp)
> > Add --enable-languages=c,c++,ada,g77 and make sure that you have an
> > Ada compiler installed since such is needed for bootstrapping,
>
> More specifically, he should follow the documentation and call
> make -C gcc gnatlib_and_tools (was needed with GCC 3.4, is no longer
> needed with 4.0).
>
> Arno