This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

> 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 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
both results.

> I suppose that this makes sense because:
> $ ./ --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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]