Bug#566234: [mips only] /usr/lib/libgnarl-4.4.so: undefined reference to `__gnat_alternate_stack'
Hi,
I can reproduce the bug by using a qemu MIPS image [1]. Thanks to
Aurélien Jarno for providing these images.
The reproducer is simple:
procedure Alternate is
task Test;
task body Test is
begin
null;
end;
begin
null;
end Alternate;
reet@debian-mips:~/reproducers$ gnatmake alternate.adb
gcc-4.4 -c alternate.adb
gnatbind -x alternate.ali
gnatlink alternate.ali
/usr/lib/gcc/mips-linux-gnu/4.4.3/../../../../lib/libgnarl-4.4.so:
undefined reference to `__gnat_alternate_stack'
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc-4.4
gnatmake: *** link failed.
The 'Test' task in the reproducer is just there to trigger linkage with
GNARL.
On MIPS, the reference to '__gnat_alternate_stack' in libgnarl cannot be
resolved:
/$ objdump -t /usr/lib/debug/usr/lib/libgnarl-4.4.so.1 | grep
__gnat_alternate_stack
00000000 *UND* 00000000 __gnat_alternate_stack
/$ objdump -t /usr/lib/debug/usr/lib/libgnat-4.4.so.1 | grep
__gnat_alternate_stack
/$
On amd64, '__gnat_alternate_stack' is provided in the bss of libgnat:
~$ objdump -t /usr/lib/debug/usr/lib/libgnarl-4.4.so.1 | grep
__gnat_alternate_stack
0000000000000000 *UND* 0000000000000000 __gnat_alternate_stack
~$ objdump -t /usr/lib/debug/usr/lib/libgnat-4.4.so.1 | grep
__gnat_alternate_stack
0000000000520f80 g O .bss 0000000000004000 __gnat_alternate_stack
The question is why '__gnat_alternate_stack' is not in the bss segment
of libgnat on MIPS. The following #ifdef combination in gcc/ada/init.c
looks suspicious:
#elif defined (linux) && (defined (i386) || defined (__x86_64__) \
|| defined (__ia64__) || defined (__powerpc__))
...
#if defined (i386) || defined (__x86_64__)
char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
#endif
...
#endif
So gcc/ada/init.c does not provide '__gnat_alternate_stack' when
compiled on MIPS, but s-osinte-linux.ads (which is linked into libgnarl)
imports it. There seems to be some inconsistency about whether the
alternate signal stack should be used on MIPS or not ...
- reto
[1] - http://people.debian.org/~aurel32/qemu/mips/
Reply to: