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 H.J.

> > I believe that the linker should complain by default, since it will
> > catch the case where the user has mistakenly given the linker the
> > wrong kind of input files.  It does mean however that if the user does
> ^^^^^^^^
> What is the definition of "wrong"?

I meant "erroneous".  ie the user had somehow, accidentally, managed
to include a foreign object file in their list of object files to be
linked in.  There could be many causes for this - buggy makefiles, bad
linker scripts, mistyped command lines, etc.  The idea is that the
linker would catch such mistakes and issue an error message.

> All the examples I have seen so far don't look wrong to me.

But do you object to the idea of the linker being able to issue an
error message if it encounters an input file of a type it does not
recognise, and which it has not been told to expect ?

> It is an existing feature of GNU ld which people may use. In the
> testcase, I believe GNU ld produces a correct, working executable
> for the given input.

How can it ?  The example was:

  mn10300-elf-gcc -c foo.c
  gcc             -c bar.c      # native gcc
  mn10300-elf-ld  foo.o bar.o

How can an x86 object file and an mn10300 object file work in the same
executable ?


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