Blame SOURCES/emacs-0007-ELF-unexec-R_-_NONE-relocs.patch

1db854
From c00b42d59c296ef9b0660afd7b31e1d3c10972e7 Mon Sep 17 00:00:00 2001
1db854
From: Alan Modra <amodra@gmail.com>
1db854
Date: Sun, 8 Nov 2015 09:29:00 -0800
1db854
Subject: [PATCH 07/11] ELF unexec: R_*_NONE relocs
1db854
1db854
These should be ignored on all targets.
1db854
1db854
* unexelf.c (unexec): Ignore R_*_NONE relocs for any target,
1db854
not just Alpha.  Comment on reloc size assumption.
1db854
---
1db854
 src/unexelf.c | 14 +++++++-------
1db854
 1 file changed, 7 insertions(+), 7 deletions(-)
1db854
1db854
diff --git a/src/unexelf.c b/src/unexelf.c
1db854
index df99f92..15a4cde 100644
1db854
--- a/src/unexelf.c
1db854
+++ b/src/unexelf.c
1db854
@@ -1202,7 +1202,7 @@ temacs:
1db854
     }
1db854
 
1db854
   /* This loop seeks out relocation sections for the data section, so
1db854
-     that it can undo relocations performed by the runtime linker.  */
1db854
+     that it can undo relocations performed by the runtime loader.  */
1db854
   for (n = new_file_h->e_shnum; 0 < --n; )
1db854
     {
1db854
       ElfW (Shdr) *rel_shdr = &NEW_SECTION_H (n);
1db854
@@ -1235,14 +1235,14 @@ temacs:
1db854
 		   reloc += rel_shdr->sh_entsize)
1db854
 		{
1db854
 		  ElfW (Addr) addr = ((ElfW (Rel) *) reloc)->r_offset - offset;
1db854
-#ifdef __alpha__
1db854
-		  /* The Alpha ELF binutils currently have a bug that
1db854
-		     sometimes results in relocs that contain all
1db854
-		     zeroes.  Work around this for now...  */
1db854
+		  /* Ignore R_*_NONE relocs.  */
1db854
 		  if (((ElfW (Rel) *) reloc)->r_offset == 0)
1db854
 		    continue;
1db854
-#endif
1db854
-		  memcpy (new_base + addr, old_base + addr, sizeof (ElfW (Addr)));
1db854
+		  /* Assume reloc applies to a word.
1db854
+		     ??? This is not always true, eg. TLS module/index
1db854
+		     pair in .got which occupies two words.  */
1db854
+		  memcpy (new_base + addr, old_base + addr,
1db854
+			  sizeof (ElfW (Addr)));
1db854
 		}
1db854
 	    }
1db854
 	  break;
1db854
-- 
1db854
2.7.4
1db854