"incompatible target" when trying Gold linker for arm-none-eabi

R. Diez via binutils binutils@sourceware.org
Tue Jun 6 13:10:00 GMT 2017


Hi all:

I am building embedded firmware with a GCC cross-compiling toolchain. I 
built the toolchain myself with this makefile of mine:

https://github.com/rdiez/JtagDue/blob/master/Toolchain/Makefile

In my local working tree (not-yet checked in), I added 
"--enable-gold=yes" to the $(BINUTILS_SRC_DIR)/configure invocation, in 
order to build the optional Gold linker.

The target architecture is "arm-none-eabi". I am compiling with 
-mcpu=cortex-m4 , which is a 32-bit microcontroller without MMU.

Because the linker takes a few seconds, even for relatively small C++ 
projects, I am trying to replace the default BFD linker with the Gold 
linker when building my firmware projects. The trouble is, I am getting 
an "incompatible target" error message.

I suppose that this makes sense because:

$ ./arm-none-eabi-ld.gold --help

[... some text removed ...]

./arm-none-eabi-ld.gold: supported targets: elf64-s390 elf32-s390 
elf64-littleaarch64 elf64-bigaarch64 elf32-littleaarch64 
elf32-bigaarch64 elf64-tradlittlemips elf32-tradlittlemips-nacl 
elf64-tradbigmips e
lf32-tradlittlemips-nacl elf32-tradlittlemips elf32-tradlittlemips-nacl 
elf32-tradbigmips elf32-tradlittlemips-nacl elf32-tilegx-be 
elf64-tilegx-be elf32-tilegx-le elf64-tilegx-le elf32-bigarm elf32-bigarm-
nacl elf32-littlearm elf32-littlearm-nacl elf64-powerpcle elf64-powerpc 
elf32-powerpcle elf32-powerpc elf64-sparc elf32-sparc elf32-x86-64 
elf32-x86-64-freebsd elf32-x86-64-nacl elf64-x86-64 elf64-x86-64-fr
eebsd elf64-x86-64-nacl elf32-iamcu elf32-i386 elf32-i386-freebsd 
elf32-i386-nacl
 

./arm-none-eabi-ld.gold: supported emulations: elf64_s390 elf32_s390 
aarch64_elf64_le_vec aarch64_elf64_be_vec aarch64_elf32_le_vec 
aarch64_elf32_be_vec elf64ltsmip elf32-tradlittlemips-nacl elf64btsmip elf
32-tradlittlemips-nacl elf32ltsmip elf32-tradlittlemips-nacl elf32btsmip 
elf32-tradlittlemips-nacl elf32tilegx_be elf64tilegx_be elf32tilegx 
elf64tilegx armelfb armelfb_nacl armelf armelf_nacl elf64lppc elf
64ppc elf32lppc elf32ppc elf64_sparc elf32_sparc elf32_x86_64 
elf32_x86_64_nacl elf_x86_64 elf_x86_64_nacl elf_iamcu elf_i386 
elf_i386_nacl


I found little documentation about Gold, it would have been nice to know 
that upfront. I gather that Gold just ignores the --target=arm-none-eabi 
I passed to Binutils' configure script, and it just builds with support 
for all targets it supports. Is that right?

I am now wondering what it would take to make Gold support the 
"arm-none-eabi" architecture. Is that not just a standard 32-bit ARM ELF 
file as far as Gold is concerned? Or is it rather the CPU I compiled for?

In my build process, there is a script that generates the .bin file from 
the .elf file later on, but that should be irrelevant when linking the 
.elf file, right? Please bear with me, as I do not know much about ELF 
files or in which way they are architecture or CPU dependent.

Please copy me on the answer, as I am not subscribed to this mailing list.

Thanks in advance,
  rdiez



More information about the Binutils mailing list