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: ld won't complain if asked to link obj files of different arches

Hi Alan,

> Does linking a binary input file still work without adding the new
> command line option?

Yes and no.

For example:

  % ld foo.o unknown_arch.o

will produce:

  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
be --accept-unknown-input-architecture).

The patch does not affect the .incbin directive in the assembler, so
there is no problem there.


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