This is the mail archive of the
mailing list for the binutils project.
Re: "incompatible target" when trying Gold linker for arm-none-eabi
- From: Cary Coutant <ccoutant at gmail dot com>
- To: "R. Diez" <rdiezmail-binutils at yahoo dot de>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 6 Jun 2017 17:40:13 -0700
- Subject: Re: "incompatible target" when trying Gold linker for arm-none-eabi
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
> 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.
This just indicates that gold found an object file whose target
architecture doesn't match the architecture of the object files
preceding it on the command line. It's hard to diagnose the problem
without more information. If you're calling gcc for the link step,
please add "-Wl,-t" to the options, and post the results. If you're
calling ld.gold directly for the link step, please add the "-t"
option, and post the entire command line and the results. Please also
run "readelf -h" on the first file listed in the "-t" output, and also
on the file named in the "incompatible target" error message, and post
> I suppose that this makes sense because:
> $ ./arm-none-eabi-ld.gold --help
> [... some text removed ...]
> 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?
All the configure process cares about in the target triple is the
"arm". That should have configured gold with arm as the default target
architecture. The rest is ignored.
> 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?
As long as it's the EABI, I think it should be fine, but I'm not
familiar enough with ARM to know whether "arm-none-eabi" requires any
special handling that gold might not support. That, by itself, though,
shouldn't have caused your "incompatible target" error.
> 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.
Yes, that should be irrelevant.