Bug 47717 - building library for arm-none-eabi causes internal error
Summary: building library for arm-none-eabi causes internal error
Status: CLOSED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.6.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-13 13:26 UTC by Luke A. Guest
Modified: 2011-03-22 00:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Minimal library project (326 bytes, application/x-gtar)
2011-02-13 13:26 UTC, Luke A. Guest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke A. Guest 2011-02-13 13:26:17 UTC
Created attachment 23325 [details]
Minimal library project

I have built a version of GNAT from svn trunk targetted at bare metal arm-none-eabi. I know this isn't supported, but I've managed to do it using some patches. The entire project can be found here:

https://github.com/Lucretia/tamp

The problem is, when building the stripped down RTS, I'm getting the following:

Creating RTS with GCC-svn-trunk for 'beagle' board
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/boards/beagle/system.ads
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/a-unccon.ads
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/s-maccod.ads
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/interfac.ads
arm-none-eabi-gcc -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/gnat.ads
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/a-uncdea.ads
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/s-stoele.adb
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/s-atacco.adb
arm-none-eabi-gcc -gnatpg -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/ada.ads
arm-none-eabi-gcc -c -gnat2005 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/beagle -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/g-souinf.ads
Exception name: SYSTEM.ASSERTIONS.ASSERT_FAILURE
Message: namet.adb:655

arm-none-eabi-gnatmake: INTERNAL ERROR. Please report.

I've also managed to re-create the error using the attached minimal files - extract to the tamp directory:

PATH=/opt/tamp/bin:$PATH LD_LIBRARY_PATH=/opt/tamp/lib64:$LD_LIBRARY_PATH arm-none-eabi-gnatmake -vP2 --RTS=../rts/boards/beagle -Ptest.gpr

obviously, modify PATH & LD_LIBRARY_PATH to where-ever you compiled the cross compilers to.
Comment 1 Luke A. Guest 2011-03-16 14:30:36 UTC
Further debugging gives:

$ gdb --args /home/laguest/opt/tamp/bin/gnatmake --RTS=`pwd`/boards/beagle -XBoard=beagle -Pgnat.gpr -cargs -###
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/laguest/opt/tamp/bin/gnatmake...done.
(gdb) catch exception
Catchpoint 1: all Ada exceptions
(gdb) r
Starting program: /home/laguest/opt/tamp/bin/gnatmake --RTS=/home/laguest/src/mine/tamp/rts/boards/beagle -XBoard=beagle -Pgnat.gpr -cargs -\#\#\#

Catchpoint 1, SYSTEM.ASSERTIONS.ASSERT_FAILURE at 0x00000000004050dd in <__gnat_raise_nodefer_with_msg> (e=0x859c60) at ../rts/a-except.adb:858
858	      Debug_Raise_Exception (E => SSL.Exception_Data_Ptr (E));
(gdb) bt
#0  <__gnat_debug_raise_exception> (e=0x859c60) at s-except.adb:43
#1  0x00000000004050dd in <__gnat_raise_nodefer_with_msg> (e=0x859c60) at ../rts/a-except.adb:858
#2  0x0000000000405148 in <__gnat_raise_exception> (e=0x859c60, message=Asked for position 0 of stack, stack only has 0 elements on it.
) at ../rts/a-except.adb:898
#3  0x00000000005a613a in system.assertions.raise_assert_failure (msg=Asked for position 0 of stack, stack only has 0 elements on it.
) at s-assert.adb:46
#4  0x00000000004c2f7c in namet.get_name_string (id=300000000) at /home/laguest/src/mine/tamp/thirdparty/src/gcc-4_6-branch/gcc/ada/namet.adb:655
#5  0x00000000004c0e12 in mlib.utl.lib_directory () at /home/laguest/src/mine/tamp/thirdparty/src/gcc-4_6-branch/gcc/ada/mlib-utl.adb:636
#6  0x00000000004ae1a6 in mlib.prj.build_library (in_tree=0xc07bb0, gnatbind=..., gnatbind_path=..., gcc=..., gcc_path=..., link=true)
    at /home/laguest/src/mine/tamp/thirdparty/src/gcc-4_6-branch/gcc/ada/mlib-prj.adb:1545
#7  0x0000000000484e7f in make.gnatmake () at /home/laguest/src/mine/tamp/thirdparty/src/gcc-4_6-branch/gcc/ada/make.adb:5651
#8  0x000000000045dea5 in gnatmake () at /home/laguest/src/mine/tamp/thirdparty/src/gcc-4_6-branch/gcc/ada/gnatmake.adb:38
(gdb)
Comment 2 Luke A. Guest 2011-03-16 15:36:47 UTC
On further investigation it seems that gnatmake cannot create a libgnat.a from a GPR file as it is itself looking for a libgnat, which fails causing the internal compiler error.

This bug is not specific to ARM, it would apply equally to this kind of configuration (i.e. custom runtime) on any platform.
Comment 3 Arnaud Charlet 2011-03-21 08:05:55 UTC
This error is specific to your set up/build procedures, which isn't a standard set up, so not supported by the FSF compiler. I suspect you'll need to change your procedures here.
Comment 4 Luke A. Guest 2011-03-21 11:05:38 UTC
(In reply to comment #3)
> This error is specific to your set up/build procedures, which isn't a standard
> set up, so not supported by the FSF compiler. I suspect you'll need to change
> your procedures here.

I have, I just build the RTS using a makefile. This RTS is then used via the --RTS flag and I can build libraries with a GPR file now.

Luke.
Comment 5 Luke A. Guest 2011-03-21 11:34:10 UTC
(In reply to comment #3)
> This error is specific to your set up/build procedures, which isn't a standard
> set up, so not supported by the FSF compiler. I suspect you'll need to change
> your procedures here.

Just so we know, should it be possible to build libgnat.a using a project file via gnatmake?

Thanks,
Luke.
Comment 6 charlet@adacore.com 2011-03-21 14:44:20 UTC
> Just so we know, should it be possible to build libgnat.a using a project file
> via gnatmake?

No, project files aren't designed to do that out of the box, libgnat.a is
a special library.

Arno
Comment 7 Luke A. Guest 2011-03-22 00:13:13 UTC
Thanks, that's the conclusion I came to.

Luke.