changeset 15073:e98682eae98b

(unexec): Add conditional for SOLARIS_POWERPC.
author Richard M. Stallman <rms@gnu.org>
date Thu, 25 Apr 1996 18:02:45 +0000
parents ff25c6944c3d
children 0a9219070022
files src/unexelf.c
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/unexelf.c	Thu Apr 25 17:31:37 1996 +0000
+++ b/src/unexelf.c	Thu Apr 25 18:02:45 1996 +0000
@@ -437,6 +437,29 @@
 /* Get the address of a particular section or program header entry,
  * accounting for the size of the entries.
  */
+/* 
+   On PPC Reference Platform running Solaris 2.5.1
+   the plt section is also of type NOBI like the bss section.
+   (not really stored) and therefore sections after the bss
+   section start at the plt offset. The plt section is always
+   the one just before the bss section.
+   Thus, we modify the test from
+      if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset)
+   to
+      if (NEW_SECTION_H (nn).sh_offset >= 
+               OLD_SECTION_H (old_bss_index-1).sh_offset)
+   This is just a hack. We should put the new data section
+   before the .plt section.
+   And we should not have this routine at all but use
+   the libelf library to read the old file and create the new
+   file.
+   The changed code is minimal and depends on prep set in m/prep.h
+   Erik Deumens
+   Quantum Theory Project
+   University of Florida
+   deumens@qtp.ufl.edu
+   Apr 23, 1996
+   */
 
 #define OLD_SECTION_H(n) \
      (*(Elf32_Shdr *) ((byte *) old_section_h + old_file_h->e_shentsize * (n)))
@@ -731,8 +754,22 @@
 	{
 	  /* Any section that was original placed AFTER the bss
 	     section should now be off by NEW_DATA2_SIZE. */
+#ifdef SOLARIS_POWERPC
+	  /* On PPC Reference Platform running Solaris 2.5.1
+	     the plt section is also of type NOBI like the bss section.
+	     (not really stored) and therefore sections after the bss
+	     section start at the plt offset. The plt section is always
+	     the one just before the bss section.
+	     It would be better to put the new data section before
+	     the .plt section, or use libelf instead.
+	     Erik Deumens, deumens@qtp.ufl.edu.  */
+	  if (NEW_SECTION_H (nn).sh_offset
+	      >= OLD_SECTION_H (old_bss_index-1).sh_offset)
+	    NEW_SECTION_H (nn).sh_offset += new_data2_size;
+#else
 	  if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset)
 	    NEW_SECTION_H (nn).sh_offset += new_data2_size;
+#endif
 	  /* Any section that was originally placed after the section
 	     header table should now be off by the size of one section
 	     header table entry.  */