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

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