From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Inspirels Ada on cortex tutorial linker issue
Date: Sat, 20 Aug 2016 15:09:24 -0700 (PDT)
Date: 2016-08-20T15:09:24-07:00 [thread overview]
Message-ID: <2efe4d01-4cd4-4aea-bc54-98ea5f26ec8a@googlegroups.com> (raw)
In-Reply-To: <24d4ffc3-3915-4102-96ae-68d11d881443@googlegroups.com>
> I am able to compile the program from the "First Program" chapter of the tutorial without errors, but when I attempt to link the program I get an error reading:
>
> program.o:(.ARM.exidx+0x0): undefined reference to '__aeabi_unwind_cpp_pr0'
Sorry for being late to the discussion.
I was able to reproduce this problem and after browsing through some threads on the net, I understand that the newest and greatest gcc compilers automatically add references to exception handling routines even in C code. Apparently there *might* be some obscure integration cases where this automatic injection can help (especially in those projects that mix C and C++), but it is a pity that the "feature" is unconditional. Or at least I was not able to find any option to switch it off.
In any case, I was able to solve the problem by adding the following in any .adb file (for the first program example you can add it to program.adb, but I would recommend moving it to utils.adb or even to some additional file, created only for this purpose):
procedure Dummy_aeabi_unwind_cpp_pr0;
pragma Export (C, Dummy_aeabi_unwind_cpp_pr0, "__aeabi_unwind_cpp_pr0");
procedure Dummy_aeabi_unwind_cpp_pr1;
pragma Export (C, Dummy_aeabi_unwind_cpp_pr1, "__aeabi_unwind_cpp_pr1");
procedure Dummy_aeabi_unwind_cpp_pr0 is
begin
null;
end Dummy_aeabi_unwind_cpp_pr0;
procedure Dummy_aeabi_unwind_cpp_pr1 is
begin
null;
end Dummy_aeabi_unwind_cpp_pr1;
That's it. These procedures will never be called in a pure Ada program, but they make the linker happy. Yes, it'd kind of silly, and I hope that future versions of gcc will have a nice option to switch this nuisance off.
> The linker command I am using is:
>
> ld -T flash.ld -o program.elf program.o
This command will still work if you put the code above in program.adb, for example after the Run procedure.
--
Maciej Sobczak * http://www.inspirel.com
next prev parent reply other threads:[~2016-08-20 22:09 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-23 5:23 Inspirels Ada on cortex tutorial linker issue Devin
2016-07-23 6:57 ` Simon Wright
2016-07-23 7:34 ` Devin
2016-07-23 8:07 ` Devin
2016-07-23 16:32 ` Simon Wright
2016-07-24 2:32 ` Devin
2016-07-24 7:41 ` Simon Wright
2016-07-25 4:35 ` Devin
2016-07-25 8:07 ` Simon Wright
2016-08-20 22:09 ` Maciej Sobczak [this message]
2016-08-21 1:30 ` Devin
2016-08-21 1:37 ` Devin
2016-08-21 14:38 ` Maciej Sobczak
2016-08-22 4:00 ` Devin
2016-08-22 11:37 ` Brian Drummond
2016-08-29 17:49 ` Nicholas Colin Paul de Gloucester
2016-08-29 21:51 ` rieachus
2016-08-30 14:55 ` Nicolas Colin Paul de Gloucester
2016-08-31 0:01 ` Dennis Lee Bieber
2016-08-31 10:15 ` Simon Wright
2016-08-31 12:42 ` Maciej Sobczak
2016-09-01 9:15 ` Alejandro R. Mosteo
2016-09-01 16:33 ` AdaMagica
2016-09-02 0:36 ` Jeffrey R. Carter
2016-09-02 12:05 ` Maciej Sobczak
2016-09-02 12:53 ` Dmitry A. Kazakov
2016-09-02 15:24 ` G.B.
2016-09-02 21:33 ` Maciej Sobczak
2016-09-03 9:20 ` G.B.
2016-09-03 13:33 ` Alejandro R. Mosteo
2016-09-04 15:08 ` Maciej Sobczak
2016-09-02 13:40 ` AdaMagica
2016-09-03 11:58 ` Brian Drummond
2016-09-03 12:12 ` Björn Lundin
2016-08-30 12:33 ` Brian Drummond
2016-08-30 13:01 ` Simon Wright
2016-08-30 15:06 ` Nicolas Colin Paul de Gloucester
2016-08-31 10:34 ` Brian Drummond
2016-08-31 20:58 ` Simon Wright
2016-09-01 11:08 ` Brian Drummond
2016-08-31 12:47 ` Maciej Sobczak
2016-09-01 0:02 ` Dennis Lee Bieber
2016-09-01 9:03 ` Alejandro R. Mosteo
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox