public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix DATA_SEGMENT_ALIGN
@ 2002-03-04  7:21 Jakub Jelinek
  2002-03-04 15:49 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-03-04  7:21 UTC (permalink / raw)
  To: binutils

Hi!

Somehow forgot to post this.
If DATA_SEGMENT_ALIGN (X, Y); is not used in the linker
script (e.g. because of -N), there is no point to use DATA_SEGMENT_END ().
Ok to commit?

2002-02-15  Jakub Jelinek  <jakub@redhat.com>

	* scripttempl/elf.sc: Only use DATA_SEGMENT_END() together with
	DATA_SEGMENT_ALIGN.

--- ld/scripttempl/elf.sc.jj	Tue Feb 12 15:10:29 2002
+++ ld/scripttempl/elf.sc	Fri Feb 15 23:17:52 2002
@@ -70,9 +70,13 @@ if [ -z "$MACHINE" ]; then OUTPUT_ARCH=$
 test -z "${ELFSIZE}" && ELFSIZE=32
 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
 test "$LD_FLAG" = "N" && DATA_ADDR=.
+test -n "$CREATE_SHLIB" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
+test -z "$CREATE_SHLIB" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
 DATA_SEGMENT_ALIGN="ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))"
-if [ -n "${COMMONPAGESIZE}" ]; then
+DATA_SEGMENT_END=""
+if test -n "${COMMONPAGESIZE}"; then
   DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN(${MAXPAGESIZE}, ${COMMONPAGESIZE})"
+  DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
 fi
 INTERP=".interp       ${RELOCATING-0} : { *(.interp) }"
 PLT=".plt          ${RELOCATING-0} : { *(.plt) }"
@@ -320,7 +324,7 @@ cat <<EOF
   ${RELOCATING+_end = .;}
   ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
   ${RELOCATING+PROVIDE (end = .);}
-  ${COMMONPAGESIZE+${RELOCATING+. = DATA_SEGMENT_END (.);}}
+  ${RELOCATING+${DATA_SEGMENT_END}}
 
   /* Stabs debugging sections.  */
   .stab          0 : { *(.stab) }

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix DATA_SEGMENT_ALIGN
  2002-03-04  7:21 [PATCH] Fix DATA_SEGMENT_ALIGN Jakub Jelinek
@ 2002-03-04 15:49 ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2002-03-04 15:49 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

On Mon, Mar 04, 2002 at 04:21:30PM +0100, Jakub Jelinek wrote:
> 	* scripttempl/elf.sc: Only use DATA_SEGMENT_END() together with
> 	DATA_SEGMENT_ALIGN.

OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix DATA_SEGMENT_ALIGN
  2002-03-11  6:59 Jakub Jelinek
@ 2002-03-11 13:33 ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2002-03-11 13:33 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

On Mon, Mar 11, 2002 at 03:59:40PM +0100, Jakub Jelinek wrote:
> 	* ldexp.c (fold_binary) [DATA_SEGMENT_ALIGN]: If common page size
> 	is smaller than maximum, round dot up to common page boundary.

Ok.


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Fix DATA_SEGMENT_ALIGN
@ 2002-03-11  6:59 Jakub Jelinek
  2002-03-11 13:33 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-03-11  6:59 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-11 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-04  7:21 [PATCH] Fix DATA_SEGMENT_ALIGN Jakub Jelinek
2002-03-04 15:49 ` Alan Modra
2002-03-11  6:59 Jakub Jelinek
2002-03-11 13:33 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).