summaryrefslogtreecommitdiff
path: root/editors/emacs/patches/patch-ah
blob: 01269519dedd6c340cd2aa643f3194e98a05da44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$NetBSD: patch-ah,v 1.5 2007/01/25 20:52:29 markd Exp $

--- src/unexelf.c.orig	2002-10-16 03:21:44.000000000 +1300
+++ src/unexelf.c
@@ -971,8 +971,13 @@ unexec (new_name, old_name, data_start, 
 	}
       else
 	{
-	  /* Any section that was original placed AFTER the bss
-	     section should now be off by NEW_DATA2_SIZE. */
+	  /* Any section that was originally placed after the .bss
+	     section should now be off by NEW_DATA2_SIZE.  If a
+	     section overlaps the .bss section, consider it to be
+	     placed after the .bss section.  Overlap can occur if the
+	     section just before .bss has less-strict alignment; this
+	     was observed between .symtab and .bss on Solaris 2.5.1
+	     (sparc) with GCC snapshot 960602.  */
 #ifdef SOLARIS_POWERPC
 	  /* On PPC Reference Platform running Solaris 2.5.1
 	     the plt section is also of type NOBI like the bss section.
@@ -986,9 +991,8 @@ unexec (new_name, old_name, data_start, 
 	      >= OLD_SECTION_H (old_bss_index-1).sh_offset)
 	    NEW_SECTION_H (nn).sh_offset += new_data2_size;
 #else
-	  if (round_up (NEW_SECTION_H (nn).sh_offset,
-			OLD_SECTION_H (old_bss_index).sh_addralign)
-	      >= new_data2_offset)
+	  if (NEW_SECTION_H (nn).sh_offset + NEW_SECTION_H (nn).sh_size
+	      > new_data2_offset)
 	    NEW_SECTION_H (nn).sh_offset += new_data2_size;
 #endif
 	  /* Any section that was originally placed after the section