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]

Re: Committed: Fix MN10300 linker relaxation against non-section merged symbols


Hi Alan,

I think you need one more tweak.  See the "location of interest"
comment in elf32-ppc.c.

Ah, thanks - I was unaware of that particular nuance. I have applied this patch to take this into account.


Cheers
  Nick

binutils/ChangeLog
2009-06-29  Nick Clifton  <nickc@redhat.com>

	* elf-m10300.c (mn10300_elf_relax_section): Allow for the
	different uses of the relocations addend when a symbol is in a
	merged section.
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.98
diff -c -3 -p -r1.98 elf-m10300.c
*** bfd/elf-m10300.c	25 Jun 2009 15:36:45 -0000	1.98
--- bfd/elf-m10300.c	29 Jun 2009 11:54:12 -0000
*************** mn10300_elf_relax_section (bfd *abfd,
*** 2783,2793 ****
  	  if ((sym_sec->flags & SEC_MERGE)
  	      && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
  	    {
! 	      symval = isym->st_value + irel->r_addend;
  	      symval = _bfd_merged_section_offset (abfd, & sym_sec,
  						   elf_section_data (sym_sec)->sec_info,
  						   symval);
! 	      symval += sym_sec->output_section->vma + sym_sec->output_offset - irel->r_addend;
  	    }
  	  else
  	    symval = (isym->st_value
--- 2783,2812 ----
  	  if ((sym_sec->flags & SEC_MERGE)
  	      && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
  	    {
! 	      symval = isym->st_value;
! 
! 	      /* GAS may reduce relocations against symbols in SEC_MERGE
! 		 sections to a relocation against the section symbol when
! 		 the original addend was zero.  When the reloc is against
! 		 a section symbol we should include the addend in the
! 		 offset passed to _bfd_merged_section_offset, since the
! 		 location of interest is the original symbol.  On the
! 		 other hand, an access to "sym+addend" where "sym" is not
! 		 a section symbol should not include the addend;  Such an
! 		 access is presumed to be an offset from "sym";  The
! 		 location of interest is just "sym".  */
! 	      if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
! 		symval += irel->r_addend;
! 
  	      symval = _bfd_merged_section_offset (abfd, & sym_sec,
  						   elf_section_data (sym_sec)->sec_info,
  						   symval);
! 
! 	      if (ELF_ST_TYPE (isym->st_info) != STT_SECTION)
! 		symval += irel->r_addend;
! 
! 	      symval += sym_sec->output_section->vma
! 		+ sym_sec->output_offset - irel->r_addend;
  	    }
  	  else
  	    symval = (isym->st_value

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