This is the mail archive of the
mailing list for the binutils project.
Re: ld won't complain if asked to link obj files of different arches
> Does linking a binary input file still work without adding the new
> command line option?
Yes and no.
% ld foo.o unknown_arch.o
ld: file format not recognized; treating as linker script
If you explicitly specify the file's input format:
% ld foo.o -b binary unknown_arch.o
it will produce a warning message, but the link works:
ld: warning: unknown architecture of input file `unknown_arch.o' is incompatible with i386 output
If you add the new command line option then the warning message goes
% ld foo.o -b binary unknown_arch.o --accept-unknown-input-format
The reason for the warning message is that although the *format* of
the input file unknown_arch.o has been set to 'binary' its
*architecture* is still 'unknown' and so the modified
bfd_arch_get_compatible() rejects it.
(Which suggests that I ought to change the name of the new switch to
The patch does not affect the .incbin directive in the assembler, so
there is no problem there.