Blame SOURCES/emacs-0002-ELF-unexec-Correct-section-header-index.patch

bb3be4
From acfdfce2687342a119d4fe7cae8f5d04550a9d4a Mon Sep 17 00:00:00 2001
bb3be4
From: Alan Modra <amodra@gmail.com>
bb3be4
Date: Sun, 8 Nov 2015 09:28:59 -0800
bb3be4
Subject: [PATCH 02/11] ELF unexec: Correct section header index
bb3be4
bb3be4
First a small fix.  The code incorrectly uses "NEW_SECTION_H (n)" when
bb3be4
it should have been using "NEW_SECTION_H (nn)" to find the name of the
bb3be4
section currently being processed.  Of course, before the bss
bb3be4
sections, n and nn have the same value, so this doesn't matter except
bb3be4
in the case of .sbss.  For .sbss this probably meant .bss (most likely
bb3be4
the next section) was copied from memory.  A later patch removes the
bb3be4
bogus .sbss handling anyway.
bb3be4
bb3be4
* unexelf.c (unexec): Use correct index to look up names.
bb3be4
---
bb3be4
 src/unexelf.c | 16 ++++++++--------
bb3be4
 1 file changed, 8 insertions(+), 8 deletions(-)
bb3be4
bb3be4
diff --git a/src/unexelf.c b/src/unexelf.c
bb3be4
index 483da6e..1699f31 100644
bb3be4
--- a/src/unexelf.c
bb3be4
+++ b/src/unexelf.c
bb3be4
@@ -1015,12 +1015,12 @@ temacs:
bb3be4
       /* Write out the sections. .data and .data1 (and data2, called
bb3be4
 	 ".data" in the strings table) get copied from the current process
bb3be4
 	 instead of the old file.  */
bb3be4
-      if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+      if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".sdata")
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".lit4")
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".lit8")
bb3be4
 	  /* The conditional bit below was in Oliva's original code
bb3be4
 	     (1999-08-25) and seems to have been dropped by mistake
bb3be4
@@ -1043,14 +1043,14 @@ temacs:
bb3be4
 	     loader, but I never got anywhere with an SGI support call
bb3be4
 	     seeking clues.  -- fx 2002-11-29.  */
bb3be4
 #ifdef IRIX6_5
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".got")
bb3be4
 #endif
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".sdata1")
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".data1")
bb3be4
-	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
bb3be4
+	  || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
bb3be4
 		      ".sbss"))
bb3be4
 	src = (caddr_t) OLD_SECTION_H (n).sh_addr;
bb3be4
       else
bb3be4
-- 
bb3be4
2.7.4
bb3be4