CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2014-04-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Apr  5 07:19:34 UTC 2014

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elf32-arm.c

Log Message:
When writing BE8 executables, make the PLTs are written as little endian.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.32.1 src/gnu/dist/binutils/bfd/elf32-arm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elf32-arm.c
diff -u src/gnu/dist/binutils/bfd/elf32-arm.c:1.1.1.1 src/gnu/dist/binutils/bfd/elf32-arm.c:1.1.1.1.32.1
--- src/gnu/dist/binutils/bfd/elf32-arm.c:1.1.1.1	Thu Feb  2 20:45:20 2006
+++ src/gnu/dist/binutils/bfd/elf32-arm.c	Sat Apr  5 07:19:34 2014
@@ -2012,6 +2012,35 @@ insert_thumb_branch (insn32 br_insn, int
   return br_insn;
 }
 
+
+/* Store an Arm insn into an output section not processed by
+   elf32_arm_write_section.  */
+
+static void
+put_arm_insn(struct elf32_arm_link_hash_table *htab,
+	 bfd * output_bfd, bfd_vma val, void * ptr)
+{
+if (htab-byteswap_code != bfd_little_endian (output_bfd))
+  bfd_putl32(val, ptr);
+else
+  bfd_putb32(val, ptr);
+}
+
+
+/* Store a 16-bit Thumb insn into an output section not processed by
+   elf32_arm_write_section.  */
+
+static void
+put_thumb_insn(struct elf32_arm_link_hash_table *htab,
+	   bfd * output_bfd, bfd_vma val, void * ptr)
+{
+if (htab-byteswap_code != bfd_little_endian (output_bfd))
+  bfd_putl16(val, ptr);
+else
+  bfd_putb16(val, ptr);
+}
+
+
 /* Thumb code calling an ARM function.  */
 
 static int
@@ -2068,11 +2097,11 @@ elf32_thumb_to_arm_stub (struct bfd_link
   --my_offset;
   myh-root.u.def.value = my_offset;
 
-  bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
-		  s-contents + my_offset);
+  put_thumb_insn (globals, output_bfd, (bfd_vma) t2a1_bx_pc_insn,
+		  s-contents + my_offset);
 
-  bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
-		  s-contents + my_offset + 2);
+  put_thumb_insn (globals, output_bfd, (bfd_vma) t2a2_noop_insn,
+		  s-contents + my_offset + 2);
 
   ret_offset =
 	/* Address of destination of the stub.  */
@@ -2090,9 +2119,9 @@ elf32_thumb_to_arm_stub (struct bfd_link
 	   /* ARM branches work from the pc of the instruction + 8.  */
 	   + 8);
 
-  bfd_put_32 (output_bfd,
-		  (bfd_vma) t2a3_b_insn | ((ret_offset  2)  0x00FF),
-		  s-contents + my_offset + 4);
+  put_arm_insn (globals, output_bfd,
+		(bfd_vma) t2a3_b_insn | ((ret_offset  2)  0x00FF),
+		s-contents + my_offset + 4);
 }
 
   BFD_ASSERT (my_offset = globals-thumb_glue_size);
@@ -2171,11 +2200,11 @@ elf32_arm_to_thumb_stub (struct bfd_link
   --my_offset;
   myh-root.u.def.value = my_offset;
 
-  bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
-		  s-contents + my_offset);
+  put_arm_insn (globals, output_bfd, (bfd_vma) a2t1_ldr_insn,
+		s-contents + my_offset);
 
-  bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn,
-		  s-contents + my_offset + 4);
+  put_arm_insn (globals, output_bfd, (bfd_vma) a2t2_bx_r12_insn,
+		s-contents + my_offset + 4);
 
   /* It's a thumb address.  Add the low order bit.  */
   bfd_put_32 (output_bfd, val | a2t3_func_addr_insn,
@@ -4959,16 +4988,17 @@ elf32_arm_finish_dynamic_symbol (bfd * o
   /* Fill in the entry in the procedure linkage table.  */
   if (htab-symbian_p)
 	{
-	  unsigned i;
-	  for (i = 0; i  htab-plt_entry_size / 4; ++i)
-	bfd_put_32 (output_bfd, 
-			elf32_arm_symbian_plt_entry[i],
-			splt-contents + h-plt.offset + 4 * i);
+	  put_arm_insn (htab, output_bfd, 
+		elf32_arm_symbian_plt_entry[0],
+		splt-contents + h-plt.offset);
+	  put_arm_insn (htab, output_bfd, 
+		elf32_arm_symbian_plt_entry[1],
+		splt-contents + h-plt.offset + 4);
 	  
 	  /* Fill in the entry in the .rel.plt section.  */
 	  rel.r_offset = (splt-output_section-vma
 			  + splt-output_offset
-			  + h-plt.offset + 4 * (i - 1));
+			  + h-plt.offset + 4);
 	  rel.r_info = ELF32_R_INFO (h-dynindx, R_ARM_GLOB_DAT);
 
 	  /* Get the index in the procedure linkage table which
@@ -5014,20 +5044,23 @@ elf32_arm_finish_dynamic_symbol (bfd * o
 
 	  if (eh-plt_thumb_refcount  0)
 	{
-	  bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0],
-			  splt-contents + h-plt.offset - 4);
-	  bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1],
-			  splt-contents + h-plt.offset - 2);
+	  put_thumb_insn (htab, output_bfd, elf32_arm_plt_thumb_stub[0],
+			  splt-contents + h-plt.offset - 4);
+	  put_thumb_insn (htab, output_bfd, elf32_arm_plt_thumb_stub[1],
+			  splt-contents + h-plt.offset - 2);
 	}
 
-	  bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement  0x0ff0)  20),
-		  splt-contents + h-plt.offset + 0);
-	  bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | 

CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2014-04-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Apr  5 07:19:34 UTC 2014

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elf32-arm.c

Log Message:
When writing BE8 executables, make the PLTs are written as little endian.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.32.1 src/gnu/dist/binutils/bfd/elf32-arm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2010-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 28 17:13:53 UTC 2010

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: config.bfd

Log Message:
Switch to using bfd_elf32_ntrad{little,big]mips_vec because the non-trad is
for IRIX systems and bfd does weird things for/because of IRIX.  With this
change C++ programs build and link correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.14.24.2 -r1.14.24.3 src/gnu/dist/binutils/bfd/config.bfd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2010-01-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 26 08:40:49 UTC 2010

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elfn32-mips.c

Log Message:
Add a is_local_label_name function so that objcopy/strip can strip out
local symbols of a N32 image.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.32.1 src/gnu/dist/binutils/bfd/elfn32-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2010-01-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 26 08:40:49 UTC 2010

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elfn32-mips.c

Log Message:
Add a is_local_label_name function so that objcopy/strip can strip out
local symbols of a N32 image.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.32.1 src/gnu/dist/binutils/bfd/elfn32-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elfn32-mips.c
diff -u src/gnu/dist/binutils/bfd/elfn32-mips.c:1.1.1.3 src/gnu/dist/binutils/bfd/elfn32-mips.c:1.1.1.3.32.1
--- src/gnu/dist/binutils/bfd/elfn32-mips.c:1.1.1.3	Thu Feb  2 20:47:37 2006
+++ src/gnu/dist/binutils/bfd/elfn32-mips.c	Tue Jan 26 08:40:49 2010
@@ -81,6 +81,8 @@
   (bfd *, Elf_Internal_Note *);
 static bfd_boolean elf32_mips_grok_psinfo
   (bfd *, Elf_Internal_Note *);
+static bfd_boolean mips_elf_n32_is_local_label_name
+  (bfd *, const char *);
 static irix_compat_t elf_n32_mips_irix_compat
   (bfd *);
 
@@ -2239,6 +2241,17 @@
   return TRUE;
 }
 
+/* MIPS ELF local labels start with $L.  */
+static bfd_boolean
+mips_elf_n32_is_local_label_name (bfd *abfd, const char *name)
+{
+  if (name[0] == '$'  name[1] == 'L')
+return TRUE;
+
+  /* We accept the generic ELF local label syntax as well.  */
+  return _bfd_elf_is_local_label_name (abfd, name);
+}
+
 /* Depending on the target vector we generate some version of Irix
executables or normal MIPS ELF ABI executables.  */
 static irix_compat_t
@@ -2355,6 +2368,8 @@
 #define elf_backend_write_section	_bfd_mips_elf_write_section
 #define elf_backend_mips_irix_compat	elf_n32_mips_irix_compat
 #define elf_backend_mips_rtype_to_howto	mips_elf_n32_rtype_to_howto
+#define bfd_elf32_bfd_is_local_label_name \
+mips_elf_n32_is_local_label_name
 #define bfd_elf32_find_nearest_line	_bfd_mips_elf_find_nearest_line
 #define bfd_elf32_new_section_hook	_bfd_mips_elf_new_section_hook
 #define bfd_elf32_set_section_contents	_bfd_mips_elf_set_section_contents



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2009-12-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec  7 09:57:19 UTC 2009

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elf.c elf64-mips.c

Log Message:
Recognize $L as a local symbol only for mips64.


To generate a diff of this commit:
cvs rdiff -u -r1.6.32.1 -r1.6.32.2 src/gnu/dist/binutils/bfd/elf.c
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.32.1 src/gnu/dist/binutils/bfd/elf64-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elf.c
diff -u src/gnu/dist/binutils/bfd/elf.c:1.6.32.1 src/gnu/dist/binutils/bfd/elf.c:1.6.32.2
--- src/gnu/dist/binutils/bfd/elf.c:1.6.32.1	Sat Sep 12 00:50:21 2009
+++ src/gnu/dist/binutils/bfd/elf.c	Mon Dec  7 09:57:19 2009
@@ -6312,10 +6312,6 @@
   if (name[0] == '.'  name[1] == 'L')
 return TRUE;
 
-  /* Normal local symbols start with ``$L''.  */
-  if (name[0] == '$'  name[1] == 'L')
-return TRUE;
-
   /* At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate
  DWARF debugging symbols starting with ``..''.  */
   if (name[0] == '.'  name[1] == '.')

Index: src/gnu/dist/binutils/bfd/elf64-mips.c
diff -u src/gnu/dist/binutils/bfd/elf64-mips.c:1.1.1.3 src/gnu/dist/binutils/bfd/elf64-mips.c:1.1.1.3.32.1
--- src/gnu/dist/binutils/bfd/elf64-mips.c:1.1.1.3	Thu Feb  2 20:46:55 2006
+++ src/gnu/dist/binutils/bfd/elf64-mips.c	Mon Dec  7 09:57:19 2009
@@ -122,6 +122,8 @@
   (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
 static bfd_boolean mips_elf64_object_p
   (bfd *);
+static bfd_boolean mips_elf64_is_local_label_name
+  (bfd *, const char *);
 static irix_compat_t elf64_mips_irix_compat
   (bfd *);
 static bfd_boolean elf64_mips_grok_prstatus
@@ -2884,7 +2886,18 @@
   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
   return TRUE;
 }
+
+/* MIPS ELF local labels start with $L.  */
+static bfd_boolean
+mips_elf64_is_local_label_name (bfd *abfd, const char *name)
+{
+  if (name[0] == '$'  name[1] == 'L')
+return TRUE;
 
+  /* We accept the generic ELF local label syntax as well.  */
+  return _bfd_elf_is_local_label_name (abfd, name);
+}
+
 /* Depending on the target vector we generate some version of Irix
executables or normal MIPS ELF ABI executables.  */
 static irix_compat_t
@@ -3098,9 +3111,8 @@
 
 #define elf_backend_write_section	_bfd_mips_elf_write_section
 
-/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
-   MIPS-specific function only applies to IRIX5, which had no 64-bit
-   ABI.  */
+#define bfd_elf64_bfd_is_local_label_name \
+mips_elf64_is_local_label_name
 #define bfd_elf64_find_nearest_line	_bfd_mips_elf_find_nearest_line
 #define bfd_elf64_new_section_hook	_bfd_mips_elf_new_section_hook
 #define bfd_elf64_set_section_contents	_bfd_mips_elf_set_section_contents



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2009-09-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 12 00:50:22 UTC 2009

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elf.c

Log Message:
Recognize $L as a local symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.32.1 src/gnu/dist/binutils/bfd/elf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elf.c
diff -u src/gnu/dist/binutils/bfd/elf.c:1.6 src/gnu/dist/binutils/bfd/elf.c:1.6.32.1
--- src/gnu/dist/binutils/bfd/elf.c:1.6	Thu Feb  2 22:03:53 2006
+++ src/gnu/dist/binutils/bfd/elf.c	Sat Sep 12 00:50:21 2009
@@ -6312,6 +6312,10 @@
   if (name[0] == '.'  name[1] == 'L')
 return TRUE;
 
+  /* Normal local symbols start with ``$L''.  */
+  if (name[0] == '$'  name[1] == 'L')
+return TRUE;
+
   /* At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate
  DWARF debugging symbols starting with ``..''.  */
   if (name[0] == '.'  name[1] == '.')



CVS commit: [matt-nb5-mips64] src/gnu/dist/binutils/bfd

2009-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep  5 03:10:39 UTC 2009

Modified Files:
src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elfxx-mips.c

Log Message:
Fix BFD to understand that R_MIPS_GPREL32 with R_MIPS_64 will not require text
section modifications and thus you don't have to set the shared image as being
DT_TEXTREL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.32.1 src/gnu/dist/binutils/bfd/elfxx-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elfxx-mips.c
diff -u src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3 src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3.32.1
--- src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3	Thu Feb  2 20:47:51 2006
+++ src/gnu/dist/binutils/bfd/elfxx-mips.c	Sat Sep  5 03:10:39 2009
@@ -6135,11 +6135,25 @@
 		 relocs.  We make room for this reloc in the
 		 .rel.dyn reloc section.  */
 		  mips_elf_allocate_dynamic_relocations (dynobj, 1);
-		  if ((sec-flags  MIPS_READONLY_SECTION)
-		  == MIPS_READONLY_SECTION)
-		/* We tell the dynamic linker that there are
-		   relocations against the text segment.  */
-		info-flags |= DF_TEXTREL;
+		  /* In the N32 and 64-bit ABIs there may be multiple
+		 consecutive relocations for the same offset.  If we have
+		 a R_MIPS_GPREL32 followed by a R_MIPS_64 then that
+		 relocation is complete and needs no futher adjustment.  */
+		  if ((rel == relocs
+		  || rel[-1].r_offset != rel-r_offset
+		  || r_type != R_MIPS_64
+		  || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32)
+		   (sec-flags  MIPS_READONLY_SECTION)
+			  == MIPS_READONLY_SECTION)
+		{
+		  /* We tell the dynamic linker that there are
+		 relocations against the text segment.  */
+		  info-flags |= DF_TEXTREL;
+		  info-callbacks-warning
+			(info,
+			 _(relocation emitted against readonly section),
+			 NULL, abfd, sec, rel-r_offset);
+		}
 		}
 	  else
 		{