This is the mail archive of the binutils@sourceware.org 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: undefined reference when mixing a.out and ELF object files ?


Hi Vincent,

The problem is something like this.
a.o is an ELF object file containing an undefined symbol
b.o is an a.out object file defining the symbol.

If the ld output format is ELF, the link success.
If the ld output format is a.out or "binary", the link fails with "undefined reference".


If I convert b.o to ELF using objcopy, the link succeed in every case.

That sounds like a bug... or maybe I'm trying to make an unsupported mix?

It is probably an unsupported mix. There are quite a few cases already where the linker cannot handle converting being object file formats at the same time as performing a final link. The safest method is to convert b.o to ELF first and then link it with a.o second.


The only real bug in this case is that the linker should be detecting an attempt to link-and-convert for a combination that it does not support and then issuing an appropriate error message.

Cheers
  Nick



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