This is the mail archive of the binutils@sources.redhat.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]

[RFA:] was: Re: Graceful exit with relocatable linking (-r) when outformat != informat


Nick Clifton mentioned in a private reply that he agreed we
should fail for a relocatable link between different formats.
So here goes.  There might be exceptions, but better catch them
as we find out, than crashing for e.g. a.out-to-ELF as we do
now.

Ok to commit?

ld:
	* ldlang.c (lang_check): Emit fatal error if relocatable link
	between different object flavours.

Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.49
diff -c -p -r1.49 ldlang.c
*** ldlang.c	2001/06/08 01:58:20	1.49
--- ldlang.c	2001/06/13 23:15:28
*************** lang_check ()
*** 3500,3505 ****
--- 3500,3510 ----
  		   bfd_printable_name (input_bfd), input_bfd,
  		   bfd_printable_name (output_bfd));
  	}
+       else if (link_info.relocateable
+ 	       && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
+ 	einfo (_("%P%F: Relocatable linking from format %s (%B) to format %s (%B) is not supported"),
+ 	       bfd_get_target (input_bfd), input_bfd,
+ 	       bfd_get_target (output_bfd), output_bfd);
        else if (bfd_count_sections (input_bfd))
  	{
  	  /* If the input bfd has no contents, it shouldn't set the

brgds, H-P


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