Blame emacs-24-0010-ELF-unexec-Correct-section-header-index.patch

Jan Synacek e76854
From 0a97fb1992c8cc3612a2358f576f774ea1f36777 Mon Sep 17 00:00:00 2001
Jan Synacek e76854
From: Alan Modra <amodra@gmail.com>
Jan Synacek e76854
Date: Sun, 8 Nov 2015 09:28:59 -0800
Jan Synacek e76854
Subject: ELF unexec: Correct section header index
Jan Synacek e76854
Jan Synacek e76854
Emacs should build on ppc64el.  A problem with the bss has been fixed.
Jan Synacek e76854
Jan Synacek e76854
This upstream patch has been added [1/10]:
Jan Synacek e76854
Jan Synacek e76854
  ELF unexec: Correct section header index
Jan Synacek e76854
Jan Synacek e76854
  First a small fix.  The code incorrectly uses "NEW_SECTION_H (n)" when
Jan Synacek e76854
  it should have been using "NEW_SECTION_H (nn)" to find the name of the
Jan Synacek e76854
  section currently being processed.  Of course, before the bss
Jan Synacek e76854
  sections, n and nn have the same value, so this doesn't matter except
Jan Synacek e76854
  in the case of .sbss.  For .sbss this probably meant .bss (most likely
Jan Synacek e76854
  the next section) was copied from memory.  A later patch removes the
Jan Synacek e76854
  bogus .sbss handling anyway.
Jan Synacek e76854
Jan Synacek e76854
  * unexelf.c (unexec): Use correct index to look up names.
Jan Synacek e76854
Jan Synacek e76854
Origin: upstream, commit: 0bcd08ef052bca9b8d08696068c2a0c387d0dd56
Jan Synacek e76854
Bug: http://debbugs.gnu.org/20614
Jan Synacek e76854
Bug-Debian: http://bugs.debian.org/808347
Jan Synacek e76854
Added-by: Rob Browning <rlb@defaultvalue.org>
Jan Synacek e76854
---
Jan Synacek e76854
 src/unexelf.c |   16 ++++++++--------
Jan Synacek e76854
 1 file changed, 8 insertions(+), 8 deletions(-)
Jan Synacek e76854
Jan Synacek e76854
Index: emacs-24.5/src/unexelf.c
Jan Synacek e76854
===================================================================
Jan Synacek e76854
--- emacs-24.5.orig/src/unexelf.c
Jan Synacek e76854
+++ emacs-24.5/src/unexelf.c
Jan Synacek e76854
@@ -1016,12 +1016,12 @@ temacs:
Jan Synacek e76854
       /* Write out the sections. .data and .data1 (and data2, called
Jan Synacek e76854
 	 ".data" in the strings table) get copied from the current process
Jan Synacek e76854
 	 instead of the old file.  */
Jan Synacek e76854
-      if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+      if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".sdata")
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".lit4")
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".lit8")
Jan Synacek e76854
 	  /* The conditional bit below was in Oliva's original code
Jan Synacek e76854
 	     (1999-08-25) and seems to have been dropped by mistake
Jan Synacek e76854
@@ -1044,14 +1044,14 @@ temacs:
Jan Synacek e76854
 	     loader, but I never got anywhere with an SGI support call
Jan Synacek e76854
 	     seeking clues.  -- fx 2002-11-29.  */
Jan Synacek e76854
 #ifdef IRIX6_5
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".got")
Jan Synacek e76854
 #endif
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".sdata1")
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".data1")
Jan Synacek e76854
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
Jan Synacek e76854
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
Jan Synacek e76854
 		      ".sbss"))
Jan Synacek e76854
 	src = (caddr_t) OLD_SECTION_H (n).sh_addr;
Jan Synacek e76854
       else