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]

[patch] ARM EABI attribute merging


The patch below fixes some bugs in the merging of ARM EABI object attributes.
After merging the first set of attributes we were marking the input as 
initialised, not the output. There are also a couple of attributes where 
the "don't care" value wasn't being handled properly.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-10-28  Paul Brook  <paul@codesourcery.com>
	Julian Brown  <julian@codesourcery.com>

	bfd/
	* elf32-arm.c (copy_eabi_attributes): Correct starting offset.
	(elf32_arm_merge_eabi_attributes): Mark output as initialized.
	Only set Tag_CPU_name and Tag_ABI_PCS_R9_use if input attribute
	is present.

Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.70.2.15
diff -c -p -r1.70.2.15 elf32-arm.c
*** bfd/elf32-arm.c	5 Sep 2006 16:25:47 -0000	1.70.2.15
--- bfd/elf32-arm.c	13 Oct 2006 15:40:17 -0000
*************** copy_eabi_attributes (bfd *ibfd, bfd *ob
*** 5997,6004 ****
    aeabi_attribute_list *list;
    int i;
  
!   in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes;
!   out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
    for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
      {
        out_attr->i = in_attr->i;
--- 6000,6007 ----
    aeabi_attribute_list *list;
    int i;
  
!   in_attr = &elf32_arm_tdata (ibfd)->known_eabi_attributes[4];
!   out_attr = &elf32_arm_tdata (obfd)->known_eabi_attributes[4];
    for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
      {
        out_attr->i = in_attr->i;
*************** elf32_arm_merge_eabi_attributes (bfd *ib
*** 6129,6145 ****
    static const int order_312[3] = {3, 1, 2};
    int i;
  
!   if (!elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i)
      {
        /* This is the first object.  Copy the attributes.  */
        copy_eabi_attributes (ibfd, obfd);
        return TRUE;
      }
  
-   /* Use the Tag_null value to indicate the attributes have been
-      initialized.  */
-   elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i = 1;
- 
    in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes;
    out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
    /* This needs to happen before Tag_ABI_FP_number_model is merged.  */
--- 6132,6149 ----
    static const int order_312[3] = {3, 1, 2};
    int i;
  
!   if (!elf32_arm_tdata (obfd)->known_eabi_attributes[0].i)
      {
        /* This is the first object.  Copy the attributes.  */
        copy_eabi_attributes (ibfd, obfd);
+ 
+       /* Use the Tag_null value to indicate the attributes have been
+ 	 initialized.  */
+       elf32_arm_tdata (obfd)->known_eabi_attributes[0].i = 1;
+ 
        return TRUE;
      }
  
    in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes;
    out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
    /* This needs to happen before Tag_ABI_FP_number_model is merged.  */
*************** elf32_arm_merge_eabi_attributes (bfd *ib
*** 6164,6171 ****
  	{
  	case Tag_CPU_raw_name:
  	case Tag_CPU_name:
! 	  /* Use whichever has the greatest architecture requirements.  */
! 	  if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i)
  	    out_attr[i].s = attr_strdup(obfd, in_attr[i].s);
  	  break;
  
--- 6168,6178 ----
  	{
  	case Tag_CPU_raw_name:
  	case Tag_CPU_name:
! 	  /* Use whichever has the greatest architecture requirements.  We
! 	     won't necessarily have both the above tags, so make sure input
! 	     name is non-NULL.  */
! 	  if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i
! 	      && in_attr[i].s)
  	    out_attr[i].s = attr_strdup(obfd, in_attr[i].s);
  	  break;
  
*************** elf32_arm_merge_eabi_attributes (bfd *ib
*** 6217,6223 ****
  	    }
  	  break;
  	case Tag_ABI_PCS_R9_use:
! 	  if (out_attr[i].i != AEABI_R9_unused
  	      && in_attr[i].i != AEABI_R9_unused)
  	    {
  	      _bfd_error_handler
--- 6224,6231 ----
  	    }
  	  break;
  	case Tag_ABI_PCS_R9_use:
! 	  if (in_attr[i].i != out_attr[i].i
! 	      && out_attr[i].i != AEABI_R9_unused
  	      && in_attr[i].i != AEABI_R9_unused)
  	    {
  	      _bfd_error_handler


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