incongruency in architecture mismatch linker warnings/errors

Doug Evans dje@transmeta.com
Mon Jan 20 20:12:00 GMT 2003


It's odd that if the architectures (or mach's) are incompatible during
a relocatable link it's automatically an error whereas in a final link
it's only a warning and then only if the user asks for it.

Is there any reasoning behind this?

ldlang.c:

      if ((link_info.relocateable || link_info.emitrelocations)
	  && (compatible == NULL
	      || bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
	  && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0)
	{
	  einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"),
		 bfd_get_target (input_bfd), input_bfd,
		 bfd_get_target (output_bfd), output_bfd);
	  /* einfo with %F exits.  */
	}

      if (compatible == NULL)
	{
	  if (command_line.warn_mismatch)
	    einfo (_("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n"),
		   bfd_printable_name (input_bfd), input_bfd,
		   bfd_printable_name (output_bfd));
	}

[the comment above this code refers to mixing formats, but that's
not the context of this discussion which is mixing different mach's]

Plus, it would be extremely useful if the first error message
included the printable names (for the `compatible == NULL' case).

Perhaps the thing to do is split up the first `if' into two,
one for `compatible == NULL' and another for
`bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd)'.



More information about the Binutils mailing list