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]

Commit: MN10300: Generate .got entries for GOT based relocs


Hi Guys,

  I am applying the patch below to fix a problem with the MN10300 linker
  - it was not correctly allocating space in the .got section for GOT
  based relocs.  This was because the mn10300_elf_check_relocs()
  function was not being called, which in turn was caused by the loaded
  object files being given an object_id of GENERIC_ELF_DATA instead of
  MN10300_ELF_DATA.
  
bfd/ChangeLog
2011-05-23  Nick Clifton  <nickc@redhat.com>

	* elf-m10300.c (mn10300_elf_mkobject): New function.
	(bfd_elf32_mkobject): Define.

Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.106
diff -u -3 -p -r1.106 elf-m10300.c
--- bfd/elf-m10300.c	25 Oct 2010 15:54:13 -0000	1.106
+++ bfd/elf-m10300.c	23 May 2011 14:50:15 -0000
@@ -4882,6 +4882,21 @@ _bfd_mn10300_elf_reloc_type_class (const
     }
 }
 
+/* Allocate space for an MN10300 extension to the bfd elf data structure.  */
+static bfd_boolean
+mn10300_elf_mkobject (bfd *abfd)
+{
+  /* We do not actually need any extra room in the bfd elf data structure.
+     But we do need the object_id of the structure to be set to
+     MN10300_ELF_DATA so that elflink.c:elf_link_add_object_symols() will call
+     our mn10300_elf_check_relocs function which will then allocate space in
+     the .got section for any GOT based relocs.  */
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
+				  MN10300_ELF_DATA);
+}
+
+#define bfd_elf32_mkobject	mn10300_elf_mkobject
+
 #ifndef ELF_ARCH
 #define TARGET_LITTLE_SYM	bfd_elf32_mn10300_vec
 #define TARGET_LITTLE_NAME	"elf32-mn10300"


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