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]
Other format: [Raw text]

Re: LD and ARM interworking


Hi Dave,

> I have a problem with an arm-elf targetted tool chain I'm buildling with
> respect to interworking. I've been attempting to figure out how to turn off
> the interworking warning when linking objects that only contain data since
> this makes no sense when there is no code to interwork. I'm using the
> release source tarballs of binutils 2.14, gcc 3.3.3 & newlib 1.12.0.
>
> In the course of this I've discovered that LD has a serious issue with the
> mixing of the two types of object. It appears that if one object has the
> interworking flag set then the output elf gets that flag set. This results
> in warnings about blah.o does not support interworking, whereas blah.elf
> does.
>
> When the intention was to compile an executable with interworking code, this
> is correct. However, when the intention was for non-interworking code, this
> behaviour is wrong. It appears that LD will *never* produce the opposite
> warning 'blah.o supports interworking, whereas blah.elf does not'
>
> Is there a way of specifying that the intent is to link only objects
> containing non-interworking code and produce the correct warnings for that
> case when interworked objects are linked in error?

Not at the moment no, but patches can always be developed.  For
example for the one appended below.  Would you care to try it and see
if it works ?

Cheers
        Nick

2004-03-09  Nick Clifton  <nickc@redhat.com>

	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Skip most checks
	if the input bfd does not contain any code.

Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.120
diff -c -3 -p -r1.120 elf32-arm.h
*** bfd/elf32-arm.h	23 Jan 2004 16:51:48 -0000	1.120
--- bfd/elf32-arm.h	9 Mar 2004 12:32:00 -0000
*************** elf32_arm_merge_private_bfd_data (ibfd, 
*** 2430,2452 ****
       not, its flags may not have been initialised either, but it
       cannot actually cause any incompatibility.  Do not short-circuit
       dynamic objects; their section list may be emptied by
!      elf_link_add_object_symbols.  */
  
    if (!(ibfd->flags & DYNAMIC))
      {
        bfd_boolean null_input_bfd = TRUE;
  
        for (sec = ibfd->sections; sec != NULL; sec = sec->next)
  	{
  	  /* Ignore synthetic glue sections.  */
  	  if (strcmp (sec->name, ".glue_7")
  	      && strcmp (sec->name, ".glue_7t"))
! 	    {
! 	      null_input_bfd = FALSE;
! 	      break;
! 	    }
  	}
!       if (null_input_bfd)
  	return TRUE;
      }
  
--- 2430,2460 ----
       not, its flags may not have been initialised either, but it
       cannot actually cause any incompatibility.  Do not short-circuit
       dynamic objects; their section list may be emptied by
!      elf_link_add_object_symbols.
  
+      Also check to see if there are no code sections in the input.
+      In this case there is no need to check for code specific flags.
+      XXX - do we need to worry about floating-point format compatability
+      in data sections ?  */
    if (!(ibfd->flags & DYNAMIC))
      {
        bfd_boolean null_input_bfd = TRUE;
+       bfd_boolean only_data_sections = TRUE;
  
        for (sec = ibfd->sections; sec != NULL; sec = sec->next)
  	{
  	  /* Ignore synthetic glue sections.  */
  	  if (strcmp (sec->name, ".glue_7")
  	      && strcmp (sec->name, ".glue_7t"))
! 	    null_input_bfd = FALSE;
! 
! 	  if ((bfd_get_section_flags (sec->owner, sec)
! 	       & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
! 	      == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
! 	    only_data_sections = FALSE;
  	}
! 
!       if (null_input_bfd || only_data_sections)
  	return TRUE;
      }
  


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