From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.205.4 with SMTP id d4mr11201050iog.3.1471730964977; Sat, 20 Aug 2016 15:09:24 -0700 (PDT) X-Received: by 10.157.2.39 with SMTP id 36mr954791otb.3.1471730964951; Sat, 20 Aug 2016 15:09:24 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no11603090ith.0!news-out.google.com!d68ni33849ith.0!nntp.google.com!f6no11580696ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 20 Aug 2016 15:09:24 -0700 (PDT) In-Reply-To: <24d4ffc3-3915-4102-96ae-68d11d881443@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=213.108.152.51; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S NNTP-Posting-Host: 213.108.152.51 References: <24d4ffc3-3915-4102-96ae-68d11d881443@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2efe4d01-4cd4-4aea-bc54-98ea5f26ec8a@googlegroups.com> Subject: Re: Inspirels Ada on cortex tutorial linker issue From: Maciej Sobczak Injection-Date: Sat, 20 Aug 2016 22:09:24 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31470 Date: 2016-08-20T15:09:24-07:00 List-Id: > 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 er= ror reading: >=20 > program.o:(.ARM.exidx+0x0): undefined reference to '__aeabi_unwind_cpp_pr= 0' Sorry for being late to the discussion. I was able to reproduce this problem and after browsing through some thread= s on the net, I understand that the newest and greatest gcc compilers autom= atically add references to exception handling routines even in C code. Appa= rently 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 abl= e 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, bu= t 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"); =20 procedure Dummy_aeabi_unwind_cpp_pr1; pragma Export (C, Dummy_aeabi_unwind_cpp_pr1, "__aeabi_unwind_cpp_pr1"); =20 procedure Dummy_aeabi_unwind_cpp_pr0 is begin null; end Dummy_aeabi_unwind_cpp_pr0; =20 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 futur= e versions of gcc will have a nice option to switch this nuisance off. > The linker command I am using is: >=20 > 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. --=20 Maciej Sobczak * http://www.inspirel.com