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]

[Xtensa] Handle suffixes as well as prefixes


When a compiler produces function sections of the form ".text.foo", the Xtensa gas port was producing literal sections of the form ".text.foo.literal". For some Xtensa linker scripts, this name is ambiguous, matching both .text.* and *.literal input section names.

I have committed this patch which fixes this ambiguity by producing the non-ambiguous literal section name, ".literal.foo".

Sterling

2010-02-11 Sterling Augustine <sterling@tensilica.com>

	* config/tc-xtensa.c (cache_literal_section): Handle prefixes as
	well as suffixes.

Index: tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.122
diff -u -p -c -r1.122 tc-xtensa.c
cvs diff: conflicting specifications of output style
*** tc-xtensa.c	10 Feb 2010 20:18:14 -0000	1.122
--- tc-xtensa.c	11 Feb 2010 18:57:47 -0000
*************** cache_literal_section (bfd_boolean use_a
*** 10423,10437 ****
      }
    else
      {
!       /* If the section name ends with ".text", then replace that suffix
! 	 instead of appending an additional suffix.  */
        size_t len = strlen (text_name);
!       if (len >= 5 && strcmp (text_name + len - 5, ".text") == 0)
  	len -= 5;
  
        name = xmalloc (len + strlen (base_name) + 1);
!       strcpy (name, text_name);
!       strcpy (name + len, base_name);
      }
  
    /* Canonicalize section names to allow renaming literal sections.
--- 10423,10447 ----
      }
    else
      {
!       /* If the section name begins or ends with ".text", then replace
! 	 that portion instead of appending an additional suffix.  */
        size_t len = strlen (text_name);
!       if (len >= 5
! 	  && (strcmp (text_name + len - 5, ".text") == 0
! 	      || strncmp (text_name, ".text", 5) == 0))
  	len -= 5;
  
        name = xmalloc (len + strlen (base_name) + 1);
!       if (strncmp (text_name, ".text", 5) == 0)
! 	{
! 	  strcpy (name, base_name);
! 	  strcat (name, text_name + 5);
! 	}
!       else
! 	{
! 	  strcpy (name, text_name);
! 	  strcpy (name + len, base_name);
! 	}
      }
  
    /* Canonicalize section names to allow renaming literal sections.

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