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]

PATCH: Correct handling of R_ARM_RELATIVE on Symbian OS


My earlier patch for the handling of R_ARM_RELATIVE on Symbian OS, was
incorrect.  In particular, I used the incorrect section symbol.
Instead of locating the dynamic symbol table entry for the section
from which the symbol originated, I used the non-dynamic symbol table
entry for the section to which the relocation applies.  Urgh.

Fixed with the attached patch, which I committed as obvious. 

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-11-11  Mark Mitchell  <mark@codesourcery.com>

	* elf32-arm.c (elf32_arm_final_link_relocate): Correct logic for
	R_ARM_RELATIVE on Symbian OS.

Index: elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 elf32-arm.c
*** elf32-arm.c	9 Nov 2004 16:50:38 -0000	1.5
--- elf32-arm.c	11 Nov 2004 18:16:31 -0000
*************** elf32_arm_final_link_relocate (reloc_how
*** 2379,2397 ****
  	      int symbol;
  
  	      /* This symbol is local, or marked to become local.  */
  	      relocate = TRUE;
  	      if (globals->symbian_p)
! 		/* On Symbian OS, the data segment and text segement
! 		   can be relocated independently.  Therefore, we must
! 		   indicate the segment to which this relocation is
! 		   relative.  The BPABI allows us to use any symbol in
! 		   the right segment; we just use the section symbol
! 		   as it is convenient.  (We cannot use the symbol
! 		   given by "h" directly as it will not appear in the
! 		   dynamic symbol table.)  */
! 		symbol = input_section->output_section->target_index;
  	      else
  		/* On SVR4-ish systems, the dynamic loader cannot
  		   relocate the text and data segments independently,
  		   so the symbol does not matter.  */
  		symbol = 0;
--- 2379,2400 ----
  	      int symbol;
  
  	      /* This symbol is local, or marked to become local.  */
  	      relocate = TRUE;
  	      if (globals->symbian_p)
! 		{
! 		  /* On Symbian OS, the data segment and text segement
! 		     can be relocated independently.  Therefore, we
! 		     must indicate the segment to which this
! 		     relocation is relative.  The BPABI allows us to
! 		     use any symbol in the right segment; we just use
! 		     the section symbol as it is convenient.  (We
! 		     cannot use the symbol given by "h" directly as it
! 		     will not appear in the dynamic symbol table.)  */
! 		  symbol = elf_section_data (sym_sec->output_section)->dynindx;
! 		  BFD_ASSERT (symbol != 0);
! 		}
  	      else
  		/* On SVR4-ish systems, the dynamic loader cannot
  		   relocate the text and data segments independently,
  		   so the symbol does not matter.  */
  		symbol = 0;


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