This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: Appropriate place to add a check against linking object file formats of a given flavour


Hi Mike,

: I'm trying to fixup the alpha-gnulinux linker so that it gives a
: reasonable error message when the user is attempting to link ELF
: objects with ECOFF (as compared to the core dump that you now get due
: to the elf tdata field being incorrect).  I find I'm flailing around
: trying to patch the leak.  The bfd_arch_get_compatible function seems
: to be a reaonable place, but I find most of the bfd structure has not
: been set up when it is called (xvec in particular).  I also tried
: putting the error in bfd_merge_private_data, but ldlang ignores all
: bfd errors at that point.  So any thoughts of the proper place to put
: this check, or even better, points to code that already does it.

I have a similar problem with the ARM ELF targets, although in my case
it is not possible to change the output format whilst linking.  (I
have never actually tried linking together different input formats at
the same time).  Anyway the solution I canme up with was to put an
error message into {emul}_after_open() like this:

  if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
    {
      /* The arm backend needs special fields in the output hash structure.
	 These will only be created if the output format is an arm format,
	 hence we do not support linking and changing output formats at the
	 same time.  Use a link followed by objcopy to change output formats.  */
      einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
      return;
    }

I am not sure if this will work in your case, but I thought that I
would mention it.

Cheers
	Nick

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