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] Don't pass incorrect pointer in arm_build_one_stub


Hi,

This patch passes the hash for a symbol from which a stub entry was
derived, not the hash for the stub entry itself, to
elf32_arm_final_link_relocate. This fixes a potential incorrect code
generation issue (not seen on mainline so far, AFAIK). In practice,
there will be no symbols for the stubs in question, so the value passed
should always be NULL (though a non-NULL value would be passed prior to
this patch, which could cause elf32_arm_final_link_relocate to get
confused).

(Thanks to Doug for noticing this on mainline.)

OK to apply?

Julian

ChangeLog

        bfd/
        * elf32-arm.c (arm_build_one_stub): Use the hash entry of the
        symbol a stub entry is derived from, not the entry for the stub
        itself, in call to elf32_arm_final_link_relocate.
? bfd/elf32-arm.c-partially-fixed
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.203
diff -c -p -r1.203 elf32-arm.c
*** bfd/elf32-arm.c	1 Jul 2009 14:48:26 -0000	1.203
--- bfd/elf32-arm.c	10 Jul 2009 12:41:41 -0000
*************** arm_build_one_stub (struct bfd_hash_entr
*** 3549,3554 ****
--- 3549,3557 ----
  	     branch.  */
  	  points_to = sym_value;
  
+ 	/* There may be unintended consequences if this is not true.  */
+ 	BFD_ASSERT (stub_entry->h == NULL);
+ 
  	/* Note: _bfd_final_link_relocate doesn't handle these relocations
  	   properly.  We should probably use this function unconditionally,
  	   rather than only for certain relocations listed in the enclosing
*************** arm_build_one_stub (struct bfd_hash_entr
*** 3557,3563 ****
  	    (template[stub_reloc_idx[i]].r_type),
  	  stub_bfd, info->output_bfd, stub_sec, stub_sec->contents, &rel,
  	  points_to, info, stub_entry->target_section, "", sym_flags,
! 	  (struct elf_link_hash_entry *) stub_entry, &unresolved_reloc,
  	  &error_message);
        }
      else
--- 3560,3566 ----
  	    (template[stub_reloc_idx[i]].r_type),
  	  stub_bfd, info->output_bfd, stub_sec, stub_sec->contents, &rel,
  	  points_to, info, stub_entry->target_section, "", sym_flags,
! 	  (struct elf_link_hash_entry *) stub_entry->h, &unresolved_reloc,
  	  &error_message);
        }
      else

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