I'm building a simple program for ARM. GPRbuild outputs the following:
gprbuild -p -P avocado_test.gpr (in directory: /home/rodeo/Projects/AvocadoTest)
Bind
[gprbind] run_avocado_test.bexch
[Ada] run_avocado_test.ali
Link
[link] run_avocado_test.adb
/opt/GNAT/arm-elf/bin/arm-eabi-ld: unrecognised emulation mode: cpu=cortex-m3
Supported emulations: armelf
gprbuild: link of run_avocado_test.adb failed
Compilation failed.
From what I could find online, ld
has a switch -m
which specifies an emulation mode. However, I am not using this switch in the linker of my project. I am using the -mcpu=cortex-m3
switch in the compiler, though, and it looks like somehow GPRbuild is passing this switch to the linker as well. Here is my .gpr
file:
project Avocado_Test is
for Source_Dirs use ("source");
for Object_Dir use "build";
for Main use ("source/run_avocado_test.adb");
for Target use "arm-eabi";
for Runtime ("Ada") use "ravenscar-sfp-sam3x8e";
package Builder is
for Executable_Suffix use ".elf";
for Switches ("Ada") use ("-j0");
end Builder;
package Compiler is
for Driver ("Ada") use "arm-eabi-gcc";
for Switches ("Ada") use (
"-mthumb",
"-mcpu=cortex-m3",
"-O2");
end Compiler;
package Binder is
for Driver ("Ada") use "arm-eabi-gnatbind";
end Binder;
package Linker is
for Driver use "arm-eabi-ld";
end Linker;
end Avocado_Test;
Why is the linker taking a switch from the compiler? How do I prevent this?
Linker'Driver
attribute results in some different errors which are from a library I've built. Looks like I need to look at my runtime.xml file and perhaps rebuild the library as well, since the compiler and linker packages look similar in that project. Thanks for the idea. – RodeoLinker'Required_Switches
attribute. This file and runtime are generated from Adacore's bb-runtimes. It doesn't make any sense, why on earth would compiler switches be appended to the linker switches? – Rodeold
-- one should always use the compiler driver (arm-eabi-gcc
here) instead. – Employed Russian