This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix DATA_SEGMENT_ALIGN


Hi!

If you ever wonder why some sparc64 libraries grew on disk by 1MB recently, this is why:
If common page size (sparc64 8K) is less than maximum page size
(sparc64 has 1M), then for say dot = 0x231c we want:
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x00231c 0x00231c R E 0x100000
  LOAD           0x004000 0x0000000000104000 0x0000000000104000 0x002008 0x002008 RWE 0x100000
while binutils without this patch would do:
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x00231c 0x00231c R E 0x100000
  LOAD           0x102000 0x0000000000102000 0x0000000000102000 0x002008 0x002008 RWE 0x100000

Ok to commit?

2002-03-11  Jakub Jelinek  <jakub@redhat.com>

	* ldexp.c (fold_binary) [DATA_SEGMENT_ALIGN]: If common page size
	is smaller than maximum, round dot up to common page boundary.

--- ld/ldexp.c.jj	Fri Feb 15 09:42:21 2002
+++ ld/ldexp.c	Mon Mar 11 16:01:21 2002
@@ -356,7 +356,8 @@ fold_binary (tree, current_section, allo
 			}
 		    }
 		  else if (other.value < maxpage)
-		    result.value += dot & (maxpage - other.value);
+		    result.value += (dot + other.value - 1)
+				    & (maxpage - other.value);
 		}
 	      else
 		result.valid_p = false;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]