CVS commit: src/external/gpl3/binutils.old/dist/bfd

2021-04-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 22 01:14:18 UTC 2021

Modified Files:
src/external/gpl3/binutils.old/dist/bfd: elf32-ppc.c elf64-ppc.c

Log Message:
Apply this fix also for binutils.old.

http://www.nerv.org/netbsd/?q=id:20210422T010948Z.f87d2246188cfedb66a0d5a012c107b6a2b9f395

> Fix regression where ld(1) is trapped into infinite loop when
> linking binary whose text does not fit within R_PPC_REL24.
>
> Reported upstream as Bug 27755:
> https://sourceware.org/bugzilla/show_bug.cgi?id=27755
>
> This problem was introduced to binutils-2-31-1 for our tree.
> netbsd-9 is affected, while netbsd-8 is not.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.7 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.8
--- src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.7	Fri Apr  3 17:51:04 2020
+++ src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c	Thu Apr 22 01:14:18 2021
@@ -5392,7 +5392,7 @@ ppc_elf_inline_plt (struct bfd_link_info
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc_reloc_type r_type;
 		unsigned long r_symndx;

Index: src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.8 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.9
--- src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.8	Fri Apr  3 17:51:04 2020
+++ src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c	Thu Apr 22 01:14:18 2021
@@ -8391,7 +8391,7 @@ ppc64_elf_inline_plt (struct bfd_link_in
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc64_reloc_type r_type;
 		unsigned long r_symndx;



CVS commit: src/external/gpl3/binutils.old/dist/bfd

2018-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  9 12:15:31 UTC 2018

Modified Files:
src/external/gpl3/binutils.old/dist/bfd: peXXigen.c

Log Message:
FIx reproducible builds for EFI boot blocks (from HEAD)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/binutils.old/dist/bfd/peXXigen.c

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

Modified files:

Index: src/external/gpl3/binutils.old/dist/bfd/peXXigen.c
diff -u src/external/gpl3/binutils.old/dist/bfd/peXXigen.c:1.5 src/external/gpl3/binutils.old/dist/bfd/peXXigen.c:1.6
--- src/external/gpl3/binutils.old/dist/bfd/peXXigen.c:1.5	Sat Apr 14 11:49:39 2018
+++ src/external/gpl3/binutils.old/dist/bfd/peXXigen.c	Mon Jul  9 08:15:31 2018
@@ -879,6 +879,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * ab
   /* Only use a real timestamp if the option was chosen.  */
   if ((pe_data (abfd)->insert_timestamp))
 H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
+  else
+H_PUT_32 (abfd, 0, filehdr_out->f_timdat);
 
   PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
 		  filehdr_out->f_symptr);



CVS commit: src/external/gpl3/binutils.old/dist/bfd

2016-11-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Nov  6 23:46:02 UTC 2016

Modified Files:
src/external/gpl3/binutils.old/dist/bfd: elf32-ppc.c elf64-ppc.c

Log Message:
Merge r1.10 from the main in-tree binutils version:
More detailed error messages for text relocations on ppc code. Tested by
joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.3 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.4
--- src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.3	Wed Oct 26 17:08:38 2016
+++ src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c	Sun Nov  6 23:46:01 2016
@@ -5483,7 +5483,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
 /* Return true if we have dynamic relocs that apply to read-only sections.  */
 
 static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h)
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf, bfd_boolean warn)
 {
   struct elf_dyn_relocs *p;
 
@@ -5494,7 +5494,16 @@ readonly_dynrelocs (struct elf_link_hash
   if (s != NULL
 	  && ((s->flags & (SEC_READONLY | SEC_ALLOC))
 	  == (SEC_READONLY | SEC_ALLOC)))
-	return TRUE;
+	{
+	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+	  if (warn && ((info->warn_shared_textrel && bfd_link_pic (info))
+	  || info->error_textrel))
+	info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
+p->sec->owner, h->root.root.string,
+p->sec);
+	  return TRUE;
+	}
 }
   return FALSE;
 }
@@ -5568,7 +5577,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
 	  && h->type != STT_GNU_IFUNC
 	  && !htab->is_vxworks
 	  && !ppc_elf_hash_entry (h)->has_sda_refs
-	  && !readonly_dynrelocs (h))
+	  && !readonly_dynrelocs (h, info, FALSE))
 	{
 	  h->pointer_equality_needed = 0;
 	  h->non_got_ref = 0;
@@ -5588,7 +5597,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
 		   && h->type != STT_GNU_IFUNC
 		   && !htab->is_vxworks
 		   && !ppc_elf_hash_entry (h)->has_sda_refs
-		   && !readonly_dynrelocs (h))
+		   && !readonly_dynrelocs (h, info, FALSE))
 	h->non_got_ref = 0;
 	}
   h->protected_def = 0;
@@ -5665,7 +5674,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
   && !ppc_elf_hash_entry (h)->has_sda_refs
   && !htab->is_vxworks
   && !h->def_regular
-  && !readonly_dynrelocs (h))
+  && !readonly_dynrelocs (h, info, FALSE))
 {
   h->non_got_ref = 0;
   return TRUE;
@@ -6175,7 +6184,7 @@ maybe_set_textrel (struct elf_link_hash_
   if (h->root.type == bfd_link_hash_indirect)
 return TRUE;
 
-  if (readonly_dynrelocs (h))
+  if (readonly_dynrelocs (h, info, TRUE))
 {
   ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
 

Index: src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.4 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.5
--- src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.4	Sun Nov  6 23:44:44 2016
+++ src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c	Sun Nov  6 23:46:02 2016
@@ -7103,7 +7103,7 @@ ppc64_elf_func_desc_adjust (bfd *obfd AT
 /* Return true if we have dynamic relocs that apply to read-only sections.  */
 
 static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h)
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf, bfd_boolean warn)
 {
   struct ppc_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
@@ -7114,7 +7114,16 @@ readonly_dynrelocs (struct elf_link_hash
   asection *s = p->sec->output_section;
 
   if (s != NULL && (s->flags & SEC_READONLY) != 0)
-	return TRUE;
+	{
+	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+	  if (warn && ((info->warn_shared_textrel && bfd_link_pic (info))
+	  || info->error_textrel))
+	info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
+p->sec->owner, h->root.root.string,
+p->sec);
+	  return TRUE;
+	}
 }
   return FALSE;
 }
@@ -7166,7 +7175,7 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 	 be used instead.  */
 	  if (h->pointer_equality_needed
 	  && h->type != STT_GNU_IFUNC
-	  && !readonly_dynrelocs (h))
+	  && !readonly_dynrelocs (h, info, FALSE))
 	{
 	  h->pointer_equality_needed = 0;
 	  h->non_got_ref = 0;
@@ -7184,7 +7193,7 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 	  else if (!h->ref_regular_nonweak
 		   && h->non_got_ref
 		   && h->type != STT_GNU_IFUNC
-		   && !readonly_dynrelocs (h))
+		   && !readonly_dynrelocs (h, info, FALSE))
 	h->non_got_ref = 0;
 
 	  /* If 

CVS commit: src/external/gpl3/binutils.old/dist/bfd

2016-11-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Nov  6 23:44:44 UTC 2016

Modified Files:
src/external/gpl3/binutils.old/dist/bfd: elf64-ppc.c

Log Message:
Merge r1.11 from the main in-tree binutils version:
Tail calls can use the PLT without a nop after the branch. Since the
callee won't return to the next instruction anyway, it wouldn't work
anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.3 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.4
--- src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.3	Wed Oct 26 17:08:38 2016
+++ src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c	Sun Nov  6 23:44:44 2016
@@ -14056,6 +14056,11 @@ ppc64_elf_relocate_section (bfd *output_
 			  can_plt_call = TRUE;
 			}
 		}
+		  else
+		{
+		  /* Tail calls don't need to worry about restoring TOC. */
+		  can_plt_call = TRUE;
+		}
 		}
 
 	  if (!can_plt_call && h != NULL)