public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH for GOT16 handling
@ 1999-08-09 15:48 Mark Mitchell
  1999-08-09 17:31 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Mitchell @ 1999-08-09 15:48 UTC (permalink / raw)
  To: binutils

Ralf and I jointly discovered that elf32-mips.c has historically lied
about the source mask for GOT16/CALL16 entries.  Since the new code
cares, that was causing problems.  Fixed here.  

Also fixed is a problem with looking for matching GOT16 entries in the
GOT.

Coming soon is a patch for the creation of dynamic relocations.  It
looks like the old code got the cases used in the N32 ABI wrong, while
the new code gets the old cases wrong.  Ian and I have hashed out the
right solution; I will implement it.

Ian, did you get a chance to review the elflink.h patch I sent in
about a week ago?  It was designed to avoid wasting relocation entries
in the case that both REL and RELA relocations appear for a single
section.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-08-09  Mark Mitchell  <mark@codesourcery.com>

	* elf32-mips.c (elf_mips_howto_table): Fix src_mask for
	R_MIPS_GOT16 and R_MIPS_CALL16.
	(mips_elf_got16_entry): Use mips_elf_high to calculate the value
	to use wheen looking for a preexisting GOT entry.

Index: elf32-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v
retrieving revision 1.45
diff -c -p -r1.45 elf32-mips.c
*** elf32-mips.c	1999/08/06 02:44:41	1.45
--- elf32-mips.c	1999/08/09 22:41:09
*************** static reloc_howto_type elf_mips_howto_t
*** 602,608 ****
  	 _bfd_mips_elf_got16_reloc,	/* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 false,			/* partial_inplace */
! 	 0,			/* src_mask */
  	 0xffff,		/* dst_mask */
  	 false),		/* pcrel_offset */
  
--- 602,608 ----
  	 _bfd_mips_elf_got16_reloc,	/* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 false,			/* partial_inplace */
! 	 0xffff,		/* src_mask */
  	 0xffff,		/* dst_mask */
  	 false),		/* pcrel_offset */
  
*************** static reloc_howto_type elf_mips_howto_t
*** 632,638 ****
  	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 false,			/* partial_inplace */
! 	 0,			/* src_mask */
  	 0xffff,		/* dst_mask */
  	 false),		/* pcrel_offset */
  
--- 632,638 ----
  	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 false,			/* partial_inplace */
! 	 0xffff,		/* src_mask */
  	 0xffff,		/* dst_mask */
  	 false),		/* pcrel_offset */
  
*************** mips_elf_got16_entry (abfd, info, value)
*** 5537,5543 ****
    bfd_vma index;
    bfd_vma address;
  
!   value &= 0xffff0000;
    g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
  
    /* Look to see if we already have an appropriate entry.  */
--- 5537,5547 ----
    bfd_vma index;
    bfd_vma address;
  
!   /* Although the ABI says that it is "the high-order 16 bits" that we
!      want, it is really the %high value.  The complete value is
!      calculated with a `addiu' of a LO16 relocation, just as with a
!      HI16/LO16 pair.  */
!   value = mips_elf_high (value);
    g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
  
    /* Look to see if we already have an appropriate entry.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-08-09 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-09 15:48 PATCH for GOT16 handling Mark Mitchell
1999-08-09 17:31 ` Ralf Baechle
1999-08-09 20:12   ` Mark Mitchell
1999-08-09 20:20   ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).