public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RFC: Change x86-64 maximum page size to 2MB
@ 2006-05-17 11:24 H. J. Lu
  2006-05-19 12:39 ` Nick Clifton
  0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-05-17 11:24 UTC (permalink / raw)
  To: binutils; +Cc: discuss

The current x86-64 maximum page size is 1MB. With the future
development, 2MB is better for performance. Using 2MB won't break
anything, except for up to 2MB gap in virtual address space per file,
instead of 1MB. x86-64 has 48 bits in virtual address space. It
shouldn't be an issue for most applications. I have a patch:

http://sourceware.org/ml/binutils/2005-05/msg00644.html

which can be used to implement "-z max-page-size=xxxx" so that people
can control maximum page size at the link time if they prefer different
maximum page size.


H.J.

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

* Re: RFC: Change x86-64 maximum page size to 2MB
  2006-05-17 11:24 RFC: Change x86-64 maximum page size to 2MB H. J. Lu
@ 2006-05-19 12:39 ` Nick Clifton
  2006-05-22 23:57   ` H. J. Lu
  2006-05-26  4:33   ` PATCH: Change x86-64 maximum page size to 2MB H. J. Lu
  0 siblings, 2 replies; 9+ messages in thread
From: Nick Clifton @ 2006-05-19 12:39 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils, discuss

Hi H. J.

> The current x86-64 maximum page size is 1MB. With the future
> development, 2MB is better for performance. Using 2MB won't break
> anything, except for up to 2MB gap in virtual address space per file,
> instead of 1MB. x86-64 has 48 bits in virtual address space. It
> shouldn't be an issue for most applications. I have a patch:
> 
> http://sourceware.org/ml/binutils/2005-05/msg00644.html
> 
> which can be used to implement "-z max-page-size=xxxx" so that people
> can control maximum page size at the link time if they prefer different
> maximum page size.

This seems to be perfectly reasonable.

Cheers
   Nick

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

* Re: RFC: Change x86-64 maximum page size to 2MB
  2006-05-19 12:39 ` Nick Clifton
@ 2006-05-22 23:57   ` H. J. Lu
  2006-05-24  7:24     ` PATCH: Add "-z max-page-size=xxxx"/"-z common-page-size=xxxx" H. J. Lu
  2006-05-26  4:33   ` PATCH: Change x86-64 maximum page size to 2MB H. J. Lu
  1 sibling, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-05-22 23:57 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> Hi H. J.
> 
> >The current x86-64 maximum page size is 1MB. With the future
> >development, 2MB is better for performance. Using 2MB won't break
> >anything, except for up to 2MB gap in virtual address space per file,
> >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> >shouldn't be an issue for most applications. I have a patch:
> >
> >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> >
> >which can be used to implement "-z max-page-size=xxxx" so that people
> >can control maximum page size at the link time if they prefer different
> >maximum page size.
> 
> This seems to be perfectly reasonable.


Here is the patch to implement "-z max-page-size=xxxx" and
"-z common-page-size=xxxx".


H.J.
----
bfd/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* bfd.c (bfd_emul_get_maxpagesize): New.
	(bfd_elf_set_pagesize): Likewise.
	(bfd_emul_set_maxpagesize): Likewise.
	(bfd_emul_get_commonpagesize): Likewise.
	(bfd_emul_set_commonpagesize): Likewise.

	* elf-bfd.h (elf_backend_data): Add commonpagesize.
	(xvec_get_elf_backend_data): New.
	(get_elf_backend_data): Use xvec_get_elf_backend_data.

	* elf.c (assign_file_positions_for_load_sections): Set
	p->p_vaddr with  m->p_vaddr if it is valid. Set p->p_align with
	m->p_align if it is valid. Adjust and check p->p_vaddr and
	p->p_paddr only if needed.
	(copy_elf_program_header): Copy p_vaddr and p_align. Set
	p_vaddr_valid and p_align_valid to 1.

	* elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
	* elfxx-target.h (elfNN_bed): Likewise.

	* elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
	* elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
	* elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.

	* elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
	(elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.

	* targets.c (bfd_find_target): Support NULL abfd.

include/elf/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* internal.h (elf_segment_map): Add p_vaddr, p_align,
	p_vaddr_valid and p_align_valid.

ld/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/arcelf.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	* emulparams/armelf_nbsd.sh: Likewise.
	* emulparams/armelf_vxworks.sh: Likewise.
	* emulparams/armnto.sh: Likewise.
	* emulparams/armsymbian.sh: Likewise.
	* emulparams/crislinux.sh: Likewise.
	* emulparams/elf32_i860.sh: Likewise.
	* emulparams/elf32_i960.sh: Likewise.
	* emulparams/elf32am33lin.sh: Likewise.
	* emulparams/elf32bfinfd.sh: Likewise.
	* emulparams/elf32bmipn32-defs.sh: Likewise.
	* emulparams/elf32frvfd.sh: Likewise.
	* emulparams/elf32i370.sh: Likewise.
	* emulparams/elf32lppcnto.sh: Likewise.
	* emulparams/elf32mcore.sh: Likewise.
	* emulparams/elf32openrisc.sh: Likewise.
	* emulparams/elf32ppcnto.sh: Likewise.
	* emulparams/elf32ppcwindiss.sh: Likewise.
	* emulparams/elf32vax.sh: Likewise.
	* emulparams/elf32xc16x.sh: Likewise.
	* emulparams/elf32xc16xl.sh: Likewise.
	* emulparams/elf32xc16xs.sh: Likewise.
	* emulparams/elf64_aix.sh: Likewise.
	* emulparams/elf64hppa.sh: Likewise.
	* emulparams/elf64mmix.sh: Likewise.
	* emulparams/elf_i386_be.sh: Likewise.
	* emulparams/elf_i386_chaos.sh: Likewise.
	* emulparams/elf_i386_ldso.sh: Likewise.
	* emulparams/hppa64linux.sh: Likewise.
	* emulparams/hppalinux.sh: Likewise.
	* emulparams/hppaobsd.sh: Likewise.
	* emulparams/i386lynx.sh: Likewise.
	* emulparams/i386moss.sh: Likewise.
	* emulparams/i386nto.sh: Likewise.
	* emulparams/i386nw.sh: Likewise.
	* emulparams/m32relf_linux.sh: Likewise.
	* emulparams/m68kpsos.sh: Likewise.
	* emulparams/or32elf.sh: Likewise.
	* emulparams/pjelf.sh: Likewise.
	* emulparams/pjlelf.sh: Likewise.
	* emulparams/ppclynx.sh: Likewise.
	* emulparams/ppcnw.sh: Likewise.
	* emulparams/shelf32_nbsd.sh : Likewise.
	* emulparams/shelf_nbsd.sh: Likewise.
	* emulparams/shelf_nto.sh: Likewise.
	* emulparams/shlelf_nto.sh: Likewise.
	* emulparams/xtensa-config.sh: Likewise.

	* emulparams/armelf_linux.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	(COMMONPAGESIZE): Changed to "CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32_sparc.sh: Likewise.
	* emulparams/elf32bmip.sh: Likewise.
	* emulparams/elf32ppccommon.sh: Likewise.
	* emulparams/elf64_ia64.sh: Likewise.
	* emulparams/elf64_s390.sh: Likewise.
	* emulparams/elf64_sparc.sh: Likewise.
	* emulparams/elf64alpha.sh: Likewise.
	* emulparams/elf64ppc.sh: Likewise.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_i386_vxworks.sh: Likewise.
	* emulparams/elf_s390.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/shlelf32_linux.sh: Likewise.
	* emulparams/shlelf_linux.sh: Likewise.

	* emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Changed to
	"CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32btsmipn32.sh: Likewise.

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
	"-z max-page-size=" and "-z common-page-size=".
	(gld${EMULATION_NAME}_list_options): Likewise.

	* ld.h (ld_config_type): Add maxpagesize and commonpagesize.

	* ld.texinfo: Document "-z max-page-size=" and
	"-z common-page-size=".

	* ldexp.c (exp_print_token): Handle CONSTANT.
	(fold_name): Likewise.
	* ldgram.y: Likewise.
	* ldlex.l: Likewise.

	* ldmain.c (main): Initiliaze config.maxpagesize and
	config.commonpagesize. Call bfd_emul_set_maxpagesize if
	config.maxpagesize isn't 0. Call bfd_emul_set_commonpagesize if
	config.commonpagesize config.maxpagesize isn't 0.

ld/testsuite/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/binutils.exp: New file.
	* ld-elf/maxpage.d: Likewise.
	* ld-elf/maxpage.s: Likewise.

--- binutils/bfd/bfd.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/bfd.c	2006-05-22 12:36:40.000000000 -0700
@@ -1513,3 +1513,130 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE
      objalloc.  */
   bfd_hash_table_free (&preserve->section_htab);
 }
+
+/*
+FUNCTION
+	bfd_emul_get_maxpagesize
+
+SYNOPSIS
+ 	bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+DESCRIPTION
+	Returns the maximum page size, in bytes, as determined by
+	emulation.
+
+RETURNS
+	Returns the maximum page size in bytes for ELF, abort
+	otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_maxpagesize (const char *emul)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target != NULL
+      && target->flavour == bfd_target_elf_flavour)
+    return xvec_get_elf_backend_data (target)->maxpagesize;
+
+  abort ();
+  return 0;
+}
+
+static void
+bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size,
+		      int offset, const bfd_target *orig_target)
+{
+  if (target->flavour == bfd_target_elf_flavour)
+    {
+      const struct elf_backend_data *bed;
+
+      bed = xvec_get_elf_backend_data (target);
+      *((bfd_vma *) ((char *) bed + offset)) = size;
+    }
+
+  if (target->alternative_target
+      && target->alternative_target != orig_target)
+    bfd_elf_set_pagesize (target->alternative_target, size, offset,
+			  orig_target);
+}
+
+/*
+FUNCTION
+	bfd_emul_set_maxpagesize
+
+SYNOPSIS
+ 	void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+	For ELF, set the maximum page size for the emulation.  It is
+	a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_maxpagesize (const char *emul, bfd_vma size)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target)
+    bfd_elf_set_pagesize (target, size,
+			  offsetof (struct elf_backend_data,
+				    maxpagesize), target);
+}
+
+/*
+FUNCTION
+	bfd_emul_get_commonpagesize
+
+SYNOPSIS
+ 	bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+DESCRIPTION
+	Returns the common page size, in bytes, as determined by
+	emulation.
+
+RETURNS
+	Returns the common page size in bytes for ELF, abort otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_commonpagesize (const char *emul)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target != NULL
+      && target->flavour == bfd_target_elf_flavour)
+    return xvec_get_elf_backend_data (target)->commonpagesize;
+
+  abort ();
+  return 0;
+}
+
+/*
+FUNCTION
+	bfd_emul_set_commonpagesize
+
+SYNOPSIS
+ 	void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+	For ELF, set the common page size for the emulation.  It is
+	a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_commonpagesize (const char *emul, bfd_vma size)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target)
+    bfd_elf_set_pagesize (target, size,
+			  offsetof (struct elf_backend_data,
+				    commonpagesize), target);
+}
--- binutils/bfd/elf-bfd.h.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/bfd/elf-bfd.h	2006-05-22 12:36:40.000000000 -0700
@@ -571,6 +571,9 @@ struct elf_backend_data
      pages at least this large.  May be smaller than maxpagesize.  */
   bfd_vma minpagesize;
 
+  /* The common page size for this backend.  */
+  bfd_vma commonpagesize;
+
   /* The BFD flags applied to sections created for dynamic linking.  */
   flagword dynamic_sec_flags;
 
@@ -1193,8 +1196,11 @@ struct bfd_elf_section_data
    && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE		\
    && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
+#define xvec_get_elf_backend_data(xvec) \
+  ((struct elf_backend_data *) (xvec)->backend_data)
+
 #define get_elf_backend_data(abfd) \
-  ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
+   xvec_get_elf_backend_data ((abfd)->xvec)
 
 /* This struct is used to pass information to routines called via
    elf_link_hash_traverse which must return failure.  */
--- binutils/bfd/elf.c.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/bfd/elf.c	2006-05-22 12:45:55.000000000 -0700
@@ -4292,7 +4292,9 @@ assign_file_positions_for_load_sections 
 	  return FALSE;
 	}
 
-      if (m->count == 0)
+      if (m->p_vaddr_valid)
+	p->p_vaddr = m->p_vaddr;
+      else if (m->count == 0)
 	p->p_vaddr = 0;
       else
 	p->p_vaddr = m->sections[0]->vma;
@@ -4304,7 +4306,9 @@ assign_file_positions_for_load_sections 
       else
 	p->p_paddr = m->sections[0]->lma;
 
-      if (p->p_type == PT_LOAD
+      if (m->p_align_valid)
+	p->p_align = m->p_align;
+      else if (p->p_type == PT_LOAD
 	  && (abfd->flags & D_PAGED) != 0)
 	p->p_align = bed->maxpagesize;
       else if (m->count == 0)
@@ -4323,7 +4327,8 @@ assign_file_positions_for_load_sections 
 	  p->p_offset = 0;
 	  p->p_filesz = bed->s->sizeof_ehdr;
 	  p->p_memsz = bed->s->sizeof_ehdr;
-	  if (m->count > 0)
+	  if (m->count > 0
+	      && (!m->p_vaddr_valid || !m->p_paddr_valid))
 	    {
 	      BFD_ASSERT (p->p_type == PT_LOAD);
 
@@ -4336,7 +4341,8 @@ assign_file_positions_for_load_sections 
 		  return FALSE;
 		}
 
-	      p->p_vaddr -= off;
+	      if (! m->p_vaddr_valid)
+		p->p_vaddr -= off;
 	      if (! m->p_paddr_valid)
 		p->p_paddr -= off;
 	    }
@@ -5805,6 +5811,10 @@ copy_elf_program_header (bfd *ibfd, bfd 
       map->p_flags_valid = 1;
       map->p_paddr = segment->p_paddr;
       map->p_paddr_valid = 1;
+      map->p_vaddr = segment->p_vaddr;
+      map->p_vaddr_valid = 1;
+      map->p_align = segment->p_align;
+      map->p_align_valid = 1;
 
       /* Determine if this segment contains the ELF file header
 	 and if it contains the program headers themselves.  */
--- binutils/bfd/elf32-arm.c.pagesize	2006-05-19 06:31:20.000000000 -0700
+++ binutils/bfd/elf32-arm.c	2006-05-22 12:36:40.000000000 -0700
@@ -62,7 +62,7 @@
 #define ARM_ELF_ABI_VERSION		0
 #define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
 
-static const struct elf_backend_data elf32_arm_vxworks_bed;
+static struct elf_backend_data elf32_arm_vxworks_bed;
 
 /* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
    R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
@@ -8196,6 +8196,7 @@ const struct elf_size_info elf32_arm_siz
 #define ELF_MAXPAGESIZE			0x8000
 #endif
 #define ELF_MINPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #define bfd_elf32_mkobject		        elf32_arm_mkobject
 
--- binutils/bfd/elf32-mips.c.pagesize	2006-03-27 09:05:27.000000000 -0800
+++ binutils/bfd/elf32-mips.c	2006-05-22 12:36:40.000000000 -0700
@@ -1599,6 +1599,7 @@ static const struct ecoff_debug_swap mip
 /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
    a value of 0x1000, and we are compatible.  */
 #define ELF_MAXPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elf32-ppc.c.pagesize	2006-05-19 06:31:20.000000000 -0700
+++ binutils/bfd/elf32-ppc.c	2006-05-22 12:36:40.000000000 -0700
@@ -7436,6 +7436,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou
 #define ELF_MAXPAGESIZE		0x10000
 #endif
 #define ELF_MINPAGESIZE		0x1000
+#define ELF_COMMONPAGESIZE	0x1000
 #define elf_info_to_howto	ppc_elf_info_to_howto
 
 #ifdef  EM_CYGNUS_POWERPC
--- binutils/bfd/elf32-sh.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/elf32-sh.c	2006-05-22 12:36:40.000000000 -0700
@@ -7371,6 +7371,7 @@ sh_elf_plt_sym_val (bfd_vma i, const ase
 #define	TARGET_LITTLE_NAME		"elf32-shl-nbsd"
 #undef	ELF_MAXPAGESIZE
 #define	ELF_MAXPAGESIZE			0x10000
+#undef	ELF_COMMONPAGESIZE
 #undef	elf_symbol_leading_char
 #define	elf_symbol_leading_char		0
 #undef	elf32_bed
@@ -7388,6 +7389,8 @@ sh_elf_plt_sym_val (bfd_vma i, const ase
 #define	TARGET_LITTLE_SYM		bfd_elf32_shlin_vec
 #undef	TARGET_LITTLE_NAME
 #define	TARGET_LITTLE_NAME		"elf32-sh-linux"
+#undef	ELF_COMMONPAGESIZE
+#define	ELF_COMMONPAGESIZE		0x1000
 
 #undef	elf_backend_grok_prstatus
 #define	elf_backend_grok_prstatus	elf32_shlin_grok_prstatus
--- binutils/bfd/elf32-sh64.c.pagesize	2006-05-04 10:32:30.000000000 -0700
+++ binutils/bfd/elf32-sh64.c	2006-05-22 12:36:40.000000000 -0700
@@ -785,6 +785,7 @@ static const struct bfd_elf_special_sect
 #define	TARGET_LITTLE_NAME	"elf32-sh64l-nbsd"
 #undef	ELF_MAXPAGESIZE
 #define	ELF_MAXPAGESIZE		0x10000
+#undef	ELF_COMMONPAGESIZE
 #undef	elf_symbol_leading_char
 #define	elf_symbol_leading_char	0
 #undef	elf32_bed
@@ -803,6 +804,8 @@ static const struct bfd_elf_special_sect
 #define	TARGET_LITTLE_NAME	"elf32-sh64-linux"
 #undef	elf32_bed
 #define	elf32_bed		elf32_sh64_lin_bed
+#undef	ELF_COMMONPAGESIZE
+#define	ELF_COMMONPAGESIZE	0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elf32-sparc.c.pagesize	2006-04-05 11:10:51.000000000 -0700
+++ binutils/bfd/elf32-sparc.c	2006-05-22 12:36:40.000000000 -0700
@@ -172,6 +172,7 @@ elf32_sparc_reloc_type_class (const Elf_
 #define ELF_MACHINE_CODE EM_SPARC
 #define ELF_MACHINE_ALT1 EM_SPARC32PLUS
 #define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x2000
 
 #define bfd_elf32_bfd_merge_private_bfd_data \
 					elf32_sparc_merge_private_bfd_data
--- binutils/bfd/elf64-alpha.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/elf64-alpha.c	2006-05-22 12:36:40.000000000 -0700
@@ -5231,6 +5231,7 @@ static const struct elf_size_info alpha_
 #define ELF_ARCH		bfd_arch_alpha
 #define ELF_MACHINE_CODE	EM_ALPHA
 #define ELF_MAXPAGESIZE	0x10000
+#define ELF_COMMONPAGESIZE	0x2000
 
 #define bfd_elf64_bfd_link_hash_table_create \
   elf64_alpha_bfd_link_hash_table_create
--- binutils/bfd/elf64-ppc.c.pagesize	2006-05-11 08:52:56.000000000 -0700
+++ binutils/bfd/elf64-ppc.c	2006-05-22 12:36:40.000000000 -0700
@@ -61,6 +61,7 @@ static bfd_vma opd_entry_value
 #define ELF_ARCH		bfd_arch_powerpc
 #define ELF_MACHINE_CODE	EM_PPC64
 #define ELF_MAXPAGESIZE		0x10000
+#define ELF_COMMONPAGESIZE	0x1000
 #define elf_info_to_howto	ppc64_elf_info_to_howto
 
 #define elf_backend_want_got_sym 0
--- binutils/bfd/elf64-sparc.c.pagesize	2005-05-04 11:17:48.000000000 -0700
+++ binutils/bfd/elf64-sparc.c	2006-05-22 12:36:40.000000000 -0700
@@ -814,6 +814,7 @@ const struct elf_size_info elf64_sparc_s
 #define TARGET_BIG_NAME	"elf64-sparc"
 #define ELF_ARCH	bfd_arch_sparc
 #define ELF_MAXPAGESIZE 0x100000
+#define ELF_COMMONPAGESIZE 0x2000
 
 /* This is the official ABI value.  */
 #define ELF_MACHINE_CODE EM_SPARCV9
--- binutils/bfd/elf64-x86-64.c.pagesize	2006-03-27 09:05:29.000000000 -0800
+++ binutils/bfd/elf64-x86-64.c	2006-05-22 12:36:40.000000000 -0700
@@ -3631,6 +3631,7 @@ static const struct bfd_elf_special_sect
 #define ELF_ARCH			    bfd_arch_i386
 #define ELF_MACHINE_CODE		    EM_X86_64
 #define ELF_MAXPAGESIZE			    0x100000
+#define ELF_COMMONPAGESIZE		    0x1000
 
 #define elf_backend_can_gc_sections	    1
 #define elf_backend_can_refcount	    1
--- binutils/bfd/elfn32-mips.c.pagesize	2005-12-05 14:28:41.000000000 -0800
+++ binutils/bfd/elfn32-mips.c	2006-05-22 12:36:40.000000000 -0700
@@ -2384,6 +2384,7 @@ static const struct ecoff_debug_swap mip
    a value of 0x1000, and we are compatible.
    FIXME: How does this affect NewABI?  */
 #define ELF_MAXPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elfxx-ia64.c.pagesize	2006-05-19 07:08:21.000000000 -0700
+++ binutils/bfd/elfxx-ia64.c	2006-05-22 12:36:40.000000000 -0700
@@ -5717,6 +5717,7 @@ elfNN_hpux_backend_symbol_processing (bf
 #define ELF_MACHINE_ALT1		1999	/* EAS2.3 */
 #define ELF_MACHINE_ALT2		1998	/* EAS2.2 */
 #define ELF_MAXPAGESIZE			0x10000	/* 64KB */
+#define ELF_COMMONPAGESIZE		0x4000	/* 16KB */
 
 #define elf_backend_section_from_shdr \
 	elfNN_ia64_section_from_shdr
@@ -5824,6 +5825,7 @@ elfNN_hpux_backend_symbol_processing (bf
 
 #undef  ELF_MAXPAGESIZE
 #define ELF_MAXPAGESIZE                 0x1000  /* 4K */
+#undef ELF_COMMONPAGESIZE
 
 #undef  elfNN_bed
 #define elfNN_bed elfNN_ia64_hpux_bed
--- binutils/bfd/elfxx-target.h.pagesize	2006-04-25 14:35:45.000000000 -0700
+++ binutils/bfd/elfxx-target.h	2006-05-22 12:36:40.000000000 -0700
@@ -294,6 +294,10 @@
 #define ELF_MINPAGESIZE ELF_MAXPAGESIZE
 #endif
 
+#ifndef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
+#endif
+
 #ifndef ELF_DYNAMIC_SEC_FLAGS
 /* Note that we set the SEC_IN_MEMORY flag for these sections.  */
 #define ELF_DYNAMIC_SEC_FLAGS			\
@@ -556,12 +560,13 @@
 extern const struct elf_size_info _bfd_elfNN_size_info;
 
 #ifndef INCLUDED_TARGET_FILE
-static const struct elf_backend_data elfNN_bed =
+static struct elf_backend_data elfNN_bed =
 {
   ELF_ARCH,			/* arch */
   ELF_MACHINE_CODE,		/* elf_machine_code */
   ELF_MAXPAGESIZE,		/* maxpagesize */
   ELF_MINPAGESIZE,		/* minpagesize */
+  ELF_COMMONPAGESIZE,		/* commonpagesize */
   ELF_DYNAMIC_SEC_FLAGS,	/* dynamic_sec_flags */
   elf_info_to_howto,
   elf_info_to_howto_rel,
--- binutils/bfd/targets.c.pagesize	2006-04-05 11:10:51.000000000 -0700
+++ binutils/bfd/targets.c	2006-05-22 12:36:40.000000000 -0700
@@ -1307,14 +1307,15 @@ SYNOPSIS
 
 DESCRIPTION
 	Return a pointer to the transfer vector for the object target
-	named @var{target_name}.  If @var{target_name} is <<NULL>>, choose the
-	one in the environment variable <<GNUTARGET>>; if that is null or not
-	defined, then choose the first entry in the target list.
-	Passing in the string "default" or setting the environment
-	variable to "default" will cause the first entry in the target
-	list to be returned, and "target_defaulted" will be set in the
-	BFD.  This causes <<bfd_check_format>> to loop over all the
-	targets to find the one that matches the file being read.
+	named @var{target_name}.  If @var{target_name} is <<NULL>>,
+	choose the one in the environment variable <<GNUTARGET>>; if
+	that is null or not defined, then choose the first entry in the
+	target list.  Passing in the string "default" or setting the
+	environment variable to "default" will cause the first entry in
+	the target list to be returned, and "target_defaulted" will be
+	set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
+	<<bfd_check_format>> to loop over all the targets to find the
+	one that matches the file being read.
 */
 
 const bfd_target *
@@ -1331,21 +1332,27 @@ bfd_find_target (const char *target_name
   /* This is safe; the vector cannot be null.  */
   if (targname == NULL || strcmp (targname, "default") == 0)
     {
-      abfd->target_defaulted = TRUE;
       if (bfd_default_vector[0] != NULL)
-	abfd->xvec = bfd_default_vector[0];
+	target = bfd_default_vector[0];
       else
-	abfd->xvec = bfd_target_vector[0];
-      return abfd->xvec;
+	target = bfd_target_vector[0];
+      if (abfd)
+	{
+	  abfd->xvec = target;
+	  abfd->target_defaulted = TRUE;
+	}
+      return target;
     }
 
-  abfd->target_defaulted = FALSE;
+  if (abfd)
+    abfd->target_defaulted = FALSE;
 
   target = find_target (targname);
   if (target == NULL)
     return NULL;
 
-  abfd->xvec = target;
+  if (abfd)
+    abfd->xvec = target;
   return target;
 }
 
--- binutils/include/elf/internal.h.pagesize	2006-02-10 08:59:44.000000000 -0800
+++ binutils/include/elf/internal.h	2006-05-22 12:47:06.000000000 -0700
@@ -235,12 +235,22 @@ struct elf_segment_map
   unsigned long p_flags;
   /* Program segment physical address.  */
   bfd_vma p_paddr;
+  /* Program segment virtual address.  */
+  bfd_vma p_vaddr;
+  /* Program segment alignment. */
+  bfd_vma p_align;
   /* Whether the p_flags field is valid; if not, the flags are based
      on the section flags.  */
   unsigned int p_flags_valid : 1;
   /* Whether the p_paddr field is valid; if not, the physical address
      is based on the section lma values.  */
   unsigned int p_paddr_valid : 1;
+  /* Whether the p_vaddr field is valid; if not, the virtual address
+     is based on the section vma values.  */
+  unsigned int p_vaddr_valid : 1;
+  /* Whether the p_align field is valid; if not, the segment alignment
+     is based on the default maximum page size.  */
+  unsigned int p_align_valid : 1;
   /* Whether this segment includes the file header.  */
   unsigned int includes_filehdr : 1;
   /* Whether this segment includes the program headers.  */
--- binutils/ld/emulparams/arcelf.sh.pagesize	2006-05-19 09:31:04.000000000 -0700
+++ binutils/ld/emulparams/arcelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-littlearc"
 LITTLE_OUTPUT_FORMAT="elf32-littlearc"
 BIG_OUTPUT_FORMAT="elf32-bigarc"
 TEXT_START_ADDR=0x0
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0
 ARCH=arc
 MACHINE=
--- binutils/ld/emulparams/armelf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,8 +3,8 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-littlearm"
 BIG_OUTPUT_FORMAT="elf32-bigarm"
 LITTLE_OUTPUT_FORMAT="elf32-littlearm"
-MAXPAGESIZE=0x8000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 TEMPLATE_NAME=elf32
 EXTRA_EM_FILE=armelf
 GENERATE_SHLIB_SCRIPT=yes
--- binutils/ld/emulparams/armelf_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 . ${srcdir}/emulparams/armelf.sh
-MAXPAGESIZE=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x00008000
 TARGET2_TYPE=got-rel
 
--- binutils/ld/emulparams/armelf_vxworks.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_vxworks.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,5 +2,5 @@
 OUTPUT_FORMAT="elf32-littlearm-vxworks"
 BIG_OUTPUT_FORMAT="elf32-bigarm-vxworks"
 LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 . ${srcdir}/emulparams/vxworks.sh
--- binutils/ld/emulparams/armnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armnto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -17,7 +17,7 @@ GENERATE_SHLIB_SCRIPT=yes
 
 ARCH=arm
 MACHINE=
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 ENTRY=_start
 
--- binutils/ld/emulparams/armsymbian.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armsymbian.sh	2006-05-22 12:36:40.000000000 -0700
@@ -19,7 +19,4 @@ OTHER_READONLY_SECTIONS="
   ${RELOCATING+ __exidx_end = .; }
   ${RELOCATING+ .ARM.exidx\$\$Limit = . ; }"
 
-# This value should match ELF_MAXPAGESIZE in BFD.  Otherwise, elf.c
-# will not place read-write sections in a separate ELF segment from
-# the read-only sections.
-MAXPAGESIZE=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/bfin.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/bfin.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-bfin"
 TEXT_START_ADDR=0x0
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TARGET_PAGE_SIZE=0x1000
 NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
 ARCH=bfin
--- binutils/ld/emulparams/crislinux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/crislinux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -14,7 +14,7 @@ GENERATE_SHLIB_SCRIPT=yes
 # Is this high enough and low enough?
 TEXT_START_ADDR=0x80000
 
-MAXPAGESIZE=8192
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # We don't do the hoops through DEFINED to provide [_]*start, as it
 # doesn't work with --gc-sections, and the start-name is pretty fixed
--- binutils/ld/emulparams/elf32_i860.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_i860.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,5 +5,5 @@ BIG_OUTPUT_FORMAT="elf32-i860"
 LITTLE_OUTPUT_FORMAT="elf32-i860-little"
 TEXT_START_ADDR=0
 PAGE_SIZE=0x1000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i860
--- binutils/ld/emulparams/elf32_i960.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_i960.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,4 +5,4 @@ ARCH=i960
 MACHINE=
 TEXT_START_ADDR=0
 EMBEDDED=yes
-MAXPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/elf32_sparc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_sparc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sparc"
 TEXT_START_ADDR=0x10000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x10000
 ALIGNMENT=8
 ARCH=sparc
--- binutils/ld/emulparams/elf32am33lin.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32am33lin.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-am33lin"
 TEXT_START_ADDR=0x8000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x8000000
 ARCH=mn10300
 MACHINE=
--- binutils/ld/emulparams/elf32bfinfd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bfinfd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 . ${srcdir}/emulparams/bfin.sh
 unset STACK_ADDR
 OUTPUT_FORMAT="elf32-bfinfdpic"
-MAXPAGESIZE=0x4000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
--- binutils/ld/emulparams/elf32bmip.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmip.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,8 +7,8 @@ BIG_OUTPUT_FORMAT="elf32-bigmips"
 LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 TEXT_START_ADDR=0x0400000
 test -n "${EMBEDDED}" || DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0400000
 SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
--- binutils/ld/emulparams/elf32bmipn32-defs.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmipn32-defs.sh	2006-05-22 12:36:40.000000000 -0700
@@ -33,7 +33,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 
 TEXT_START_ADDR=0x10000000
-MAXPAGESIZE=0x100000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=__start
 
 # GOT-related settings.  
--- binutils/ld/emulparams/elf32bmipn32.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmipn32.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-nbigmips"
 BIG_OUTPUT_FORMAT="elf32-nbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-nlittlemips"
 SHLIB_TEXT_START_ADDR=0x5ffe0000
-COMMONPAGESIZE=0x1000
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 
 # IRIX6 defines these symbols.  0x34 is the size of the ELF header.
 EXECUTABLE_SYMBOLS="
--- binutils/ld/emulparams/elf32btsmipn32.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32btsmipn32.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 OUTPUT_FORMAT="elf32-ntradbigmips"
 BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
-COMMONPAGESIZE=0x1000
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 
 # Magic sections.
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
--- binutils/ld/emulparams/elf32frvfd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32frvfd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 . ${srcdir}/emulparams/elf32frv.sh
 unset STACK_ADDR
 OUTPUT_FORMAT="elf32-frvfdpic"
-MAXPAGESIZE=0x4000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
--- binutils/ld/emulparams/elf32i370.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32i370.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ GENERATE_SHLIB_SCRIPT=yes
 SCRIPT_NAME=elfi370
 OUTPUT_FORMAT="elf32-i370"
 TEXT_START_ADDR=0x01800000
-MAXPAGESIZE=0x40000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i370
 MACHINE=
--- binutils/ld/emulparams/elf32lppcnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32lppcnto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 . ${srcdir}/emulparams/elf32ppc.sh
 OUTPUT_FORMAT="elf32-powerpcle"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x48040000
 
--- binutils/ld/emulparams/elf32mcore.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32mcore.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ BIG_OUTPUT_FORMAT="elf32-mcore-big"
 LITTLE_OUTPUT_FORMAT="elf32-mcore-little"
 PAGE_SIZE=0x1000
 TARGET_PAGE_SIZE=0x400
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0
 NONPAGED_TEXT_START_ADDR=0
 ARCH=mcore
--- binutils/ld/emulparams/elf32openrisc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32openrisc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-openrisc"
 TEXT_START_ADDR=0x10000
 ARCH=openrisc
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
 NOP=0x15000000
--- binutils/ld/emulparams/elf32ppccommon.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppccommon.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,8 +6,8 @@ GENERATE_PIE_SCRIPT=yes
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-powerpc"
 TEXT_START_ADDR=0x01800000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=powerpc:common
 MACHINE=
 EXECUTABLE_SYMBOLS='PROVIDE (__stack = 0); PROVIDE (___stack = 0);'
--- binutils/ld/emulparams/elf32ppcnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppcnto.sh	2006-05-22 13:00:47.000000000 -0700
@@ -1,4 +1,4 @@
 . ${srcdir}/emulparams/elf32ppc.sh
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x48040000
 
--- binutils/ld/emulparams/elf32ppcwindiss.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppcwindiss.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ OUTPUT_FORMAT="elf32-powerpc"
 ARCH=powerpc
 MACHINE=
 EMBEDDED=yes
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # The data below is taken from the windiss.dld linker script that comes with
 # the Diab linker.
--- binutils/ld/emulparams/elf32vax.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32vax.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-vax"
 TEXT_START_ADDR=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=vax
 MACHINE=
--- binutils/ld/emulparams/elf32xc16x.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16x.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0x00400
 ARCH=xc16x
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf32xc16xl.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16xl.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0xc00300
 ARCH=xc16x:xc16xl
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf32xc16xs.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16xs.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0xc00300
 ARCH=xc16x:xc16xs
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf64_aix.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_aix.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf64-ia64-aix-little"
 ARCH=ia64
 MACHINE=
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR="0x10000000"
 DATA_ADDR="ALIGN (0x10000000) + (. & (${MAXPAGESIZE} - 1))"
 GENERATE_SHLIB_SCRIPT=yes
--- binutils/ld/emulparams/elf64_ia64.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_ia64.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,12 +6,12 @@ EXTRA_EM_FILE=ia64elf
 OUTPUT_FORMAT="elf64-ia64-little"
 ARCH=ia64
 MACHINE=
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 # FIXME: It interferes with linker relaxation. Disable it until it is
 # fixed.
 if test "0" = "1" -a -n "$CREATE_SHLIB"; then
   # Optimize shared libraries for 16K page size
-  COMMONPAGESIZE=0x4000
+  COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 fi
 TEXT_START_ADDR="0x4000000000000000"
 DATA_ADDR="0x6000000000000000 + (. & (${MAXPAGESIZE} - 1))"
--- binutils/ld/emulparams/elf64_s390.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_s390.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-s390"
 TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x80000000
 ARCH="s390:64-bit"
 MACHINE=
--- binutils/ld/emulparams/elf64_sparc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_sparc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf64-sparc"
-MAXPAGESIZE=0x100000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="sparc:v9"
 MACHINE=
 DATA_PLT=
--- binutils/ld/emulparams/elf64alpha.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64alpha.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,8 +5,8 @@ TEMPLATE_NAME=elf32
 EXTRA_EM_FILE=alphaelf
 OUTPUT_FORMAT="elf64-alpha"
 TEXT_START_ADDR="0x120000000"
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR="0x120000000"
 ARCH=alpha
 MACHINE=
--- binutils/ld/emulparams/elf64hppa.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64hppa.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ LIB_PATH="=/usr/lib/pa20_64:=/opt/langto
 TEXT_START_ADDR=0x4000000000001000
 DATA_ADDR=0x8000000000001000
 TARGET_PAGE_SIZE=4096
-MAXPAGESIZE=4096
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # The HP dynamic linker actually requires you set the start of text and
 # data to some reasonable value.  Of course nobody knows what reasoanble
--- binutils/ld/emulparams/elf64mmix.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64mmix.sh	2006-05-22 12:36:40.000000000 -0700
@@ -12,11 +12,7 @@ TEXT_START_ADDR='DEFINED (__.MMIX.start.
 TEXT_BASE_ADDRESS=$TEXT_START_ADDR
 DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
 
-# Setting this anywhere near the quite reasonable value of 0x10000
-# causes the binary to bloat to reach page alignment between segments.
-# Let's just have a 256-byte default page alignment.  Having some
-# alignment at all gives a warm feeling but not much more.
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=mmix
 MACHINE=
 COMPILE_IN=yes
--- binutils/ld/emulparams/elf64ppc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64ppc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,8 +7,8 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf64-powerpc"
 TEXT_START_ADDR=0x10000000
 #SEGMENT_SIZE=0x10000000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=powerpc:common64
 MACHINE=
 NOP=0x60000000
--- binutils/ld/emulparams/elf_i386.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_be.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_be.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x80000000
 #SHLIB_TEXT_START_ADDR=0x80000000
 NONPAGED_TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i386
 MACHINE=
 NOP=0x90909090
--- binutils/ld/emulparams/elf_i386_chaos.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_chaos.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf_chaos
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x40000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x40000000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_ldso.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_ldso.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_vxworks.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_vxworks.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386-vxworks"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_s390.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_s390.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-s390"
 TEXT_START_ADDR=0x00400000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x00400000
 ARCH="s390:31-bit"
 MACHINE=
--- binutils/ld/emulparams/elf_x86_64.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_x86_64.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-x86-64"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x100000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x400000
 ARCH="i386:x86-64"
 MACHINE=
--- binutils/ld/emulparams/hppa64linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppa64linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,7 +7,7 @@ ELFSIZE=64
 OUTPUT_FORMAT="elf64-hppa-linux"
 TEXT_START_ADDR=0x10000
 TARGET_PAGE_SIZE=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=hppa
 MACHINE=hppa2.0w
 ENTRY="main"
--- binutils/ld/emulparams/hppalinux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppalinux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,7 +6,7 @@ ELFSIZE=32
 OUTPUT_FORMAT="elf32-hppa-linux"
 TEXT_START_ADDR=0x10000
 TARGET_PAGE_SIZE=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=hppa
 MACHINE=hppa1.1    # We use 1.1 specific features.
 NOP=0x08000240
--- binutils/ld/emulparams/hppaobsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppaobsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,4 +3,4 @@
 OUTPUT_FORMAT="elf32-hppa"
 TEXT_START_ADDR=0x1000
 TARGET_PAGE_SIZE=0x1000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/i386lynx.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386lynx.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ ENTRY=_main
 TEXT_BASE=0x0
 DYN_TEXT_BASE=0x00400000
 TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/i386moss.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386moss.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x00002000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x00002000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/i386nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,7 +2,7 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
 TEXT_START_SYMBOLS='_btext = .;'
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 #SHLIB_TEXT_START_ADDR=0xb0300000
 ARCH=i386
--- binutils/ld/emulparams/i386nw.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386nw.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=nw
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08000000
 ARCH=i386
 NOP=0x90909090
--- binutils/ld/emulparams/m32relf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m32relf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf32-m32r-linux"
 TEXT_START_ADDR=0x1000
 ARCH=m32r
 MACHINE=
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # Hmmm, there's got to be a better way.  This sets the stack to the
 # top of simulator memory (32MB).
--- binutils/ld/emulparams/m68kelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m68kelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-m68k"
 TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
 ARCH=m68k
 MACHINE=
--- binutils/ld/emulparams/m68kpsos.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m68kpsos.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,6 +1,6 @@
 SCRIPT_NAME=psos
 OUTPUT_FORMAT="elf32-m68k"
 TEXT_START_ADDR=0x20000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=m68k
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/or32elf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/or32elf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,5 +2,5 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-or32"
 TEXT_START_ADDR=0x1000000
 TARGET_PAGE_SIZE=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=or32
--- binutils/ld/emulparams/pjelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/pjelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-pj"
 TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=pj
--- binutils/ld/emulparams/pjlelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/pjlelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-pjl"
 TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=pj
--- binutils/ld/emulparams/ppclynx.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/ppclynx.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-powerpc"
 TEXT_BASE=0x00002000
 DYN_TEXT_BASE=0x00400000
 TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})"
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=powerpc
 MACHINE=
--- binutils/ld/emulparams/ppcnw.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/ppcnw.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,6 +2,6 @@ SCRIPT_NAME=nw
 OUTPUT_FORMAT="elf32-powerpc"
 TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0400000
 ARCH=powerpc
--- binutils/ld/emulparams/shelf32_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf32_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 
 OUTPUT_FORMAT="elf32-sh64-nbsd"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 ENTRY=__start
 
--- binutils/ld/emulparams/shelf_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 
 OUTPUT_FORMAT="elf32-sh-nbsd"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 DATA_START_SYMBOLS='__data_start = . ;';
 
--- binutils/ld/emulparams/shelf_nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf_nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh"
 TEXT_START_ADDR=0x08040000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/shlelf32_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf32_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,8 +4,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh64-linux"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=sh
 MACHINE=sh5
 ALIGNMENT=8
--- binutils/ld/emulparams/shlelf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,8 +4,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh-linux"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/shlelf_nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf_nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-shl"
 TEXT_START_ADDR=0x08040000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/xtensa-config.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/xtensa-config.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,3 +1,3 @@
 # Xtensa configuration settings.
 
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emultempl/elf32.em.pagesize	2006-04-14 14:44:47.000000000 -0700
+++ binutils/ld/emultempl/elf32.em	2006-05-22 12:36:40.000000000 -0700
@@ -1846,6 +1846,22 @@ cat >>e${EMULATION_NAME}.c <<EOF
 	link_info.relro = TRUE;
       else if (strcmp (optarg, "norelro") == 0)
 	link_info.relro = FALSE;
+      else if (strncmp (optarg, "max-page-size=", 14) == 0)
+	{
+	  char *end;
+	  config.maxpagesize = strtoul (optarg + 14, &end, 0);
+	  if (*end)
+	    einfo (_("%P%F: invalid maxium page size \`%s'\n"),
+		   optarg + 14);
+	}
+      else if (strncmp (optarg, "common-page-size=", 17) == 0)
+	{
+	  char *end;
+	  config.commonpagesize = strtoul (optarg + 17, &end, 0);
+	  if (*end)
+	    einfo (_("%P%F: invalid common page size \`%s'\n"),
+		   optarg + 17);
+	}
       /* What about the other Solaris -z options? FIXME.  */
       break;
 EOF
@@ -1897,6 +1913,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
   fprintf (file, _("  -z now\t\tMark object non-lazy runtime binding\n"));
   fprintf (file, _("  -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t  at runtime\n"));
   fprintf (file, _("  -z relro\t\tCreate RELRO program header\n"));
+  fprintf (file, _("  -z max-page-size=SIZE\tSet maximum page size to SIZE\n"));
+  fprintf (file, _("  -z common-page-size=SIZE\n\t\t\tSet common page size to SIZE\n"));
   fprintf (file, _("  -z KEYWORD\t\tIgnored for Solaris compatibility\n"));
 EOF
 fi
--- binutils/ld/ld.h.pagesize	2005-09-30 08:45:16.000000000 -0700
+++ binutils/ld/ld.h	2006-05-22 12:36:40.000000000 -0700
@@ -270,6 +270,12 @@ typedef struct {
 
   /* The size of the hash table to use.  */
   bfd_size_type hash_table_size;
+
+  /* The maximum page size for ELF.  */
+  bfd_vma maxpagesize;
+
+  /* The common page size for ELF.  */
+  bfd_vma commonpagesize;
 } ld_config_type;
 
 extern ld_config_type config;
--- binutils/ld/ld.texinfo.pagesize	2006-05-19 06:31:21.000000000 -0700
+++ binutils/ld/ld.texinfo	2006-05-22 12:36:40.000000000 -0700
@@ -1007,6 +1007,12 @@ Marks the object may contain $ORIGIN.
 @item relro
 Create an ELF @code{PT_GNU_RELRO} segment header in the object.
 
+@item max-page-size=@var{value}
+Set the emulation maximum page size to @var{value}.
+
+@item common-page-size=@var{value}
+Set the emulation common page size to @var{value}.
+
 @end table
 
 Other keywords are ignored for Solaris compatibility.  
--- binutils/ld/ldexp.c.pagesize	2005-12-08 07:06:38.000000000 -0800
+++ binutils/ld/ldexp.c	2006-05-22 13:16:55.000000000 -0700
@@ -99,6 +99,7 @@ exp_print_token (token_code_type code, i
     { SIZEOF, "SIZEOF" },
     { ADDR, "ADDR" },
     { LOADADDR, "LOADADDR" },
+    { CONSTANT, "CONSTANT" },
     { MAX_K, "MAX_K" },
     { REL, "relocatable" },
     { DATA_SEGMENT_ALIGN, "DATA_SEGMENT_ALIGN" },
@@ -623,6 +624,16 @@ fold_name (etree_type *tree)
       }
       break;
 
+    case CONSTANT:
+      if (strcmp (tree->name.name, "MAXPAGESIZE") == 0)
+	new_abs (bfd_emul_get_maxpagesize (default_target));
+      else if (strcmp (tree->name.name, "COMMONPAGESIZE") == 0)
+	new_abs (bfd_emul_get_commonpagesize (default_target));
+      else
+	einfo (_("%F%S: unknown constant `%s' referenced in expression\n"),
+	       tree->name.name);
+      break;
+
     default:
       FAIL ();
       break;
--- binutils/ld/ldgram.y.pagesize	2005-10-15 07:58:32.000000000 -0700
+++ binutils/ld/ldgram.y	2006-05-22 12:36:40.000000000 -0700
@@ -152,6 +152,7 @@ static int error_index;
 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
 %token EXCLUDE_FILE
+%token CONSTANT
 %type <versyms> vers_defns
 %type <versnode> vers_tag
 %type <deflist> verdep
@@ -841,6 +842,8 @@ exp	:
 			{ $$ = exp_nameop (ADDR,$3); }
 	|	LOADADDR '(' NAME ')'
 			{ $$ = exp_nameop (LOADADDR,$3); }
+	|	CONSTANT '(' NAME ')'
+			{ $$ = exp_nameop (CONSTANT,$3); }
 	|	ABSOLUTE '(' exp ')'
 			{ $$ = exp_unop (ABSOLUTE, $3); }
 	|	ALIGN_K '(' exp ')'
--- binutils/ld/ldlex.l.pagesize	2005-08-05 10:44:03.000000000 -0700
+++ binutils/ld/ldlex.l	2006-05-22 12:36:40.000000000 -0700
@@ -316,6 +316,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([
 <EXPRESSION,BOTH,SCRIPT>"PROVIDE_HIDDEN" { RTOKEN(PROVIDE_HIDDEN); }
 <EXPRESSION,BOTH,SCRIPT>"KEEP"		{ RTOKEN(KEEP); }
 <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE"  { RTOKEN(EXCLUDE_FILE); }
+<EXPRESSION,BOTH,SCRIPT>"CONSTANT"	{ RTOKEN(CONSTANT);}
 <MRI>"#".*\n?			{ ++ lineno; }
 <MRI>"\n"	                { ++ lineno;  RTOKEN(NEWLINE); }
 <MRI>"*".*			{ /* Mri comment line */ }
--- binutils/ld/ldmain.c.pagesize	2006-04-06 11:56:20.000000000 -0700
+++ binutils/ld/ldmain.c	2006-05-22 13:15:26.000000000 -0700
@@ -317,6 +317,9 @@ main (int argc, char **argv)
   link_info.warn_shared_textrel = FALSE;
   link_info.gc_sections = FALSE;
 
+  config.maxpagesize = 0;
+  config.commonpagesize = 0;
+
   ldfile_add_arch ("");
 
   config.make_executable = TRUE;
@@ -335,6 +338,13 @@ main (int argc, char **argv)
   if (config.hash_table_size != 0)
     bfd_hash_set_default_size (config.hash_table_size);
 
+  if (config.maxpagesize != 0)
+    bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
+
+  if (config.commonpagesize != 0)
+    bfd_emul_set_commonpagesize (default_target,
+				 config.commonpagesize);
+
   ldemul_set_symbols ();
 
   if (link_info.relocatable)
--- binutils/ld/testsuite/ld-elf/binutils.exp.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/binutils.exp	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,80 @@
+# Expect script for binutils tests
+#   Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by H.J. Lu (hongjiu.lu@intel.com)
+#
+
+# Make sure that binutils can correctly handle ld output in ELF.
+
+# This test can only be run on ELF platforms.
+if ![is_elf_format] {
+    return
+}
+
+proc strip_test { ld_options test } {
+    global as
+    global ld
+    global READELF
+    global strip
+    global srcdir
+    global subdir
+
+    if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
+	unresolved "$ld_options"
+	return
+    }
+
+    if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
+    catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.exp" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$strip tmpdir/$test\n"
+    catch "exec $strip tmpdir/$test" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
+    catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.out" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
+	send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
+	fail "$ld_options"
+	return
+    }
+
+    pass "$ld_options"
+}
+
+strip_test "-z max-page-size=0x200000" maxpage
+strip_test "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage
--- binutils/ld/testsuite/ld-elf/commonpage.d.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/commonpage.d	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,8 @@
+#source: maxpage.s
+#ld: -z max-page-size=0x200000 -z common-page-size=0x100000
+#readelf: -l --wide
+
+#...
+  LOAD+.*0x200000
+  LOAD+.*0x200000
+#pass
--- binutils/ld/testsuite/ld-elf/maxpage.d.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/maxpage.d	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,8 @@
+#source: maxpage.s
+#ld: -z max-page-size=0x200000
+#readelf: -l --wide
+
+#...
+  LOAD+.*0x200000
+  LOAD+.*0x200000
+#pass
--- binutils/ld/testsuite/ld-elf/maxpage.s.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/maxpage.s	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,7 @@
+	.text
+	.global _start
+_start:
+	.long	0
+
+	.data
+	.long	0

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

* PATCH: Add "-z max-page-size=xxxx"/"-z common-page-size=xxxx"
  2006-05-22 23:57   ` H. J. Lu
@ 2006-05-24  7:24     ` H. J. Lu
  2006-05-31 11:36       ` Nick Clifton
  0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-05-24  7:24 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Mon, May 22, 2006 at 01:27:06PM -0700, H. J. Lu wrote:
> On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> > Hi H. J.
> > 
> > >The current x86-64 maximum page size is 1MB. With the future
> > >development, 2MB is better for performance. Using 2MB won't break
> > >anything, except for up to 2MB gap in virtual address space per file,
> > >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> > >shouldn't be an issue for most applications. I have a patch:
> > >
> > >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> > >
> > >which can be used to implement "-z max-page-size=xxxx" so that people
> > >can control maximum page size at the link time if they prefer different
> > >maximum page size.
> > 
> > This seems to be perfectly reasonable.
> 
> 
> Here is the patch to implement "-z max-page-size=xxxx" and
> "-z common-page-size=xxxx".
> 

I have a small update. We should adjust p->p_vaddr only if m->p_vaddr
isn't valid.


H.J.
---
bfd/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* bfd.c (bfd_emul_get_maxpagesize): New.
	(bfd_elf_set_pagesize): Likewise.
	(bfd_emul_set_maxpagesize): Likewise.
	(bfd_emul_get_commonpagesize): Likewise.
	(bfd_emul_set_commonpagesize): Likewise.

	* elf-bfd.h (elf_backend_data): Add commonpagesize.
	(xvec_get_elf_backend_data): New.
	(get_elf_backend_data): Use xvec_get_elf_backend_data.

	* elf.c (assign_file_positions_for_load_sections): Set
	p->p_vaddr with m->p_vaddr if it is valid. Set p->p_align with
	m->p_align if it is valid. Adjust p->p_vaddr only if m->p_vaddr
	isn't valid.
	(copy_elf_program_header): Copy p_vaddr and p_align. Set
	p_vaddr_valid and p_align_valid to 1.

	* elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
	* elfxx-target.h (elfNN_bed): Likewise.

	* elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
	* elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
	* elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.

	* elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
	(elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.

	* targets.c (bfd_find_target): Support NULL abfd.

include/elf/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* internal.h (elf_segment_map): Add p_vaddr, p_align,
	p_vaddr_valid and p_align_valid.

ld/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/arcelf.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	* emulparams/armelf_nbsd.sh: Likewise.
	* emulparams/armelf_vxworks.sh: Likewise.
	* emulparams/armnto.sh: Likewise.
	* emulparams/armsymbian.sh: Likewise.
	* emulparams/crislinux.sh: Likewise.
	* emulparams/elf32_i860.sh: Likewise.
	* emulparams/elf32_i960.sh: Likewise.
	* emulparams/elf32am33lin.sh: Likewise.
	* emulparams/elf32bfinfd.sh: Likewise.
	* emulparams/elf32bmipn32-defs.sh: Likewise.
	* emulparams/elf32frvfd.sh: Likewise.
	* emulparams/elf32i370.sh: Likewise.
	* emulparams/elf32lppcnto.sh: Likewise.
	* emulparams/elf32mcore.sh: Likewise.
	* emulparams/elf32openrisc.sh: Likewise.
	* emulparams/elf32ppcnto.sh: Likewise.
	* emulparams/elf32ppcwindiss.sh: Likewise.
	* emulparams/elf32vax.sh: Likewise.
	* emulparams/elf32xc16x.sh: Likewise.
	* emulparams/elf32xc16xl.sh: Likewise.
	* emulparams/elf32xc16xs.sh: Likewise.
	* emulparams/elf64_aix.sh: Likewise.
	* emulparams/elf64hppa.sh: Likewise.
	* emulparams/elf64mmix.sh: Likewise.
	* emulparams/elf_i386_be.sh: Likewise.
	* emulparams/elf_i386_chaos.sh: Likewise.
	* emulparams/elf_i386_ldso.sh: Likewise.
	* emulparams/hppa64linux.sh: Likewise.
	* emulparams/hppalinux.sh: Likewise.
	* emulparams/hppaobsd.sh: Likewise.
	* emulparams/i386lynx.sh: Likewise.
	* emulparams/i386moss.sh: Likewise.
	* emulparams/i386nto.sh: Likewise.
	* emulparams/i386nw.sh: Likewise.
	* emulparams/m32relf_linux.sh: Likewise.
	* emulparams/m68kpsos.sh: Likewise.
	* emulparams/or32elf.sh: Likewise.
	* emulparams/pjelf.sh: Likewise.
	* emulparams/pjlelf.sh: Likewise.
	* emulparams/ppclynx.sh: Likewise.
	* emulparams/ppcnw.sh: Likewise.
	* emulparams/shelf32_nbsd.sh : Likewise.
	* emulparams/shelf_nbsd.sh: Likewise.
	* emulparams/shelf_nto.sh: Likewise.
	* emulparams/shlelf_nto.sh: Likewise.
	* emulparams/xtensa-config.sh: Likewise.

	* emulparams/armelf_linux.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	(COMMONPAGESIZE): Changed to "CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32_sparc.sh: Likewise.
	* emulparams/elf32bmip.sh: Likewise.
	* emulparams/elf32ppccommon.sh: Likewise.
	* emulparams/elf64_ia64.sh: Likewise.
	* emulparams/elf64_s390.sh: Likewise.
	* emulparams/elf64_sparc.sh: Likewise.
	* emulparams/elf64alpha.sh: Likewise.
	* emulparams/elf64ppc.sh: Likewise.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_i386_vxworks.sh: Likewise.
	* emulparams/elf_s390.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/shlelf32_linux.sh: Likewise.
	* emulparams/shlelf_linux.sh: Likewise.

	* emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Changed to
	"CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32btsmipn32.sh: Likewise.

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
	"-z max-page-size=" and "-z common-page-size=".
	(gld${EMULATION_NAME}_list_options): Likewise.

	* ld.h (ld_config_type): Add maxpagesize and commonpagesize.

	* ld.texinfo: Document "-z max-page-size=" and
	"-z common-page-size=".

	* ldexp.c (exp_print_token): Handle CONSTANT.
	(fold_name): Likewise.
	* ldgram.y: Likewise.
	* ldlex.l: Likewise.

	* ldmain.c (main): Initiliaze config.maxpagesize and
	config.commonpagesize. Call bfd_emul_set_maxpagesize if
	config.maxpagesize isn't 0. Call bfd_emul_set_commonpagesize if
	config.commonpagesize config.maxpagesize isn't 0.

ld/testsuite/

2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/binutils.exp: New file.
	* ld-elf/maxpage.d: Likewise.
	* ld-elf/maxpage.s: Likewise.

--- binutils/bfd/bfd.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/bfd.c	2006-05-22 12:36:40.000000000 -0700
@@ -1513,3 +1513,130 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE
      objalloc.  */
   bfd_hash_table_free (&preserve->section_htab);
 }
+
+/*
+FUNCTION
+	bfd_emul_get_maxpagesize
+
+SYNOPSIS
+ 	bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+DESCRIPTION
+	Returns the maximum page size, in bytes, as determined by
+	emulation.
+
+RETURNS
+	Returns the maximum page size in bytes for ELF, abort
+	otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_maxpagesize (const char *emul)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target != NULL
+      && target->flavour == bfd_target_elf_flavour)
+    return xvec_get_elf_backend_data (target)->maxpagesize;
+
+  abort ();
+  return 0;
+}
+
+static void
+bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size,
+		      int offset, const bfd_target *orig_target)
+{
+  if (target->flavour == bfd_target_elf_flavour)
+    {
+      const struct elf_backend_data *bed;
+
+      bed = xvec_get_elf_backend_data (target);
+      *((bfd_vma *) ((char *) bed + offset)) = size;
+    }
+
+  if (target->alternative_target
+      && target->alternative_target != orig_target)
+    bfd_elf_set_pagesize (target->alternative_target, size, offset,
+			  orig_target);
+}
+
+/*
+FUNCTION
+	bfd_emul_set_maxpagesize
+
+SYNOPSIS
+ 	void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+	For ELF, set the maximum page size for the emulation.  It is
+	a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_maxpagesize (const char *emul, bfd_vma size)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target)
+    bfd_elf_set_pagesize (target, size,
+			  offsetof (struct elf_backend_data,
+				    maxpagesize), target);
+}
+
+/*
+FUNCTION
+	bfd_emul_get_commonpagesize
+
+SYNOPSIS
+ 	bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+DESCRIPTION
+	Returns the common page size, in bytes, as determined by
+	emulation.
+
+RETURNS
+	Returns the common page size in bytes for ELF, abort otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_commonpagesize (const char *emul)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target != NULL
+      && target->flavour == bfd_target_elf_flavour)
+    return xvec_get_elf_backend_data (target)->commonpagesize;
+
+  abort ();
+  return 0;
+}
+
+/*
+FUNCTION
+	bfd_emul_set_commonpagesize
+
+SYNOPSIS
+ 	void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+	For ELF, set the common page size for the emulation.  It is
+	a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_commonpagesize (const char *emul, bfd_vma size)
+{
+  const bfd_target *target;
+
+  target = bfd_find_target (emul, NULL);
+  if (target)
+    bfd_elf_set_pagesize (target, size,
+			  offsetof (struct elf_backend_data,
+				    commonpagesize), target);
+}
--- binutils/bfd/elf-bfd.h.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/bfd/elf-bfd.h	2006-05-22 12:36:40.000000000 -0700
@@ -571,6 +571,9 @@ struct elf_backend_data
      pages at least this large.  May be smaller than maxpagesize.  */
   bfd_vma minpagesize;
 
+  /* The common page size for this backend.  */
+  bfd_vma commonpagesize;
+
   /* The BFD flags applied to sections created for dynamic linking.  */
   flagword dynamic_sec_flags;
 
@@ -1193,8 +1196,11 @@ struct bfd_elf_section_data
    && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE		\
    && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
+#define xvec_get_elf_backend_data(xvec) \
+  ((struct elf_backend_data *) (xvec)->backend_data)
+
 #define get_elf_backend_data(abfd) \
-  ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
+   xvec_get_elf_backend_data ((abfd)->xvec)
 
 /* This struct is used to pass information to routines called via
    elf_link_hash_traverse which must return failure.  */
--- binutils/bfd/elf.c.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/bfd/elf.c	2006-05-22 16:24:05.000000000 -0700
@@ -4292,7 +4292,9 @@ assign_file_positions_for_load_sections 
 	  return FALSE;
 	}
 
-      if (m->count == 0)
+      if (m->p_vaddr_valid)
+	p->p_vaddr = m->p_vaddr;
+      else if (m->count == 0)
 	p->p_vaddr = 0;
       else
 	p->p_vaddr = m->sections[0]->vma;
@@ -4304,7 +4306,9 @@ assign_file_positions_for_load_sections 
       else
 	p->p_paddr = m->sections[0]->lma;
 
-      if (p->p_type == PT_LOAD
+      if (m->p_align_valid)
+	p->p_align = m->p_align;
+      else if (p->p_type == PT_LOAD
 	  && (abfd->flags & D_PAGED) != 0)
 	p->p_align = bed->maxpagesize;
       else if (m->count == 0)
@@ -4327,16 +4331,18 @@ assign_file_positions_for_load_sections 
 	    {
 	      BFD_ASSERT (p->p_type == PT_LOAD);
 
-	      if (p->p_vaddr < (bfd_vma) off)
+	      if (!m->p_vaddr_valid)
 		{
-		  (*_bfd_error_handler)
-		    (_("%B: Not enough room for program headers, try linking with -N"),
-		     abfd);
-		  bfd_set_error (bfd_error_bad_value);
-		  return FALSE;
+		  if (p->p_vaddr < (bfd_vma) off)
+		    {
+		      (*_bfd_error_handler)
+			(_("%B: Not enough room for program headers, try linking with -N"),
+			 abfd);
+		      bfd_set_error (bfd_error_bad_value);
+		      return FALSE;
+		    }
+		  p->p_vaddr -= off;
 		}
-
-	      p->p_vaddr -= off;
 	      if (! m->p_paddr_valid)
 		p->p_paddr -= off;
 	    }
@@ -5805,6 +5811,10 @@ copy_elf_program_header (bfd *ibfd, bfd 
       map->p_flags_valid = 1;
       map->p_paddr = segment->p_paddr;
       map->p_paddr_valid = 1;
+      map->p_vaddr = segment->p_vaddr;
+      map->p_vaddr_valid = 1;
+      map->p_align = segment->p_align;
+      map->p_align_valid = 1;
 
       /* Determine if this segment contains the ELF file header
 	 and if it contains the program headers themselves.  */
--- binutils/bfd/elf32-arm.c.pagesize	2006-05-19 06:31:20.000000000 -0700
+++ binutils/bfd/elf32-arm.c	2006-05-22 12:36:40.000000000 -0700
@@ -62,7 +62,7 @@
 #define ARM_ELF_ABI_VERSION		0
 #define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
 
-static const struct elf_backend_data elf32_arm_vxworks_bed;
+static struct elf_backend_data elf32_arm_vxworks_bed;
 
 /* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
    R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
@@ -8196,6 +8196,7 @@ const struct elf_size_info elf32_arm_siz
 #define ELF_MAXPAGESIZE			0x8000
 #endif
 #define ELF_MINPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #define bfd_elf32_mkobject		        elf32_arm_mkobject
 
--- binutils/bfd/elf32-mips.c.pagesize	2006-03-27 09:05:27.000000000 -0800
+++ binutils/bfd/elf32-mips.c	2006-05-22 12:36:40.000000000 -0700
@@ -1599,6 +1599,7 @@ static const struct ecoff_debug_swap mip
 /* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
    a value of 0x1000, and we are compatible.  */
 #define ELF_MAXPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elf32-ppc.c.pagesize	2006-05-19 06:31:20.000000000 -0700
+++ binutils/bfd/elf32-ppc.c	2006-05-22 12:36:40.000000000 -0700
@@ -7436,6 +7436,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou
 #define ELF_MAXPAGESIZE		0x10000
 #endif
 #define ELF_MINPAGESIZE		0x1000
+#define ELF_COMMONPAGESIZE	0x1000
 #define elf_info_to_howto	ppc_elf_info_to_howto
 
 #ifdef  EM_CYGNUS_POWERPC
--- binutils/bfd/elf32-sh.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/elf32-sh.c	2006-05-22 12:36:40.000000000 -0700
@@ -7371,6 +7371,7 @@ sh_elf_plt_sym_val (bfd_vma i, const ase
 #define	TARGET_LITTLE_NAME		"elf32-shl-nbsd"
 #undef	ELF_MAXPAGESIZE
 #define	ELF_MAXPAGESIZE			0x10000
+#undef	ELF_COMMONPAGESIZE
 #undef	elf_symbol_leading_char
 #define	elf_symbol_leading_char		0
 #undef	elf32_bed
@@ -7388,6 +7389,8 @@ sh_elf_plt_sym_val (bfd_vma i, const ase
 #define	TARGET_LITTLE_SYM		bfd_elf32_shlin_vec
 #undef	TARGET_LITTLE_NAME
 #define	TARGET_LITTLE_NAME		"elf32-sh-linux"
+#undef	ELF_COMMONPAGESIZE
+#define	ELF_COMMONPAGESIZE		0x1000
 
 #undef	elf_backend_grok_prstatus
 #define	elf_backend_grok_prstatus	elf32_shlin_grok_prstatus
--- binutils/bfd/elf32-sh64.c.pagesize	2006-05-04 10:32:30.000000000 -0700
+++ binutils/bfd/elf32-sh64.c	2006-05-22 12:36:40.000000000 -0700
@@ -785,6 +785,7 @@ static const struct bfd_elf_special_sect
 #define	TARGET_LITTLE_NAME	"elf32-sh64l-nbsd"
 #undef	ELF_MAXPAGESIZE
 #define	ELF_MAXPAGESIZE		0x10000
+#undef	ELF_COMMONPAGESIZE
 #undef	elf_symbol_leading_char
 #define	elf_symbol_leading_char	0
 #undef	elf32_bed
@@ -803,6 +804,8 @@ static const struct bfd_elf_special_sect
 #define	TARGET_LITTLE_NAME	"elf32-sh64-linux"
 #undef	elf32_bed
 #define	elf32_bed		elf32_sh64_lin_bed
+#undef	ELF_COMMONPAGESIZE
+#define	ELF_COMMONPAGESIZE	0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elf32-sparc.c.pagesize	2006-04-05 11:10:51.000000000 -0700
+++ binutils/bfd/elf32-sparc.c	2006-05-22 12:36:40.000000000 -0700
@@ -172,6 +172,7 @@ elf32_sparc_reloc_type_class (const Elf_
 #define ELF_MACHINE_CODE EM_SPARC
 #define ELF_MACHINE_ALT1 EM_SPARC32PLUS
 #define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x2000
 
 #define bfd_elf32_bfd_merge_private_bfd_data \
 					elf32_sparc_merge_private_bfd_data
--- binutils/bfd/elf64-alpha.c.pagesize	2006-03-16 12:37:42.000000000 -0800
+++ binutils/bfd/elf64-alpha.c	2006-05-22 12:36:40.000000000 -0700
@@ -5231,6 +5231,7 @@ static const struct elf_size_info alpha_
 #define ELF_ARCH		bfd_arch_alpha
 #define ELF_MACHINE_CODE	EM_ALPHA
 #define ELF_MAXPAGESIZE	0x10000
+#define ELF_COMMONPAGESIZE	0x2000
 
 #define bfd_elf64_bfd_link_hash_table_create \
   elf64_alpha_bfd_link_hash_table_create
--- binutils/bfd/elf64-ppc.c.pagesize	2006-05-11 08:52:56.000000000 -0700
+++ binutils/bfd/elf64-ppc.c	2006-05-22 12:36:40.000000000 -0700
@@ -61,6 +61,7 @@ static bfd_vma opd_entry_value
 #define ELF_ARCH		bfd_arch_powerpc
 #define ELF_MACHINE_CODE	EM_PPC64
 #define ELF_MAXPAGESIZE		0x10000
+#define ELF_COMMONPAGESIZE	0x1000
 #define elf_info_to_howto	ppc64_elf_info_to_howto
 
 #define elf_backend_want_got_sym 0
--- binutils/bfd/elf64-sparc.c.pagesize	2005-05-04 11:17:48.000000000 -0700
+++ binutils/bfd/elf64-sparc.c	2006-05-22 12:36:40.000000000 -0700
@@ -814,6 +814,7 @@ const struct elf_size_info elf64_sparc_s
 #define TARGET_BIG_NAME	"elf64-sparc"
 #define ELF_ARCH	bfd_arch_sparc
 #define ELF_MAXPAGESIZE 0x100000
+#define ELF_COMMONPAGESIZE 0x2000
 
 /* This is the official ABI value.  */
 #define ELF_MACHINE_CODE EM_SPARCV9
--- binutils/bfd/elf64-x86-64.c.pagesize	2006-03-27 09:05:29.000000000 -0800
+++ binutils/bfd/elf64-x86-64.c	2006-05-22 12:36:40.000000000 -0700
@@ -3631,6 +3631,7 @@ static const struct bfd_elf_special_sect
 #define ELF_ARCH			    bfd_arch_i386
 #define ELF_MACHINE_CODE		    EM_X86_64
 #define ELF_MAXPAGESIZE			    0x100000
+#define ELF_COMMONPAGESIZE		    0x1000
 
 #define elf_backend_can_gc_sections	    1
 #define elf_backend_can_refcount	    1
--- binutils/bfd/elfn32-mips.c.pagesize	2005-12-05 14:28:41.000000000 -0800
+++ binutils/bfd/elfn32-mips.c	2006-05-22 12:36:40.000000000 -0700
@@ -2384,6 +2384,7 @@ static const struct ecoff_debug_swap mip
    a value of 0x1000, and we are compatible.
    FIXME: How does this affect NewABI?  */
 #define ELF_MAXPAGESIZE			0x1000
+#define ELF_COMMONPAGESIZE		0x1000
 
 #include "elf32-target.h"
 
--- binutils/bfd/elfxx-ia64.c.pagesize	2006-05-19 07:08:21.000000000 -0700
+++ binutils/bfd/elfxx-ia64.c	2006-05-22 12:36:40.000000000 -0700
@@ -5717,6 +5717,7 @@ elfNN_hpux_backend_symbol_processing (bf
 #define ELF_MACHINE_ALT1		1999	/* EAS2.3 */
 #define ELF_MACHINE_ALT2		1998	/* EAS2.2 */
 #define ELF_MAXPAGESIZE			0x10000	/* 64KB */
+#define ELF_COMMONPAGESIZE		0x4000	/* 16KB */
 
 #define elf_backend_section_from_shdr \
 	elfNN_ia64_section_from_shdr
@@ -5824,6 +5825,7 @@ elfNN_hpux_backend_symbol_processing (bf
 
 #undef  ELF_MAXPAGESIZE
 #define ELF_MAXPAGESIZE                 0x1000  /* 4K */
+#undef ELF_COMMONPAGESIZE
 
 #undef  elfNN_bed
 #define elfNN_bed elfNN_ia64_hpux_bed
--- binutils/bfd/elfxx-target.h.pagesize	2006-04-25 14:35:45.000000000 -0700
+++ binutils/bfd/elfxx-target.h	2006-05-22 12:36:40.000000000 -0700
@@ -294,6 +294,10 @@
 #define ELF_MINPAGESIZE ELF_MAXPAGESIZE
 #endif
 
+#ifndef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
+#endif
+
 #ifndef ELF_DYNAMIC_SEC_FLAGS
 /* Note that we set the SEC_IN_MEMORY flag for these sections.  */
 #define ELF_DYNAMIC_SEC_FLAGS			\
@@ -556,12 +560,13 @@
 extern const struct elf_size_info _bfd_elfNN_size_info;
 
 #ifndef INCLUDED_TARGET_FILE
-static const struct elf_backend_data elfNN_bed =
+static struct elf_backend_data elfNN_bed =
 {
   ELF_ARCH,			/* arch */
   ELF_MACHINE_CODE,		/* elf_machine_code */
   ELF_MAXPAGESIZE,		/* maxpagesize */
   ELF_MINPAGESIZE,		/* minpagesize */
+  ELF_COMMONPAGESIZE,		/* commonpagesize */
   ELF_DYNAMIC_SEC_FLAGS,	/* dynamic_sec_flags */
   elf_info_to_howto,
   elf_info_to_howto_rel,
--- binutils/bfd/targets.c.pagesize	2006-04-05 11:10:51.000000000 -0700
+++ binutils/bfd/targets.c	2006-05-22 12:36:40.000000000 -0700
@@ -1307,14 +1307,15 @@ SYNOPSIS
 
 DESCRIPTION
 	Return a pointer to the transfer vector for the object target
-	named @var{target_name}.  If @var{target_name} is <<NULL>>, choose the
-	one in the environment variable <<GNUTARGET>>; if that is null or not
-	defined, then choose the first entry in the target list.
-	Passing in the string "default" or setting the environment
-	variable to "default" will cause the first entry in the target
-	list to be returned, and "target_defaulted" will be set in the
-	BFD.  This causes <<bfd_check_format>> to loop over all the
-	targets to find the one that matches the file being read.
+	named @var{target_name}.  If @var{target_name} is <<NULL>>,
+	choose the one in the environment variable <<GNUTARGET>>; if
+	that is null or not defined, then choose the first entry in the
+	target list.  Passing in the string "default" or setting the
+	environment variable to "default" will cause the first entry in
+	the target list to be returned, and "target_defaulted" will be
+	set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
+	<<bfd_check_format>> to loop over all the targets to find the
+	one that matches the file being read.
 */
 
 const bfd_target *
@@ -1331,21 +1332,27 @@ bfd_find_target (const char *target_name
   /* This is safe; the vector cannot be null.  */
   if (targname == NULL || strcmp (targname, "default") == 0)
     {
-      abfd->target_defaulted = TRUE;
       if (bfd_default_vector[0] != NULL)
-	abfd->xvec = bfd_default_vector[0];
+	target = bfd_default_vector[0];
       else
-	abfd->xvec = bfd_target_vector[0];
-      return abfd->xvec;
+	target = bfd_target_vector[0];
+      if (abfd)
+	{
+	  abfd->xvec = target;
+	  abfd->target_defaulted = TRUE;
+	}
+      return target;
     }
 
-  abfd->target_defaulted = FALSE;
+  if (abfd)
+    abfd->target_defaulted = FALSE;
 
   target = find_target (targname);
   if (target == NULL)
     return NULL;
 
-  abfd->xvec = target;
+  if (abfd)
+    abfd->xvec = target;
   return target;
 }
 
--- binutils/include/elf/internal.h.pagesize	2006-02-10 08:59:44.000000000 -0800
+++ binutils/include/elf/internal.h	2006-05-22 12:47:06.000000000 -0700
@@ -235,12 +235,22 @@ struct elf_segment_map
   unsigned long p_flags;
   /* Program segment physical address.  */
   bfd_vma p_paddr;
+  /* Program segment virtual address.  */
+  bfd_vma p_vaddr;
+  /* Program segment alignment. */
+  bfd_vma p_align;
   /* Whether the p_flags field is valid; if not, the flags are based
      on the section flags.  */
   unsigned int p_flags_valid : 1;
   /* Whether the p_paddr field is valid; if not, the physical address
      is based on the section lma values.  */
   unsigned int p_paddr_valid : 1;
+  /* Whether the p_vaddr field is valid; if not, the virtual address
+     is based on the section vma values.  */
+  unsigned int p_vaddr_valid : 1;
+  /* Whether the p_align field is valid; if not, the segment alignment
+     is based on the default maximum page size.  */
+  unsigned int p_align_valid : 1;
   /* Whether this segment includes the file header.  */
   unsigned int includes_filehdr : 1;
   /* Whether this segment includes the program headers.  */
--- binutils/ld/emulparams/arcelf.sh.pagesize	2006-05-19 09:31:04.000000000 -0700
+++ binutils/ld/emulparams/arcelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-littlearc"
 LITTLE_OUTPUT_FORMAT="elf32-littlearc"
 BIG_OUTPUT_FORMAT="elf32-bigarc"
 TEXT_START_ADDR=0x0
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0
 ARCH=arc
 MACHINE=
--- binutils/ld/emulparams/armelf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,8 +3,8 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-littlearm"
 BIG_OUTPUT_FORMAT="elf32-bigarm"
 LITTLE_OUTPUT_FORMAT="elf32-littlearm"
-MAXPAGESIZE=0x8000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 TEMPLATE_NAME=elf32
 EXTRA_EM_FILE=armelf
 GENERATE_SHLIB_SCRIPT=yes
--- binutils/ld/emulparams/armelf_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 . ${srcdir}/emulparams/armelf.sh
-MAXPAGESIZE=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x00008000
 TARGET2_TYPE=got-rel
 
--- binutils/ld/emulparams/armelf_vxworks.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armelf_vxworks.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,5 +2,5 @@
 OUTPUT_FORMAT="elf32-littlearm-vxworks"
 BIG_OUTPUT_FORMAT="elf32-bigarm-vxworks"
 LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 . ${srcdir}/emulparams/vxworks.sh
--- binutils/ld/emulparams/armnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armnto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -17,7 +17,7 @@ GENERATE_SHLIB_SCRIPT=yes
 
 ARCH=arm
 MACHINE=
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 ENTRY=_start
 
--- binutils/ld/emulparams/armsymbian.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/armsymbian.sh	2006-05-22 12:36:40.000000000 -0700
@@ -19,7 +19,4 @@ OTHER_READONLY_SECTIONS="
   ${RELOCATING+ __exidx_end = .; }
   ${RELOCATING+ .ARM.exidx\$\$Limit = . ; }"
 
-# This value should match ELF_MAXPAGESIZE in BFD.  Otherwise, elf.c
-# will not place read-write sections in a separate ELF segment from
-# the read-only sections.
-MAXPAGESIZE=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/bfin.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/bfin.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-bfin"
 TEXT_START_ADDR=0x0
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TARGET_PAGE_SIZE=0x1000
 NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
 ARCH=bfin
--- binutils/ld/emulparams/crislinux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/crislinux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -14,7 +14,7 @@ GENERATE_SHLIB_SCRIPT=yes
 # Is this high enough and low enough?
 TEXT_START_ADDR=0x80000
 
-MAXPAGESIZE=8192
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # We don't do the hoops through DEFINED to provide [_]*start, as it
 # doesn't work with --gc-sections, and the start-name is pretty fixed
--- binutils/ld/emulparams/elf32_i860.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_i860.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,5 +5,5 @@ BIG_OUTPUT_FORMAT="elf32-i860"
 LITTLE_OUTPUT_FORMAT="elf32-i860-little"
 TEXT_START_ADDR=0
 PAGE_SIZE=0x1000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i860
--- binutils/ld/emulparams/elf32_i960.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_i960.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,4 +5,4 @@ ARCH=i960
 MACHINE=
 TEXT_START_ADDR=0
 EMBEDDED=yes
-MAXPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/elf32_sparc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32_sparc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sparc"
 TEXT_START_ADDR=0x10000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x10000
 ALIGNMENT=8
 ARCH=sparc
--- binutils/ld/emulparams/elf32am33lin.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32am33lin.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-am33lin"
 TEXT_START_ADDR=0x8000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x8000000
 ARCH=mn10300
 MACHINE=
--- binutils/ld/emulparams/elf32bfinfd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bfinfd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 . ${srcdir}/emulparams/bfin.sh
 unset STACK_ADDR
 OUTPUT_FORMAT="elf32-bfinfdpic"
-MAXPAGESIZE=0x4000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
--- binutils/ld/emulparams/elf32bmip.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmip.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,8 +7,8 @@ BIG_OUTPUT_FORMAT="elf32-bigmips"
 LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 TEXT_START_ADDR=0x0400000
 test -n "${EMBEDDED}" || DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0400000
 SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
--- binutils/ld/emulparams/elf32bmipn32-defs.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmipn32-defs.sh	2006-05-22 12:36:40.000000000 -0700
@@ -33,7 +33,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 
 TEXT_START_ADDR=0x10000000
-MAXPAGESIZE=0x100000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=__start
 
 # GOT-related settings.  
--- binutils/ld/emulparams/elf32bmipn32.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32bmipn32.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-nbigmips"
 BIG_OUTPUT_FORMAT="elf32-nbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-nlittlemips"
 SHLIB_TEXT_START_ADDR=0x5ffe0000
-COMMONPAGESIZE=0x1000
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 
 # IRIX6 defines these symbols.  0x34 is the size of the ELF header.
 EXECUTABLE_SYMBOLS="
--- binutils/ld/emulparams/elf32btsmipn32.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32btsmipn32.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 OUTPUT_FORMAT="elf32-ntradbigmips"
 BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
-COMMONPAGESIZE=0x1000
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 
 # Magic sections.
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
--- binutils/ld/emulparams/elf32frvfd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32frvfd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 . ${srcdir}/emulparams/elf32frv.sh
 unset STACK_ADDR
 OUTPUT_FORMAT="elf32-frvfdpic"
-MAXPAGESIZE=0x4000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
--- binutils/ld/emulparams/elf32i370.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32i370.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ GENERATE_SHLIB_SCRIPT=yes
 SCRIPT_NAME=elfi370
 OUTPUT_FORMAT="elf32-i370"
 TEXT_START_ADDR=0x01800000
-MAXPAGESIZE=0x40000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i370
 MACHINE=
--- binutils/ld/emulparams/elf32lppcnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32lppcnto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 . ${srcdir}/emulparams/elf32ppc.sh
 OUTPUT_FORMAT="elf32-powerpcle"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x48040000
 
--- binutils/ld/emulparams/elf32mcore.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32mcore.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ BIG_OUTPUT_FORMAT="elf32-mcore-big"
 LITTLE_OUTPUT_FORMAT="elf32-mcore-little"
 PAGE_SIZE=0x1000
 TARGET_PAGE_SIZE=0x400
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0
 NONPAGED_TEXT_START_ADDR=0
 ARCH=mcore
--- binutils/ld/emulparams/elf32openrisc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32openrisc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-openrisc"
 TEXT_START_ADDR=0x10000
 ARCH=openrisc
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
 NOP=0x15000000
--- binutils/ld/emulparams/elf32ppccommon.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppccommon.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,8 +6,8 @@ GENERATE_PIE_SCRIPT=yes
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-powerpc"
 TEXT_START_ADDR=0x01800000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=powerpc:common
 MACHINE=
 EXECUTABLE_SYMBOLS='PROVIDE (__stack = 0); PROVIDE (___stack = 0);'
--- binutils/ld/emulparams/elf32ppcnto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppcnto.sh	2006-05-22 13:00:47.000000000 -0700
@@ -1,4 +1,4 @@
 . ${srcdir}/emulparams/elf32ppc.sh
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x48040000
 
--- binutils/ld/emulparams/elf32ppcwindiss.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32ppcwindiss.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ OUTPUT_FORMAT="elf32-powerpc"
 ARCH=powerpc
 MACHINE=
 EMBEDDED=yes
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # The data below is taken from the windiss.dld linker script that comes with
 # the Diab linker.
--- binutils/ld/emulparams/elf32vax.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32vax.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-vax"
 TEXT_START_ADDR=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=vax
 MACHINE=
--- binutils/ld/emulparams/elf32xc16x.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16x.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0x00400
 ARCH=xc16x
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf32xc16xl.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16xl.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0xc00300
 ARCH=xc16x:xc16xl
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf32xc16xs.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf32xc16xs.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,6 +3,6 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf32-xc16x"
 TEXT_START_ADDR=0xc00300
 ARCH=xc16x:xc16xs
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ENTRY=_start
 EMBEDDED=yes
--- binutils/ld/emulparams/elf64_aix.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_aix.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@ TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf64-ia64-aix-little"
 ARCH=ia64
 MACHINE=
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR="0x10000000"
 DATA_ADDR="ALIGN (0x10000000) + (. & (${MAXPAGESIZE} - 1))"
 GENERATE_SHLIB_SCRIPT=yes
--- binutils/ld/emulparams/elf64_ia64.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_ia64.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,12 +6,12 @@ EXTRA_EM_FILE=ia64elf
 OUTPUT_FORMAT="elf64-ia64-little"
 ARCH=ia64
 MACHINE=
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 # FIXME: It interferes with linker relaxation. Disable it until it is
 # fixed.
 if test "0" = "1" -a -n "$CREATE_SHLIB"; then
   # Optimize shared libraries for 16K page size
-  COMMONPAGESIZE=0x4000
+  COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 fi
 TEXT_START_ADDR="0x4000000000000000"
 DATA_ADDR="0x6000000000000000 + (. & (${MAXPAGESIZE} - 1))"
--- binutils/ld/emulparams/elf64_s390.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_s390.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-s390"
 TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x80000000
 ARCH="s390:64-bit"
 MACHINE=
--- binutils/ld/emulparams/elf64_sparc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64_sparc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 TEMPLATE_NAME=elf32
 OUTPUT_FORMAT="elf64-sparc"
-MAXPAGESIZE=0x100000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="sparc:v9"
 MACHINE=
 DATA_PLT=
--- binutils/ld/emulparams/elf64alpha.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64alpha.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,8 +5,8 @@ TEMPLATE_NAME=elf32
 EXTRA_EM_FILE=alphaelf
 OUTPUT_FORMAT="elf64-alpha"
 TEXT_START_ADDR="0x120000000"
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR="0x120000000"
 ARCH=alpha
 MACHINE=
--- binutils/ld/emulparams/elf64hppa.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64hppa.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ LIB_PATH="=/usr/lib/pa20_64:=/opt/langto
 TEXT_START_ADDR=0x4000000000001000
 DATA_ADDR=0x8000000000001000
 TARGET_PAGE_SIZE=4096
-MAXPAGESIZE=4096
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # The HP dynamic linker actually requires you set the start of text and
 # data to some reasonable value.  Of course nobody knows what reasoanble
--- binutils/ld/emulparams/elf64mmix.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64mmix.sh	2006-05-22 12:36:40.000000000 -0700
@@ -12,11 +12,7 @@ TEXT_START_ADDR='DEFINED (__.MMIX.start.
 TEXT_BASE_ADDRESS=$TEXT_START_ADDR
 DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
 
-# Setting this anywhere near the quite reasonable value of 0x10000
-# causes the binary to bloat to reach page alignment between segments.
-# Let's just have a 256-byte default page alignment.  Having some
-# alignment at all gives a warm feeling but not much more.
-MAXPAGESIZE=256
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=mmix
 MACHINE=
 COMPILE_IN=yes
--- binutils/ld/emulparams/elf64ppc.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf64ppc.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,8 +7,8 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf64-powerpc"
 TEXT_START_ADDR=0x10000000
 #SEGMENT_SIZE=0x10000000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=powerpc:common64
 MACHINE=
 NOP=0x60000000
--- binutils/ld/emulparams/elf_i386.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_be.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_be.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x80000000
 #SHLIB_TEXT_START_ADDR=0x80000000
 NONPAGED_TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i386
 MACHINE=
 NOP=0x90909090
--- binutils/ld/emulparams/elf_i386_chaos.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_chaos.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf_chaos
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x40000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x40000000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_ldso.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_ldso.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_i386_vxworks.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_i386_vxworks.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386-vxworks"
 TEXT_START_ADDR=0x08048000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/elf_s390.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_s390.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,8 +1,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-s390"
 TEXT_START_ADDR=0x00400000
-MAXPAGESIZE=0x1000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x00400000
 ARCH="s390:31-bit"
 MACHINE=
--- binutils/ld/emulparams/elf_x86_64.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_x86_64.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-x86-64"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x100000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x400000
 ARCH="i386:x86-64"
 MACHINE=
--- binutils/ld/emulparams/hppa64linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppa64linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -7,7 +7,7 @@ ELFSIZE=64
 OUTPUT_FORMAT="elf64-hppa-linux"
 TEXT_START_ADDR=0x10000
 TARGET_PAGE_SIZE=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=hppa
 MACHINE=hppa2.0w
 ENTRY="main"
--- binutils/ld/emulparams/hppalinux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppalinux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -6,7 +6,7 @@ ELFSIZE=32
 OUTPUT_FORMAT="elf32-hppa-linux"
 TEXT_START_ADDR=0x10000
 TARGET_PAGE_SIZE=0x10000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=hppa
 MACHINE=hppa1.1    # We use 1.1 specific features.
 NOP=0x08000240
--- binutils/ld/emulparams/hppaobsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/hppaobsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,4 +3,4 @@
 OUTPUT_FORMAT="elf32-hppa"
 TEXT_START_ADDR=0x1000
 TARGET_PAGE_SIZE=0x1000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emulparams/i386lynx.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386lynx.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,7 +4,7 @@ ENTRY=_main
 TEXT_BASE=0x0
 DYN_TEXT_BASE=0x00400000
 TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/i386moss.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386moss.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x00002000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x00002000
 ARCH=i386
 MACHINE=
--- binutils/ld/emulparams/i386nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,7 +2,7 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08048000
 TEXT_START_SYMBOLS='_btext = .;'
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08048000
 #SHLIB_TEXT_START_ADDR=0xb0300000
 ARCH=i386
--- binutils/ld/emulparams/i386nw.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/i386nw.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=nw
 OUTPUT_FORMAT="elf32-i386"
 TEXT_START_ADDR=0x08000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x08000000
 ARCH=i386
 NOP=0x90909090
--- binutils/ld/emulparams/m32relf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m32relf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf32-m32r-linux"
 TEXT_START_ADDR=0x1000
 ARCH=m32r
 MACHINE=
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 # Hmmm, there's got to be a better way.  This sets the stack to the
 # top of simulator memory (32MB).
--- binutils/ld/emulparams/m68kelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m68kelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-m68k"
 TEXT_START_ADDR=0x80000000
-MAXPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
 ARCH=m68k
 MACHINE=
--- binutils/ld/emulparams/m68kpsos.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/m68kpsos.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,6 +1,6 @@
 SCRIPT_NAME=psos
 OUTPUT_FORMAT="elf32-m68k"
 TEXT_START_ADDR=0x20000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=m68k
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/or32elf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/or32elf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,5 +2,5 @@ SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-or32"
 TEXT_START_ADDR=0x1000000
 TARGET_PAGE_SIZE=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=or32
--- binutils/ld/emulparams/pjelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/pjelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-pj"
 TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=pj
--- binutils/ld/emulparams/pjlelf.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/pjlelf.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,5 +1,5 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-pjl"
 TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=pj
--- binutils/ld/emulparams/ppclynx.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/ppclynx.sh	2006-05-22 12:36:40.000000000 -0700
@@ -3,7 +3,7 @@ OUTPUT_FORMAT="elf32-powerpc"
 TEXT_BASE=0x00002000
 DYN_TEXT_BASE=0x00400000
 TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})"
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x1000
 ARCH=powerpc
 MACHINE=
--- binutils/ld/emulparams/ppcnw.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/ppcnw.sh	2006-05-22 12:36:40.000000000 -0700
@@ -2,6 +2,6 @@ SCRIPT_NAME=nw
 OUTPUT_FORMAT="elf32-powerpc"
 TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 NONPAGED_TEXT_START_ADDR=0x0400000
 ARCH=powerpc
--- binutils/ld/emulparams/shelf32_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf32_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 
 OUTPUT_FORMAT="elf32-sh64-nbsd"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 ENTRY=__start
 
--- binutils/ld/emulparams/shelf_nbsd.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf_nbsd.sh	2006-05-22 12:36:40.000000000 -0700
@@ -5,7 +5,7 @@
 
 OUTPUT_FORMAT="elf32-sh-nbsd"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 
 DATA_START_SYMBOLS='__data_start = . ;';
 
--- binutils/ld/emulparams/shelf_nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shelf_nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh"
 TEXT_START_ADDR=0x08040000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/shlelf32_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf32_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,8 +4,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh64-linux"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=sh
 MACHINE=sh5
 ALIGNMENT=8
--- binutils/ld/emulparams/shlelf_linux.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf_linux.sh	2006-05-22 12:36:40.000000000 -0700
@@ -4,8 +4,8 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-sh-linux"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/shlelf_nto.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/shlelf_nto.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,7 +1,7 @@
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-shl"
 TEXT_START_ADDR=0x08040000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=sh
 MACHINE=
 TEMPLATE_NAME=elf32
--- binutils/ld/emulparams/xtensa-config.sh.pagesize	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/xtensa-config.sh	2006-05-22 12:36:40.000000000 -0700
@@ -1,3 +1,3 @@
 # Xtensa configuration settings.
 
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
--- binutils/ld/emultempl/elf32.em.pagesize	2006-04-14 14:44:47.000000000 -0700
+++ binutils/ld/emultempl/elf32.em	2006-05-22 12:36:40.000000000 -0700
@@ -1846,6 +1846,22 @@ cat >>e${EMULATION_NAME}.c <<EOF
 	link_info.relro = TRUE;
       else if (strcmp (optarg, "norelro") == 0)
 	link_info.relro = FALSE;
+      else if (strncmp (optarg, "max-page-size=", 14) == 0)
+	{
+	  char *end;
+	  config.maxpagesize = strtoul (optarg + 14, &end, 0);
+	  if (*end)
+	    einfo (_("%P%F: invalid maxium page size \`%s'\n"),
+		   optarg + 14);
+	}
+      else if (strncmp (optarg, "common-page-size=", 17) == 0)
+	{
+	  char *end;
+	  config.commonpagesize = strtoul (optarg + 17, &end, 0);
+	  if (*end)
+	    einfo (_("%P%F: invalid common page size \`%s'\n"),
+		   optarg + 17);
+	}
       /* What about the other Solaris -z options? FIXME.  */
       break;
 EOF
@@ -1897,6 +1913,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
   fprintf (file, _("  -z now\t\tMark object non-lazy runtime binding\n"));
   fprintf (file, _("  -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t  at runtime\n"));
   fprintf (file, _("  -z relro\t\tCreate RELRO program header\n"));
+  fprintf (file, _("  -z max-page-size=SIZE\tSet maximum page size to SIZE\n"));
+  fprintf (file, _("  -z common-page-size=SIZE\n\t\t\tSet common page size to SIZE\n"));
   fprintf (file, _("  -z KEYWORD\t\tIgnored for Solaris compatibility\n"));
 EOF
 fi
--- binutils/ld/ld.h.pagesize	2005-09-30 08:45:16.000000000 -0700
+++ binutils/ld/ld.h	2006-05-22 12:36:40.000000000 -0700
@@ -270,6 +270,12 @@ typedef struct {
 
   /* The size of the hash table to use.  */
   bfd_size_type hash_table_size;
+
+  /* The maximum page size for ELF.  */
+  bfd_vma maxpagesize;
+
+  /* The common page size for ELF.  */
+  bfd_vma commonpagesize;
 } ld_config_type;
 
 extern ld_config_type config;
--- binutils/ld/ld.texinfo.pagesize	2006-05-19 06:31:21.000000000 -0700
+++ binutils/ld/ld.texinfo	2006-05-22 12:36:40.000000000 -0700
@@ -1007,6 +1007,12 @@ Marks the object may contain $ORIGIN.
 @item relro
 Create an ELF @code{PT_GNU_RELRO} segment header in the object.
 
+@item max-page-size=@var{value}
+Set the emulation maximum page size to @var{value}.
+
+@item common-page-size=@var{value}
+Set the emulation common page size to @var{value}.
+
 @end table
 
 Other keywords are ignored for Solaris compatibility.  
--- binutils/ld/ldexp.c.pagesize	2005-12-08 07:06:38.000000000 -0800
+++ binutils/ld/ldexp.c	2006-05-22 13:16:55.000000000 -0700
@@ -99,6 +99,7 @@ exp_print_token (token_code_type code, i
     { SIZEOF, "SIZEOF" },
     { ADDR, "ADDR" },
     { LOADADDR, "LOADADDR" },
+    { CONSTANT, "CONSTANT" },
     { MAX_K, "MAX_K" },
     { REL, "relocatable" },
     { DATA_SEGMENT_ALIGN, "DATA_SEGMENT_ALIGN" },
@@ -623,6 +624,16 @@ fold_name (etree_type *tree)
       }
       break;
 
+    case CONSTANT:
+      if (strcmp (tree->name.name, "MAXPAGESIZE") == 0)
+	new_abs (bfd_emul_get_maxpagesize (default_target));
+      else if (strcmp (tree->name.name, "COMMONPAGESIZE") == 0)
+	new_abs (bfd_emul_get_commonpagesize (default_target));
+      else
+	einfo (_("%F%S: unknown constant `%s' referenced in expression\n"),
+	       tree->name.name);
+      break;
+
     default:
       FAIL ();
       break;
--- binutils/ld/ldgram.y.pagesize	2005-10-15 07:58:32.000000000 -0700
+++ binutils/ld/ldgram.y	2006-05-22 12:36:40.000000000 -0700
@@ -152,6 +152,7 @@ static int error_index;
 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
 %token EXCLUDE_FILE
+%token CONSTANT
 %type <versyms> vers_defns
 %type <versnode> vers_tag
 %type <deflist> verdep
@@ -841,6 +842,8 @@ exp	:
 			{ $$ = exp_nameop (ADDR,$3); }
 	|	LOADADDR '(' NAME ')'
 			{ $$ = exp_nameop (LOADADDR,$3); }
+	|	CONSTANT '(' NAME ')'
+			{ $$ = exp_nameop (CONSTANT,$3); }
 	|	ABSOLUTE '(' exp ')'
 			{ $$ = exp_unop (ABSOLUTE, $3); }
 	|	ALIGN_K '(' exp ')'
--- binutils/ld/ldlex.l.pagesize	2005-08-05 10:44:03.000000000 -0700
+++ binutils/ld/ldlex.l	2006-05-22 12:36:40.000000000 -0700
@@ -316,6 +316,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([
 <EXPRESSION,BOTH,SCRIPT>"PROVIDE_HIDDEN" { RTOKEN(PROVIDE_HIDDEN); }
 <EXPRESSION,BOTH,SCRIPT>"KEEP"		{ RTOKEN(KEEP); }
 <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE"  { RTOKEN(EXCLUDE_FILE); }
+<EXPRESSION,BOTH,SCRIPT>"CONSTANT"	{ RTOKEN(CONSTANT);}
 <MRI>"#".*\n?			{ ++ lineno; }
 <MRI>"\n"	                { ++ lineno;  RTOKEN(NEWLINE); }
 <MRI>"*".*			{ /* Mri comment line */ }
--- binutils/ld/ldmain.c.pagesize	2006-04-06 11:56:20.000000000 -0700
+++ binutils/ld/ldmain.c	2006-05-22 13:15:26.000000000 -0700
@@ -317,6 +317,9 @@ main (int argc, char **argv)
   link_info.warn_shared_textrel = FALSE;
   link_info.gc_sections = FALSE;
 
+  config.maxpagesize = 0;
+  config.commonpagesize = 0;
+
   ldfile_add_arch ("");
 
   config.make_executable = TRUE;
@@ -335,6 +338,13 @@ main (int argc, char **argv)
   if (config.hash_table_size != 0)
     bfd_hash_set_default_size (config.hash_table_size);
 
+  if (config.maxpagesize != 0)
+    bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
+
+  if (config.commonpagesize != 0)
+    bfd_emul_set_commonpagesize (default_target,
+				 config.commonpagesize);
+
   ldemul_set_symbols ();
 
   if (link_info.relocatable)
--- binutils/ld/testsuite/ld-elf/binutils.exp.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/binutils.exp	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,80 @@
+# Expect script for binutils tests
+#   Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by H.J. Lu (hongjiu.lu@intel.com)
+#
+
+# Make sure that binutils can correctly handle ld output in ELF.
+
+# This test can only be run on ELF platforms.
+if ![is_elf_format] {
+    return
+}
+
+proc strip_test { ld_options test } {
+    global as
+    global ld
+    global READELF
+    global strip
+    global srcdir
+    global subdir
+
+    if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
+	unresolved "$ld_options"
+	return
+    }
+
+    if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
+    catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.exp" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$strip tmpdir/$test\n"
+    catch "exec $strip tmpdir/$test" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
+    catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.out" got
+    if ![string match "" $got] then {
+	send_log "$got\n"
+	unresolved "$ld_options"
+	return
+    }
+
+    if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
+	send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
+	fail "$ld_options"
+	return
+    }
+
+    pass "$ld_options"
+}
+
+strip_test "-z max-page-size=0x200000" maxpage
+strip_test "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage
--- binutils/ld/testsuite/ld-elf/commonpage.d.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/commonpage.d	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,8 @@
+#source: maxpage.s
+#ld: -z max-page-size=0x200000 -z common-page-size=0x100000
+#readelf: -l --wide
+
+#...
+  LOAD+.*0x200000
+  LOAD+.*0x200000
+#pass
--- binutils/ld/testsuite/ld-elf/maxpage.d.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/maxpage.d	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,8 @@
+#source: maxpage.s
+#ld: -z max-page-size=0x200000
+#readelf: -l --wide
+
+#...
+  LOAD+.*0x200000
+  LOAD+.*0x200000
+#pass
--- binutils/ld/testsuite/ld-elf/maxpage.s.pagesize	2006-05-22 12:36:40.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/maxpage.s	2006-05-22 12:36:40.000000000 -0700
@@ -0,0 +1,7 @@
+	.text
+	.global _start
+_start:
+	.long	0
+
+	.data
+	.long	0

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

* PATCH: Change x86-64 maximum page size to 2MB
  2006-05-19 12:39 ` Nick Clifton
  2006-05-22 23:57   ` H. J. Lu
@ 2006-05-26  4:33   ` H. J. Lu
  2006-05-26 21:48     ` Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-05-26  4:33 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, discuss

On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> Hi H. J.
> 
> >The current x86-64 maximum page size is 1MB. With the future
> >development, 2MB is better for performance. Using 2MB won't break
> >anything, except for up to 2MB gap in virtual address space per file,
> >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> >shouldn't be an issue for most applications. I have a patch:
> >
> >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> >
> >which can be used to implement "-z max-page-size=xxxx" so that people
> >can control maximum page size at the link time if they prefer different
> >maximum page size.
> 
> This seems to be perfectly reasonable.

I tested this patch on gcc, glibc, 2.4 and 2.6 kernels. I will check
it in shortly.


H.J.
----
bfd/

2006-05-25  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (ELF_MAXPAGESIZE): Updated to 0x200000.

ld/

2006-05-25  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/elf_x86_64.sh (MAXPAGESIZE): Updated to 0x200000.


ld/testsuite/

2006-05-25  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-x86-64/tlsbin.dd: Updated for 2MB maximum page size.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlsbin.sd: Likewise.
	* ld-x86-64/tlsbin.td: Likewise.
	* ld-x86-64/tlsbindesc.dd: Likewise.
	* ld-x86-64/tlsbindesc.rd: Likewise.
	* ld-x86-64/tlsbindesc.sd: Likewise.
	* ld-x86-64/tlsbindesc.td: Likewise.
	* ld-x86-64/tlsdesc.dd: Likewise.
	* ld-x86-64/tlsdesc.pd: Likewise.
	* ld-x86-64/tlsdesc.rd: Likewise.
	* ld-x86-64/tlsdesc.sd: Likewise.
	* ld-x86-64/tlsdesc.td: Likewise.
	* ld-x86-64/tlsgdesc.dd: Likewise.
	* ld-x86-64/tlspic.dd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
	* ld-x86-64/tlspic.sd: Likewise.
	* ld-x86-64/tlspic.td: Likewise.

--- binutils/bfd/elf64-x86-64.c.2mb	2006-03-27 09:05:29.000000000 -0800
+++ binutils/bfd/elf64-x86-64.c	2006-05-25 07:13:10.000000000 -0700
@@ -3630,7 +3630,7 @@ static const struct bfd_elf_special_sect
 #define TARGET_LITTLE_NAME		    "elf64-x86-64"
 #define ELF_ARCH			    bfd_arch_i386
 #define ELF_MACHINE_CODE		    EM_X86_64
-#define ELF_MAXPAGESIZE			    0x100000
+#define ELF_MAXPAGESIZE			    0x200000
 
 #define elf_backend_can_gc_sections	    1
 #define elf_backend_can_refcount	    1
--- binutils/ld/emulparams/elf_x86_64.sh.2mb	2006-05-19 09:31:05.000000000 -0700
+++ binutils/ld/emulparams/elf_x86_64.sh	2006-05-25 07:31:05.000000000 -0700
@@ -2,7 +2,7 @@ SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-x86-64"
 TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x100000
+MAXPAGESIZE=0x200000
 COMMONPAGESIZE=0x1000
 NONPAGED_TEXT_START_ADDR=0x400000
 ARCH="i386:x86-64"
--- binutils/ld/testsuite/ld-x86-64/tlsbin.dd.2mb	2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlsbin.dd	2006-05-25 09:11:56.000000000 -0700
@@ -24,7 +24,7 @@ Disassembly of section .text:
 #  GD -> IE because variable is not defined in executable
   401004:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
   40100b:	00 00 *
-  40100d:	48 03 05 d4 03 10 00[ 	]+add    1049556\(%rip\),%rax +# 5013e8 <.*>
+  40100d:	48 03 05 d4 03 20 00[ 	]+add    2098132\(%rip\),%rax +# 6013e8 <.*>
 #				-> R_X86_64_TPOFF64	sG1
   401014:	90[ 	]+nop *
   401015:	90[ 	]+nop *
@@ -34,7 +34,7 @@ Disassembly of section .text:
 #  the variable is referenced through IE too
   401018:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
   40101f:	00 00 *
-  401021:	48 03 05 b0 03 10 00[ 	]+add    1049520\(%rip\),%rax +# 5013d8 <.*>
+  401021:	48 03 05 b0 03 20 00[ 	]+add    2098096\(%rip\),%rax +# 6013d8 <.*>
 #				-> R_X86_64_TPOFF64	sG2
   401028:	90[ 	]+nop *
   401029:	90[ 	]+nop *
@@ -102,7 +102,7 @@ Disassembly of section .text:
   4010b3:	00 00 *
   4010b5:	90[ 	]+nop *
   4010b6:	90[ 	]+nop *
-  4010b7:	4c 03 0d 1a 03 10 00[ 	]+add    1049370\(%rip\),%r9 +# 5013d8 <.*>
+  4010b7:	4c 03 0d 1a 03 20 00[ 	]+add    2097946\(%rip\),%r9 +# 6013d8 <.*>
 #				-> R_X86_64_TPOFF64	sG2
   4010be:	90[ 	]+nop *
   4010bf:	90[ 	]+nop *
@@ -143,7 +143,7 @@ Disassembly of section .text:
   401103:	90[ 	]+nop *
 #  Direct access through %fs
 #  IE against global var
-  401104:	48 8b 0d c5 02 10 00[ 	]+mov    1049285\(%rip\),%rcx +# 5013d0 <.*>
+  401104:	48 8b 0d c5 02 20 00[ 	]+mov    2097861\(%rip\),%rcx +# 6013d0 <.*>
 #				-> R_X86_64_TPOFF64	sG5
   40110b:	90[ 	]+nop *
   40110c:	90[ 	]+nop *
@@ -186,7 +186,7 @@ Disassembly of section .text:
   401147:	00 00 *
   401149:	90[ 	]+nop *
   40114a:	90[ 	]+nop *
-  40114b:	4c 03 1d 8e 02 10 00[ 	]+add    1049230\(%rip\),%r11 +# 5013e0 <.*>
+  40114b:	4c 03 1d 8e 02 20 00[ 	]+add    2097806\(%rip\),%r11 +# 6013e0 <.*>
 #				-> R_X86_64_TPOFF64	sG6
   401152:	90[ 	]+nop *
   401153:	90[ 	]+nop *
--- binutils/ld/testsuite/ld-x86-64/tlsbin.rd.2mb	2006-02-02 14:57:50.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsbin.rd	2006-05-25 07:39:20.000000000 -0700
@@ -18,11 +18,11 @@ Section Headers:
   \[ 6\] .rela.plt +.*
   \[ 7\] .plt +.*
   \[ 8\] .text +PROGBITS +0+401000 0+1000 0+22a 00 +AX +0 +0 +4096
-  \[ 9\] .tdata +PROGBITS +0+50122a 0+122a 0+60 00 WAT +0 +0 +1
-  \[10\] .tbss +NOBITS +0+50128a 0+128a 0+40 00 WAT +0 +0 +1
-  \[11\] .dynamic +DYNAMIC +0+501290 0+1290 0+140 10 +WA +4 +0 +8
-  \[12\] .got +PROGBITS +0+5013d0 0+13d0 0+20 08 +WA +0 +0 +8
-  \[13\] .got.plt +PROGBITS +0+5013f0 0+13f0 0+20 08 +WA +0 +0 +8
+  \[ 9\] .tdata +PROGBITS +0+60122a 0+122a 0+60 00 WAT +0 +0 +1
+  \[10\] .tbss +NOBITS +0+60128a 0+128a 0+40 00 WAT +0 +0 +1
+  \[11\] .dynamic +DYNAMIC +0+601290 0+1290 0+140 10 +WA +4 +0 +8
+  \[12\] .got +PROGBITS +0+6013d0 0+13d0 0+20 08 +WA +0 +0 +8
+  \[13\] .got.plt +PROGBITS +0+6013f0 0+13f0 0+20 08 +WA +0 +0 +8
   \[14\] .shstrtab +.*
   \[15\] .symtab +.*
   \[16\] .strtab +.*
@@ -40,10 +40,10 @@ Program Headers:
   PHDR.*
   INTERP.*
 .*Requesting program interpreter.*
-  LOAD +0x0+ 0x0+400000 0x0+400000 0x0+122a 0x0+122a R E 0x100000
-  LOAD +0x0+122a 0x0+50122a 0x0+50122a 0x0+1e6 0x0+1e6 RW  0x100000
-  DYNAMIC +0x0+1290 0x0+501290 0x0+501290 0x0+140 0x0+140 RW  0x8
-  TLS +0x0+122a 0x0+50122a 0x0+50122a 0x0+60 0x0+a0 R +0x1
+  LOAD +0x0+ 0x0+400000 0x0+400000 0x0+122a 0x0+122a R E 0x200000
+  LOAD +0x0+122a 0x0+60122a 0x0+60122a 0x0+1e6 0x0+1e6 RW  0x200000
+  DYNAMIC +0x0+1290 0x0+601290 0x0+601290 0x0+140 0x0+140 RW  0x8
+  TLS +0x0+122a 0x0+60122a 0x0+60122a 0x0+60 0x0+a0 R +0x1
 
  Section to Segment mapping:
   Segment Sections...
--- binutils/ld/testsuite/ld-x86-64/tlsbin.sd.2mb	2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlsbin.sd	2006-05-25 09:26:45.000000000 -0700
@@ -8,5 +8,5 @@
 .*: +file format elf64-x86-64
 
 Contents of section .got:
- 5013d0 00000000 00000000 00000000 00000000  .*
- 5013e0 00000000 00000000 00000000 00000000  .*
+ 6013d0 00000000 00000000 00000000 00000000  .*
+ 6013e0 00000000 00000000 00000000 00000000  .*
--- binutils/ld/testsuite/ld-x86-64/tlsbin.td.2mb	2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlsbin.td	2006-05-25 09:27:50.000000000 -0700
@@ -8,9 +8,9 @@
 .*: +file format elf64-x86-64
 
 Contents of section .tdata:
- 50122a 11000000 12000000 13000000 14000000  .*
- 50123a 15000000 16000000 17000000 18000000  .*
- 50124a 41000000 42000000 43000000 44000000  .*
- 50125a 45000000 46000000 47000000 48000000  .*
- 50126a 01010000 02010000 03010000 04010000  .*
- 50127a 05010000 06010000 07010000 08010000  .*
+ 60122a 11000000 12000000 13000000 14000000  .*
+ 60123a 15000000 16000000 17000000 18000000  .*
+ 60124a 41000000 42000000 43000000 44000000  .*
+ 60125a 45000000 46000000 47000000 48000000  .*
+ 60126a 01010000 02010000 03010000 04010000  .*
+ 60127a 05010000 06010000 07010000 08010000  .*
--- binutils/ld/testsuite/ld-x86-64/tlsbindesc.dd.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsbindesc.dd	2006-05-25 09:14:55.000000000 -0700
@@ -22,7 +22,7 @@ Disassembly of section .text:
   [0-9a-f]+:	55[ 	]+push   %rbp
   [0-9a-f]+:	48 89 e5[ 	]+mov    %rsp,%rbp
 #  GD -> IE because variable is not defined in executable
-  [0-9a-f]+:	48 8b 05 65 03 10 00[ 	]+mov    1049445\(%rip\),%rax +# 501370 <.*>
+  [0-9a-f]+:	48 8b 05 65 03 20 00[ 	]+mov    2098021\(%rip\),%rax +# 601370 <.*>
 #				-> R_X86_64_TPOFF64	sG1
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
@@ -32,7 +32,7 @@ Disassembly of section .text:
   [0-9a-f]+:	90[ 	]+nop *
 #  GD -> IE because variable is not defined in executable where
 #  the variable is referenced through IE too
-  [0-9a-f]+:	48 8b 05 48 03 10 00[ 	]+mov    1049416\(%rip\),%rax +# 501360 <.*>
+  [0-9a-f]+:	48 8b 05 48 03 20 00[ 	]+mov    2097992\(%rip\),%rax +# 601360 <.*>
 #				-> R_X86_64_TPOFF64	sG2
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
@@ -99,7 +99,7 @@ Disassembly of section .text:
   [0-9a-f]+:	00 00 *
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
-  [0-9a-f]+:	4c 03 0d d6 02 10 00[ 	]+add    1049302\(%rip\),%r9 +# 501360 <.*>
+  [0-9a-f]+:	4c 03 0d d6 02 20 00[ 	]+add    2097878\(%rip\),%r9 +# 601360 <.*>
 #				-> R_X86_64_TPOFF64	sG2
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
@@ -140,7 +140,7 @@ Disassembly of section .text:
   [0-9a-f]+:	90[ 	]+nop *
 #  Direct access through %fs
 #  IE against global var
-  [0-9a-f]+:	48 8b 0d 81 02 10 00[ 	]+mov    1049217\(%rip\),%rcx +# 501358 <.*>
+  [0-9a-f]+:	48 8b 0d 81 02 20 00[ 	]+mov    2097793\(%rip\),%rcx +# 601358 <.*>
 #				-> R_X86_64_TPOFF64	sG5
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
@@ -183,7 +183,7 @@ Disassembly of section .text:
   [0-9a-f]+:	00 00 *
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
-  [0-9a-f]+:	4c 03 1d 4a 02 10 00[ 	]+add    1049162\(%rip\),%r11 +# 501368 <.*>
+  [0-9a-f]+:	4c 03 1d 4a 02 20 00[ 	]+add    2097738\(%rip\),%r11 +# 601368 <.*>
 #				-> R_X86_64_TPOFF64	sG6
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	90[ 	]+nop *
--- binutils/ld/testsuite/ld-x86-64/tlsbindesc.rd.2mb	2006-02-02 14:57:50.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsbindesc.rd	2006-05-25 09:13:17.000000000 -0700
@@ -16,11 +16,11 @@ Section Headers:
   \[ 4\] .dynstr +.*
   \[ 5\] .rela.dyn +.*
   \[ 6\] .text +PROGBITS +0+401000 0+1000 0+1f6 00 +AX +0 +0 +4096
-  \[ 7\] .tdata +PROGBITS +0+5011f6 0+11f6 0+60 00 WAT +0 +0 +1
-  \[ 8\] .tbss +NOBITS +0+501256 0+1256 0+40 00 WAT +0 +0 +1
-  \[ 9\] .dynamic +DYNAMIC +0+501258 0+1258 0+100 10 +WA +4 +0 +8
-  \[10\] .got +PROGBITS +0+501358 0+1358 0+20 08 +WA +0 +0 +8
-  \[11\] .got.plt +PROGBITS +0+501378 0+1378 0+18 08 +WA +0 +0 +8
+  \[ 7\] .tdata +PROGBITS +0+6011f6 0+11f6 0+60 00 WAT +0 +0 +1
+  \[ 8\] .tbss +NOBITS +0+601256 0+1256 0+40 00 WAT +0 +0 +1
+  \[ 9\] .dynamic +DYNAMIC +0+601258 0+1258 0+100 10 +WA +4 +0 +8
+  \[10\] .got +PROGBITS +0+601358 0+1358 0+20 08 +WA +0 +0 +8
+  \[11\] .got.plt +PROGBITS +0+601378 0+1378 0+18 08 +WA +0 +0 +8
   \[12\] .shstrtab +.*
   \[13\] .symtab +.*
   \[14\] .strtab +.*
@@ -38,10 +38,10 @@ Program Headers:
   PHDR.*
   INTERP.*
 .*Requesting program interpreter.*
-  LOAD +0x0+ 0x0+400000 0x0+400000 0x0+11f6 0x0+11f6 R E 0x100000
-  LOAD +0x0+11f6 0x0+5011f6 0x0+5011f6 0x0+19a 0x0+19a RW  0x100000
-  DYNAMIC +0x0+1258 0x0+501258 0x0+501258 0x0+100 0x0+100 RW  0x8
-  TLS +0x0+11f6 0x0+5011f6 0x0+5011f6 0x0+60 0x0+a0 R +0x1
+  LOAD +0x0+ 0x0+400000 0x0+400000 0x0+11f6 0x0+11f6 R E 0x200000
+  LOAD +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+19a 0x0+19a RW  0x200000
+  DYNAMIC +0x0+1258 0x0+601258 0x0+601258 0x0+100 0x0+100 RW  0x8
+  TLS +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+60 0x0+a0 R +0x1
 
  Section to Segment mapping:
   Segment Sections...
@@ -54,10 +54,10 @@ Program Headers:
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
  +Offset +Info +Type +Symbol's Value  Symbol's Name \+ Addend
-0+501358  0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
-0+501360  0+200000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0
-0+501368  0+400000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
-0+501370  0+500000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0
+0+601358  0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
+0+601360  0+200000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0
+0+601368  0+400000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
+0+601370  0+500000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0
 
 Symbol table '.dynsym' contains 8 entries:
  +Num: +Value +Size Type +Bind +Vis +Ndx Name
@@ -104,8 +104,8 @@ Symbol table '.symtab' contains 67 entri
  +[0-9]+: 0+98 +0 TLS +LOCAL  DEFAULT +8 bl7
  +[0-9]+: 0+9c +0 TLS +LOCAL  DEFAULT +8 bl8
  +[0-9]+: 0+0 +0 TLS +LOCAL  HIDDEN +7 _TLS_MODULE_BASE_
- +[0-9]+: 0+501258 +0 OBJECT  LOCAL  HIDDEN    9 _DYNAMIC
- +[0-9]+: 0+501378 +0 OBJECT  LOCAL  HIDDEN   11 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+601258 +0 OBJECT  LOCAL  HIDDEN    9 _DYNAMIC
+ +[0-9]+: 0+601378 +0 OBJECT  LOCAL  HIDDEN   11 _GLOBAL_OFFSET_TABLE_
  +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +7 sg8
  +[0-9]+: 0+7c +0 TLS +GLOBAL DEFAULT +8 bg8
  +[0-9]+: 0+74 +0 TLS +GLOBAL DEFAULT +8 bg6
--- binutils/ld/testsuite/ld-x86-64/tlsbindesc.sd.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsbindesc.sd	2006-05-25 09:27:09.000000000 -0700
@@ -8,5 +8,5 @@
 .*: +file format elf64-x86-64
 
 Contents of section .got:
- 501358 00000000 00000000 00000000 00000000  .*
- 501368 00000000 00000000 00000000 00000000  .*
+ 601358 00000000 00000000 00000000 00000000  .*
+ 601368 00000000 00000000 00000000 00000000  .*
--- binutils/ld/testsuite/ld-x86-64/tlsbindesc.td.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsbindesc.td	2006-05-25 09:28:21.000000000 -0700
@@ -8,9 +8,9 @@
 .*: +file format elf64-x86-64
 
 Contents of section .tdata:
- 5011f6 11000000 12000000 13000000 14000000  .*
- 501206 15000000 16000000 17000000 18000000  .*
- 501216 41000000 42000000 43000000 44000000  .*
- 501226 45000000 46000000 47000000 48000000  .*
- 501236 01010000 02010000 03010000 04010000  .*
- 501246 05010000 06010000 07010000 08010000  .*
+ 6011f6 11000000 12000000 13000000 14000000  .*
+ 601206 15000000 16000000 17000000 18000000  .*
+ 601216 41000000 42000000 43000000 44000000  .*
+ 601226 45000000 46000000 47000000 48000000  .*
+ 601236 01010000 02010000 03010000 04010000  .*
+ 601246 05010000 06010000 07010000 08010000  .*
--- binutils/ld/testsuite/ld-x86-64/tlsdesc.dd.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsdesc.dd	2006-05-25 09:07:10.000000000 -0700
@@ -17,7 +17,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD
- +[0-9a-f]+:	48 8d 05 89 03 10 00[ 	]+lea    1049481\(%rip\),%rax +# 101398 <.*>
+ +[0-9a-f]+:	48 8d 05 89 03 20 00[ 	]+lea    2098057\(%rip\),%rax +# 201398 <.*>
 #				-> R_X86_64_TLSDESC	sg1
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -25,7 +25,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD -> IE because variable is referenced through IE too
- +[0-9a-f]+:	48 8b 05 1c 03 10 00[ 	]+mov    1049372\(%rip\),%rax +# 101338 <.*>
+ +[0-9a-f]+:	48 8b 05 1c 03 20 00[ 	]+mov    2097948\(%rip\),%rax +# 201338 <.*>
 #				-> R_X86_64_TPOFF64	sg2
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -34,7 +34,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD against local variable
- +[0-9a-f]+:	48 8d 05 3f 03 10 00[ 	]+lea    1049407\(%rip\),%rax +# 101368 <.*>
+ +[0-9a-f]+:	48 8d 05 3f 03 20 00[ 	]+lea    2097983\(%rip\),%rax +# 201368 <.*>
 #				-> R_X86_64_TLSDESC	[0 0x2000000000000000]
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -42,7 +42,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD -> IE against local variable referenced through IE too
- +[0-9a-f]+:	48 8b 05 d2 02 10 00[ 	]+mov    1049298\(%rip\),%rax +# 101308 <.*>
+ +[0-9a-f]+:	48 8b 05 d2 02 20 00[ 	]+mov    2097874\(%rip\),%rax +# 201308 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x24
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -51,7 +51,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD against hidden and local variable
- +[0-9a-f]+:	48 8d 05 65 03 10 00[ 	]+lea    1049445\(%rip\),%rax +# 1013a8 <.*>
+ +[0-9a-f]+:	48 8d 05 65 03 20 00[ 	]+lea    2098021\(%rip\),%rax +# 2013a8 <.*>
 #				-> R_X86_64_TLSDESC	[0 0x4000000000000000]
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -59,7 +59,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD -> IE against hidden and local variable referenced through IE too
- +[0-9a-f]+:	48 8b 05 f0 02 10 00[ 	]+mov    1049328\(%rip\),%rax +# 101340 <.*>
+ +[0-9a-f]+:	48 8b 05 f0 02 20 00[ 	]+mov    2097904\(%rip\),%rax +# 201340 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x44
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -68,7 +68,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD against hidden but not local variable
- +[0-9a-f]+:	48 8d 05 1b 03 10 00[ 	]+lea    1049371\(%rip\),%rax +# 101378 <.*>
+ +[0-9a-f]+:	48 8d 05 1b 03 20 00[ 	]+lea    2097947\(%rip\),%rax +# 201378 <.*>
 #				-> R_X86_64_TLSDESC	[0 0x6000000000000000]
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -76,7 +76,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  GD -> IE against hidden but not local variable referenced through IE too
- +[0-9a-f]+:	48 8b 05 ae 02 10 00[ 	]+mov    1049262\(%rip\),%rax +# 101318 <.*>
+ +[0-9a-f]+:	48 8b 05 ae 02 20 00[ 	]+mov    2097838\(%rip\),%rax +# 201318 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x64
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -85,7 +85,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  LD
- +[0-9a-f]+:	48 8d 05 11 03 10 00[ 	]+lea    1049361\(%rip\),%rax +# 101388 <.*>
+ +[0-9a-f]+:	48 8d 05 11 03 20 00[ 	]+lea    2097937\(%rip\),%rax +# 201388 <.*>
 #				-> R_X86_64_TLSDESC	[0 0x000000000000000]
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -119,7 +119,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 71 02 10 00[ 	]+add    1049201\(%rip\),%rcx +# 101338 <.*>
+ +[0-9a-f]+:	48 03 0d 71 02 20 00[ 	]+add    2097777\(%rip\),%rcx +# 201338 <.*>
 #				-> R_X86_64_TPOFF64	sg2
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -130,7 +130,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	4c 03 35 2b 02 10 00[ 	]+add    1049131\(%rip\),%r14 +# 101308 <.*>
+ +[0-9a-f]+:	4c 03 35 2b 02 20 00[ 	]+add    2097707\(%rip\),%r14 +# 201308 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x24
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -141,7 +141,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 4d 02 10 00[ 	]+add    1049165\(%rip\),%rcx +# 101340 <.*>
+ +[0-9a-f]+:	48 03 0d 4d 02 20 00[ 	]+add    2097741\(%rip\),%rcx +# 201340 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x44
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -152,7 +152,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 0f 02 10 00[ 	]+add    1049103\(%rip\),%rcx +# 101318 <.*>
+ +[0-9a-f]+:	48 03 0d 0f 02 20 00[ 	]+add    2097679\(%rip\),%rcx +# 201318 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x64
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -160,7 +160,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
 #  Direct access through %fs
 #  IE against global var
- +[0-9a-f]+:	48 8b 0d 0c 02 10 00[ 	]+mov    1049100\(%rip\),%rcx +# 101320 <.*>
+ +[0-9a-f]+:	48 8b 0d 0c 02 20 00[ 	]+mov    2097676\(%rip\),%rcx +# 201320 <.*>
 #				-> R_X86_64_TPOFF64	sg5
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -170,7 +170,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  IE against local var
- +[0-9a-f]+:	4c 8b 15 eb 01 10 00[ 	]+mov    1049067\(%rip\),%r10 +# 101310 <.*>
+ +[0-9a-f]+:	4c 8b 15 eb 01 20 00[ 	]+mov    2097643\(%rip\),%r10 +# 201310 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x30
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -180,7 +180,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  IE against hidden and local var
- +[0-9a-f]+:	48 8b 15 f2 01 10 00[ 	]+mov    1049074\(%rip\),%rdx +# 101328 <.*>
+ +[0-9a-f]+:	48 8b 15 f2 01 20 00[ 	]+mov    2097650\(%rip\),%rdx +# 201328 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x50
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -190,7 +190,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 #  IE against hidden but not local var
- +[0-9a-f]+:	48 8b 0d e9 01 10 00[ 	]+mov    1049065\(%rip\),%rcx +# 101330 <.*>
+ +[0-9a-f]+:	48 8b 0d e9 01 20 00[ 	]+mov    2097641\(%rip\),%rcx +# 201330 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x70
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
--- binutils/ld/testsuite/ld-x86-64/tlsdesc.pd.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsdesc.pd	2006-05-25 09:09:50.000000000 -0700
@@ -10,15 +10,15 @@
 Disassembly of section .plt:
 
 0000000000000470 <.*@plt-0x10>:
- 470:	ff 35 e2 0e 10 00    	pushq  1052386\(%rip\)        # 101358 <_GLOBAL_OFFSET_TABLE_\+0x8>
- 476:	ff 25 e4 0e 10 00    	jmpq   \*1052388\(%rip\)        # 101360 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ 470:	ff 35 e2 0e 20 00    	pushq  2100962\(%rip\)        # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ 476:	ff 25 e4 0e 20 00    	jmpq   \*2100964\(%rip\)        # 201360 <_GLOBAL_OFFSET_TABLE_\+0x10>
  47c:	90                   	nop *
  47d:	90                   	nop *
  47e:	90                   	nop *
  47f:	90                   	nop *
 0000000000000480 <.*@plt>:
- 480:	ff 35 d2 0e 10 00    	pushq  1052370\(%rip\)        # 101358 <_GLOBAL_OFFSET_TABLE_\+0x8>
- 486:	ff 25 bc 0e 10 00    	jmpq   \*1052348\(%rip\)        # 101348 <_DYNAMIC\+0x190>
+ 480:	ff 35 d2 0e 20 00    	pushq  2100946\(%rip\)        # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ 486:	ff 25 bc 0e 20 00    	jmpq   \*2100924\(%rip\)        # 201348 <_DYNAMIC\+0x190>
  48c:	90                   	nop *
  48d:	90                   	nop *
  48e:	90                   	nop *
--- binutils/ld/testsuite/ld-x86-64/tlsdesc.rd.2mb	2006-02-02 14:57:50.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsdesc.rd	2006-05-25 09:00:02.000000000 -0700
@@ -17,11 +17,11 @@ Section Headers:
   \[ 5\] .rela.plt +.*
   \[ 6\] .plt +PROGBITS +0+470 0+470 0+20 10 +AX +0 +0 +4
   \[ 7\] .text +PROGBITS +0+1000 0+1000 0+154 00 +AX +0 +0 4096
-  \[ 8\] .tdata +PROGBITS +0+101154 0+1154 0+60 00 WAT +0 +0 +1
-  \[ 9\] .tbss +NOBITS +0+1011b4 0+11b4 0+20 00 WAT +0 +0 +1
-  \[10\] .dynamic +DYNAMIC +0+1011b8 0+11b8 0+150 10 +WA +3 +0 +8
-  \[11\] .got +PROGBITS +0+101308 0+1308 0+48 08 +WA +0 +0 +8
-  \[12\] .got.plt +PROGBITS +0+101350 0+1350 0+68 08 +WA +0 +0 +8
+  \[ 8\] .tdata +PROGBITS +0+201154 0+1154 0+60 00 WAT +0 +0 +1
+  \[ 9\] .tbss +NOBITS +0+2011b4 0+11b4 0+20 00 WAT +0 +0 +1
+  \[10\] .dynamic +DYNAMIC +0+2011b8 0+11b8 0+150 10 +WA +3 +0 +8
+  \[11\] .got +PROGBITS +0+201308 0+1308 0+48 08 +WA +0 +0 +8
+  \[12\] .got.plt +PROGBITS +0+201350 0+1350 0+68 08 +WA +0 +0 +8
   \[13\] .shstrtab +.*
   \[14\] .symtab +.*
   \[15\] .strtab +.*
@@ -36,10 +36,10 @@ There are 4 program headers, starting at
 
 Program Headers:
   Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
-  LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x100000
-  LOAD +0x0+1154 0x0+101154 0x0+101154 0x0+264 0x0+264 RW +0x100000
-  DYNAMIC +0x0+11b8 0x0+1011b8 0x0+1011b8 0x0+150 0x0+150 RW +0x8
-  TLS +0x0+1154 0x0+101154 0x0+101154 0x0+60 0x0+80 R +0x1
+  LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x200000
+  LOAD +0x0+1154 0x0+201154 0x0+201154 0x0+264 0x0+264 RW +0x200000
+  DYNAMIC +0x0+11b8 0x0+2011b8 0x0+2011b8 0x0+150 0x0+150 RW +0x8
+  TLS +0x0+1154 0x0+201154 0x0+201154 0x0+60 0x0+80 R +0x1
 
  Section to Segment mapping:
   Segment Sections...
@@ -60,7 +60,7 @@ Dynamic section at offset 0x[0-9a-f]+ co
  0x[0-9a-f]+ +\(PLTREL\).*
  0x[0-9a-f]+ +\(JMPREL\).*
  0x[0-9a-f]+ +\(TLSDESC_PLT\) +0x480
- 0x[0-9a-f]+ +\(TLSDESC_GOT\) +0x101348
+ 0x[0-9a-f]+ +\(TLSDESC_GOT\) +0x201348
  0x[0-9a-f]+ +\(RELA\).*
  0x[0-9a-f]+ +\(RELASZ\).*
  0x[0-9a-f]+ +\(RELAENT\).*
@@ -69,22 +69,22 @@ Dynamic section at offset 0x[0-9a-f]+ co
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
  +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
-0+101308  0+12 R_X86_64_TPOFF64 +0+24
-0+101310  0+12 R_X86_64_TPOFF64 +0+30
-0+101318  0+12 R_X86_64_TPOFF64 +0+64
-0+101328  0+12 R_X86_64_TPOFF64 +0+50
-0+101330  0+12 R_X86_64_TPOFF64 +0+70
-0+101340  0+12 R_X86_64_TPOFF64 +0+44
-0+101320  0+700000012 R_X86_64_TPOFF64 +0+10 sg5 \+ 0
-0+101338  0+b00000012 R_X86_64_TPOFF64 +0+4 sg2 \+ 0
+0+201308  0+12 R_X86_64_TPOFF64 +0+24
+0+201310  0+12 R_X86_64_TPOFF64 +0+30
+0+201318  0+12 R_X86_64_TPOFF64 +0+64
+0+201328  0+12 R_X86_64_TPOFF64 +0+50
+0+201330  0+12 R_X86_64_TPOFF64 +0+70
+0+201340  0+12 R_X86_64_TPOFF64 +0+44
+0+201320  0+700000012 R_X86_64_TPOFF64 +0+10 sg5 \+ 0
+0+201338  0+b00000012 R_X86_64_TPOFF64 +0+4 sg2 \+ 0
 
 Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 5 entries:
  +Offset +Info +Type +Symbol's Value  Symbol's Name \+ Addend
-0+101398  0+800000024 R_X86_64_TLSDESC +0+ sg1 \+ 0
-0+101368  0+24 R_X86_64_TLSDESC +0+20
-0+1013a8  0+24 R_X86_64_TLSDESC +0+40
-0+101378  0+24 R_X86_64_TLSDESC +0+60
-0+101388  0+24 R_X86_64_TLSDESC +0+
+0+201398  0+800000024 R_X86_64_TLSDESC +0+ sg1 \+ 0
+0+201368  0+24 R_X86_64_TLSDESC +0+20
+0+2013a8  0+24 R_X86_64_TLSDESC +0+40
+0+201378  0+24 R_X86_64_TLSDESC +0+60
+0+201388  0+24 R_X86_64_TLSDESC +0+
 
 Symbol table '.dynsym' contains 16 entries:
  +Num: +Value +Size Type +Bind +Vis +Ndx Name
@@ -133,7 +133,7 @@ Symbol table '.symtab' contains 55 entri
  +[0-9]+: 0+3c +0 TLS +LOCAL  DEFAULT +8 sl8
  +[0-9]+: 0+60 +0 TLS +LOCAL  HIDDEN +9 sH1
  +[0-9]+: 0+ +0 TLS +LOCAL  HIDDEN +8 _TLS_MODULE_BASE_
- +[0-9]+: 0+1011b8 +0 OBJECT  LOCAL  HIDDEN  ABS _DYNAMIC
+ +[0-9]+: 0+2011b8 +0 OBJECT  LOCAL  HIDDEN  ABS _DYNAMIC
  +[0-9]+: 0+48 +0 TLS +LOCAL  HIDDEN +8 sh3
  +[0-9]+: 0+64 +0 TLS +LOCAL  HIDDEN +9 sH2
  +[0-9]+: 0+78 +0 TLS +LOCAL  HIDDEN +9 sH7
@@ -147,7 +147,7 @@ Symbol table '.symtab' contains 55 entri
  +[0-9]+: 0+74 +0 TLS +LOCAL  HIDDEN +9 sH6
  +[0-9]+: 0+7c +0 TLS +LOCAL  HIDDEN +9 sH8
  +[0-9]+: 0+40 +0 TLS +LOCAL  HIDDEN +8 sh1
- +[0-9]+: 0+101350 +0 OBJECT  LOCAL  HIDDEN  ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+201350 +0 OBJECT  LOCAL  HIDDEN  ABS _GLOBAL_OFFSET_TABLE_
  +[0-9]+: 0+44 +0 TLS +LOCAL  HIDDEN +8 sh2
  +[0-9]+: 0+54 +0 TLS +LOCAL  HIDDEN +8 sh6
  +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +8 sg8
--- binutils/ld/testsuite/ld-x86-64/tlsdesc.sd.2mb	2006-01-18 13:07:49.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsdesc.sd	2006-05-25 09:07:59.000000000 -0700
@@ -8,16 +8,16 @@
 .*: +file format elf64-x86-64
 
 Contents of section \.got:
- 101308 00000000 00000000 00000000 00000000  .*
- 101318 00000000 00000000 00000000 00000000  .*
- 101328 00000000 00000000 00000000 00000000  .*
- 101338 00000000 00000000 00000000 00000000  .*
- 101348 00000000 00000000                    .*
+ 201308 00000000 00000000 00000000 00000000  .*
+ 201318 00000000 00000000 00000000 00000000  .*
+ 201328 00000000 00000000 00000000 00000000  .*
+ 201338 00000000 00000000 00000000 00000000  .*
+ 201348 00000000 00000000                    .*
 Contents of section \.got\.plt:
- 101350 b8111000 00000000 00000000 00000000  .*
- 101360 00000000 00000000 00000000 00000000  .*
- 101370 00000000 00000000 00000000 00000000  .*
- 101380 00000000 00000000 00000000 00000000  .*
- 101390 00000000 00000000 00000000 00000000  .*
- 1013a0 00000000 00000000 00000000 00000000  .*
- 1013b0 00000000 00000000                    .*
+ 201350 b8112000 00000000 00000000 00000000  .*
+ 201360 00000000 00000000 00000000 00000000  .*
+ 201370 00000000 00000000 00000000 00000000  .*
+ 201380 00000000 00000000 00000000 00000000  .*
+ 201390 00000000 00000000 00000000 00000000  .*
+ 2013a0 00000000 00000000 00000000 00000000  .*
+ 2013b0 00000000 00000000                    .*
--- binutils/ld/testsuite/ld-x86-64/tlsdesc.td.2mb	2006-01-18 13:07:51.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsdesc.td	2006-05-25 09:08:33.000000000 -0700
@@ -8,9 +8,9 @@
 .*: +file format elf64-x86-64
 
 Contents of section .tdata:
- 101154 11000000 12000000 13000000 14000000  .*
- 101164 15000000 16000000 17000000 18000000  .*
- 101174 41000000 42000000 43000000 44000000  .*
- 101184 45000000 46000000 47000000 48000000  .*
- 101194 01010000 02010000 03010000 04010000  .*
- 1011a4 05010000 06010000 07010000 08010000  .*
+ 201154 11000000 12000000 13000000 14000000  .*
+ 201164 15000000 16000000 17000000 18000000  .*
+ 201174 41000000 42000000 43000000 44000000  .*
+ 201184 45000000 46000000 47000000 48000000  .*
+ 201194 01010000 02010000 03010000 04010000  .*
+ 2011a4 05010000 06010000 07010000 08010000  .*
--- binutils/ld/testsuite/ld-x86-64/tlsgdesc.dd.2mb	2006-01-18 13:07:51.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlsgdesc.dd	2006-05-25 09:26:06.000000000 -0700
@@ -20,7 +20,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 5e 02 10 00[ 	]+add    1049182\(%rip\),%rcx +# 100660 <.*>
+ +[0-9a-f]+:	48 03 0d 5e 02 20 00[ 	]+add    2097758\(%rip\),%rcx +# 200660 <.*>
 #				-> R_X86_64_TPOFF64	sG3
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -31,14 +31,14 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 68 02 10 00[ 	]+add    1049192\(%rip\),%rcx +# 100680 <.*>
+ +[0-9a-f]+:	48 03 0d 68 02 20 00[ 	]+add    2097768\(%rip\),%rcx +# 200680 <.*>
 #				-> R_X86_64_TPOFF64	sG4
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 # GD, gd first
- +[0-9a-f]+:	66 48 8d 3d 6c 02 10[ 	]+lea    1049196\(%rip\),%rdi +# 100690 <.*>
+ +[0-9a-f]+:	66 48 8d 3d 6c 02 20[ 	]+lea    2097772\(%rip\),%rdi +# 200690 <.*>
  +[0-9a-f]+:	00 *
 #				-> R_X86_64_DTPMOD64	sG1
  +[0-9a-f]+:	66 66 48 e8 9c ff ff[ 	]+callq  [0-9a-f]+ <.*>
@@ -48,7 +48,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 8d 05 a1 02 10 00[ 	]+lea    1049249\(%rip\),%rax +# 1006d8 <.*>
+ +[0-9a-f]+:	48 8d 05 a1 02 20 00[ 	]+lea    2097825\(%rip\),%rax +# 2006d8 <.*>
 #				-> R_X86_64_TLSDESC	sG1
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
@@ -56,14 +56,14 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 # GD, desc first
- +[0-9a-f]+:	48 8d 05 84 02 10 00[ 	]+lea    1049220\(%rip\),%rax +# 1006c8 <.*>
+ +[0-9a-f]+:	48 8d 05 84 02 20 00[ 	]+lea    2097796\(%rip\),%rax +# 2006c8 <.*>
 #				-> R_X86_64_TLSDESC	sG2
  +[0-9a-f]+:	ff 10[ 	]+callq  \*\(%rax\)
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	66 48 8d 3d 1e 02 10[ 	]+lea    1049118\(%rip\),%rdi +# 100670 <.*>
+ +[0-9a-f]+:	66 48 8d 3d 1e 02 20[ 	]+lea    2097694\(%rip\),%rdi +# 200670 <.*>
  +[0-9a-f]+:	00 *
 #				-> R_X86_64_DTPMOD64	sG2
  +[0-9a-f]+:	66 66 48 e8 6e ff ff[ 	]+callq  [0-9a-f]+ <.*>
@@ -76,13 +76,13 @@ Disassembly of section .text:
 # GD -> IE, gd first, after IE use
  +[0-9a-f]+:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +[0-9a-f]+:	00 00 *
- +[0-9a-f]+:	48 03 05 f2 01 10 00[ 	]+add    1049074\(%rip\),%rax +# 100660 <.*>
+ +[0-9a-f]+:	48 03 05 f2 01 20 00[ 	]+add    2097650\(%rip\),%rax +# 200660 <.*>
 #				-> R_X86_64_TPOFF64	sG3
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 8b 05 e7 01 10 00[ 	]+mov    1049063\(%rip\),%rax +# 100660 <.*>
+ +[0-9a-f]+:	48 8b 05 e7 01 20 00[ 	]+mov    2097639\(%rip\),%rax +# 200660 <.*>
 #				-> R_X86_64_TPOFF64	sG3
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -91,7 +91,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 # GD -> IE, desc first, after IE use
- +[0-9a-f]+:	48 8b 05 fa 01 10 00[ 	]+mov    1049082\(%rip\),%rax +# 100680 <.*>
+ +[0-9a-f]+:	48 8b 05 fa 01 20 00[ 	]+mov    2097658\(%rip\),%rax +# 200680 <.*>
 #				-> R_X86_64_TPOFF64	sG4
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -101,7 +101,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +[0-9a-f]+:	00 00 *
- +[0-9a-f]+:	48 03 05 e4 01 10 00[ 	]+add    1049060\(%rip\),%rax +# 100680 <.*>
+ +[0-9a-f]+:	48 03 05 e4 01 20 00[ 	]+add    2097636\(%rip\),%rax +# 200680 <.*>
 #				-> R_X86_64_TPOFF64	sG4
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -110,13 +110,13 @@ Disassembly of section .text:
 # GD -> IE, gd first, before IE use
  +[0-9a-f]+:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +[0-9a-f]+:	00 00 *
- +[0-9a-f]+:	48 03 05 b8 01 10 00[ 	]+add    1049016\(%rip\),%rax +# 100668 <.*>
+ +[0-9a-f]+:	48 03 05 b8 01 20 00[ 	]+add    2097592\(%rip\),%rax +# 200668 <.*>
 #				-> R_X86_64_TPOFF64	sG5
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 8b 05 ad 01 10 00[ 	]+mov    1049005\(%rip\),%rax +# 100668 <.*>
+ +[0-9a-f]+:	48 8b 05 ad 01 20 00[ 	]+mov    2097581\(%rip\),%rax +# 200668 <.*>
 #				-> R_X86_64_TPOFF64	sG5
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -125,7 +125,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
 # GD -> IE, desc first, before IE use
- +[0-9a-f]+:	48 8b 05 c0 01 10 00[ 	]+mov    1049024\(%rip\),%rax +# 100688 <.*>
+ +[0-9a-f]+:	48 8b 05 c0 01 20 00[ 	]+mov    2097600\(%rip\),%rax +# 200688 <.*>
 #				-> R_X86_64_TPOFF64	sG6
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -135,7 +135,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +[0-9a-f]+:	00 00 *
- +[0-9a-f]+:	48 03 05 aa 01 10 00[ 	]+add    1049002\(%rip\),%rax +# 100688 <.*>
+ +[0-9a-f]+:	48 03 05 aa 01 20 00[ 	]+add    2097578\(%rip\),%rax +# 200688 <.*>
 #				-> R_X86_64_TPOFF64	sG6
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -146,7 +146,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 74 01 10 00[ 	]+add    1048948\(%rip\),%rcx +# 100668 <.*>
+ +[0-9a-f]+:	48 03 0d 74 01 20 00[ 	]+add    2097524\(%rip\),%rcx +# 200668 <.*>
 #				-> R_X86_64_TPOFF64	sG5
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
@@ -157,7 +157,7 @@ Disassembly of section .text:
  +[0-9a-f]+:	00 00 *
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
- +[0-9a-f]+:	48 03 0d 7e 01 10 00[ 	]+add    1048958\(%rip\),%rcx +# 100688 <.*>
+ +[0-9a-f]+:	48 03 0d 7e 01 20 00[ 	]+add    2097534\(%rip\),%rcx +# 200688 <.*>
 #				-> R_X86_64_TPOFF64	sG6
  +[0-9a-f]+:	90[ 	]+nop *
  +[0-9a-f]+:	90[ 	]+nop *
--- binutils/ld/testsuite/ld-x86-64/tlspic.dd.2mb	2005-09-28 10:40:56.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlspic.dd	2006-05-25 08:58:02.000000000 -0700
@@ -17,7 +17,7 @@ Disassembly of section .text:
  +1006:	90[ 	]+nop *
  +1007:	90[ 	]+nop *
 #  GD
- +1008:	66 48 8d 3d 80 03 10[ 	]+lea    1049472\(%rip\),%rdi +# 101390 <.*>
+ +1008:	66 48 8d 3d 80 03 20[ 	]+lea    2098048\(%rip\),%rdi +# 201390 <.*>
  +100f:	00 *
 #				-> R_X86_64_DTPMOD64	sg1
  +1010:	66 66 48 e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
@@ -30,14 +30,14 @@ Disassembly of section .text:
 #  GD -> IE because variable is referenced through IE too
  +101c:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +1023:	00 00 *
- +1025:	48 03 05 84 03 10 00[ 	]+add    1049476\(%rip\),%rax +# 1013b0 <.*>
+ +1025:	48 03 05 84 03 20 00[ 	]+add    2098052\(%rip\),%rax +# 2013b0 <.*>
 #				-> R_X86_64_TPOFF64	sg2
  +102c:	90[ 	]+nop *
  +102d:	90[ 	]+nop *
  +102e:	90[ 	]+nop *
  +102f:	90[ 	]+nop *
 #  GD against local variable
- +1030:	66 48 8d 3d 08 03 10[ 	]+lea    1049352\(%rip\),%rdi +# 101340 <.*>
+ +1030:	66 48 8d 3d 08 03 20[ 	]+lea    2097928\(%rip\),%rdi +# 201340 <.*>
  +1037:	00 *
 #				-> R_X86_64_DTPMOD64	[0 0x2000000000000000]
  +1038:	66 66 48 e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
@@ -50,14 +50,14 @@ Disassembly of section .text:
 #  GD -> IE against local variable referenced through IE too
  +1044:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +104b:	00 00 *
- +104d:	48 03 05 fc 02 10 00[ 	]+add    1049340\(%rip\),%rax +# 101350 <.*>
+ +104d:	48 03 05 fc 02 20 00[ 	]+add    2097916\(%rip\),%rax +# 201350 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x24
  +1054:	90[ 	]+nop *
  +1055:	90[ 	]+nop *
  +1056:	90[ 	]+nop *
  +1057:	90[ 	]+nop *
 #  GD against hidden and local variable
- +1058:	66 48 8d 3d 58 03 10[ 	]+lea    1049432\(%rip\),%rdi +# 1013b8 <.*>
+ +1058:	66 48 8d 3d 58 03 20[ 	]+lea    2098008\(%rip\),%rdi +# 2013b8 <.*>
  +105f:	00 *
 #				-> R_X86_64_DTPMOD64	[0 0x4000000000000000]
  +1060:	66 66 48 e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
@@ -70,14 +70,14 @@ Disassembly of section .text:
 #  GD -> IE against hidden and local variable referenced through IE too
  +106c:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +1073:	00 00 *
- +1075:	48 03 05 4c 03 10 00[ 	]+add    1049420\(%rip\),%rax +# 1013c8 <.*>
+ +1075:	48 03 05 4c 03 20 00[ 	]+add    2097996\(%rip\),%rax +# 2013c8 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x44
  +107c:	90[ 	]+nop *
  +107d:	90[ 	]+nop *
  +107e:	90[ 	]+nop *
  +107f:	90[ 	]+nop *
 #  GD against hidden but not local variable
- +1080:	66 48 8d 3d e8 02 10[ 	]+lea    1049320\(%rip\),%rdi +# 101370 <.*>
+ +1080:	66 48 8d 3d e8 02 20[ 	]+lea    2097896\(%rip\),%rdi +# 201370 <.*>
  +1087:	00 *
 #				-> R_X86_64_DTPMOD64	[0 0x6000000000000000]
  +1088:	66 66 48 e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
@@ -90,14 +90,14 @@ Disassembly of section .text:
 #  GD -> IE against hidden but not local variable referenced through IE too
  +1094:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
  +109b:	00 00 *
- +109d:	48 03 05 dc 02 10 00[ 	]+add    1049308\(%rip\),%rax +# 101380 <.*>
+ +109d:	48 03 05 dc 02 20 00[ 	]+add    2097884\(%rip\),%rax +# 201380 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x64
  +10a4:	90[ 	]+nop *
  +10a5:	90[ 	]+nop *
  +10a6:	90[ 	]+nop *
  +10a7:	90[ 	]+nop *
 #  LD
- +10a8:	48 8d 3d b1 02 10 00[ 	]+lea    1049265\(%rip\),%rdi +# 101360 <.*>
+ +10a8:	48 8d 3d b1 02 20 00[ 	]+lea    2097841\(%rip\),%rdi +# 201360 <.*>
 #				-> R_X86_64_DTPMOD64	[0 0x000000000000000]
  +10af:	e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
 #				-> R_X86_64_JUMP_SLOT	__tls_get_addr
@@ -112,7 +112,7 @@ Disassembly of section .text:
  +10c8:	90[ 	]+nop *
  +10c9:	90[ 	]+nop *
 #  LD against hidden and local variables
- +10ca:	48 8d 3d 8f 02 10 00[ 	]+lea    1049231\(%rip\),%rdi +# 101360 <.*>
+ +10ca:	48 8d 3d 8f 02 20 00[ 	]+lea    2097807\(%rip\),%rdi +# 201360 <.*>
 #				-> R_X86_64_DTPMOD64	[0 0x000000000000000]
  +10d1:	e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
 #				-> R_X86_64_JUMP_SLOT	__tls_get_addr
@@ -127,7 +127,7 @@ Disassembly of section .text:
  +10ea:	90[ 	]+nop *
  +10eb:	90[ 	]+nop *
 #  LD against hidden but not local variables
- +10ec:	48 8d 3d 6d 02 10 00[ 	]+lea    1049197\(%rip\),%rdi +# 101360 <.*>
+ +10ec:	48 8d 3d 6d 02 20 00[ 	]+lea    2097773\(%rip\),%rdi +# 201360 <.*>
 #				-> R_X86_64_DTPMOD64	[0 0x000000000000000]
  +10f3:	e8 [0-9a-f 	]+callq  [0-9a-f]+ <.*>
 #				-> R_X86_64_JUMP_SLOT	__tls_get_addr
@@ -144,7 +144,7 @@ Disassembly of section .text:
  +1113:	00 00 *
  +1115:	90[ 	]+nop *
  +1116:	90[ 	]+nop *
- +1117:	48 03 0d 92 02 10 00[ 	]+add    1049234\(%rip\),%rcx +# 1013b0 <.*>
+ +1117:	48 03 0d 92 02 20 00[ 	]+add    2097810\(%rip\),%rcx +# 2013b0 <.*>
 #				-> R_X86_64_TPOFF64	sg2
  +111e:	90[ 	]+nop *
  +111f:	90[ 	]+nop *
@@ -155,7 +155,7 @@ Disassembly of section .text:
  +1129:	00 00 *
  +112b:	90[ 	]+nop *
  +112c:	90[ 	]+nop *
- +112d:	4c 03 35 1c 02 10 00[ 	]+add    1049116\(%rip\),%r14 +# 101350 <.*>
+ +112d:	4c 03 35 1c 02 20 00[ 	]+add    2097692\(%rip\),%r14 +# 201350 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x24
  +1134:	90[ 	]+nop *
  +1135:	90[ 	]+nop *
@@ -166,7 +166,7 @@ Disassembly of section .text:
  +113f:	00 00 *
  +1141:	90[ 	]+nop *
  +1142:	90[ 	]+nop *
- +1143:	48 03 0d 7e 02 10 00[ 	]+add    1049214\(%rip\),%rcx +# 1013c8 <.*>
+ +1143:	48 03 0d 7e 02 20 00[ 	]+add    2097790\(%rip\),%rcx +# 2013c8 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x44
  +114a:	90[ 	]+nop *
  +114b:	90[ 	]+nop *
@@ -177,7 +177,7 @@ Disassembly of section .text:
  +1155:	00 00 *
  +1157:	90[ 	]+nop *
  +1158:	90[ 	]+nop *
- +1159:	48 03 0d 20 02 10 00[ 	]+add    1049120\(%rip\),%rcx +# 101380 <.*>
+ +1159:	48 03 0d 20 02 20 00[ 	]+add    2097696\(%rip\),%rcx +# 201380 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x64
  +1160:	90[ 	]+nop *
  +1161:	90[ 	]+nop *
@@ -185,7 +185,7 @@ Disassembly of section .text:
  +1163:	90[ 	]+nop *
 #  Direct access through %fs
 #  IE against global var
- +1164:	48 8b 0d 1d 02 10 00[ 	]+mov    1049117\(%rip\),%rcx +# 101388 <.*>
+ +1164:	48 8b 0d 1d 02 20 00[ 	]+mov    2097693\(%rip\),%rcx +# 201388 <.*>
 #				-> R_X86_64_TPOFF64	sg5
  +116b:	90[ 	]+nop *
  +116c:	90[ 	]+nop *
@@ -195,7 +195,7 @@ Disassembly of section .text:
  +1173:	90[ 	]+nop *
  +1174:	90[ 	]+nop *
 #  IE against local var
- +1175:	4c 8b 15 dc 01 10 00[ 	]+mov    1049052\(%rip\),%r10 +# 101358 <.*>
+ +1175:	4c 8b 15 dc 01 20 00[ 	]+mov    2097628\(%rip\),%r10 +# 201358 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x30
  +117c:	90[ 	]+nop *
  +117d:	90[ 	]+nop *
@@ -205,7 +205,7 @@ Disassembly of section .text:
  +1184:	90[ 	]+nop *
  +1185:	90[ 	]+nop *
 #  IE against hidden and local var
- +1186:	48 8b 15 13 02 10 00[ 	]+mov    1049107\(%rip\),%rdx +# 1013a0 <.*>
+ +1186:	48 8b 15 13 02 20 00[ 	]+mov    2097683\(%rip\),%rdx +# 2013a0 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x50
  +118d:	90[ 	]+nop *
  +118e:	90[ 	]+nop *
@@ -215,7 +215,7 @@ Disassembly of section .text:
  +1195:	90[ 	]+nop *
  +1196:	90[ 	]+nop *
 #  IE against hidden but not local var
- +1197:	48 8b 0d 0a 02 10 00[ 	]+mov    1049098\(%rip\),%rcx +# 1013a8 <.*>
+ +1197:	48 8b 0d 0a 02 20 00[ 	]+mov    2097674\(%rip\),%rcx +# 2013a8 <.*>
 #				-> R_X86_64_TPOFF64	*ABS*+0x70
  +119e:	90[ 	]+nop *
  +119f:	90[ 	]+nop *
--- binutils/ld/testsuite/ld-x86-64/tlspic.rd.2mb	2006-02-02 14:57:50.000000000 -0800
+++ binutils/ld/testsuite/ld-x86-64/tlspic.rd	2006-05-25 07:38:18.000000000 -0700
@@ -17,11 +17,11 @@ Section Headers:
   \[ 5\] .rela.plt +.*
   \[ 6\] .plt +.*
   \[ 7\] .text +PROGBITS +0+1000 0+1000 0+1ac 00 +AX +0 +0 4096
-  \[ 8\] .tdata +PROGBITS +0+1011ac 0+11ac 0+60 00 WAT +0 +0 +1
-  \[ 9\] .tbss +NOBITS +0+10120c 0+120c 0+20 00 WAT +0 +0 +1
-  \[10\] .dynamic +DYNAMIC +0+101210 0+1210 0+130 10 +WA +3 +0 +8
-  \[11\] .got +PROGBITS +0+101340 0+1340 0+90 08 +WA +0 +0 +8
-  \[12\] .got.plt +PROGBITS +0+1013d0 0+13d0 0+20 08 +WA +0 +0 +8
+  \[ 8\] .tdata +PROGBITS +0+2011ac 0+11ac 0+60 00 WAT +0 +0 +1
+  \[ 9\] .tbss +NOBITS +0+20120c 0+120c 0+20 00 WAT +0 +0 +1
+  \[10\] .dynamic +DYNAMIC +0+201210 0+1210 0+130 10 +WA +3 +0 +8
+  \[11\] .got +PROGBITS +0+201340 0+1340 0+90 08 +WA +0 +0 +8
+  \[12\] .got.plt +PROGBITS +0+2013d0 0+13d0 0+20 08 +WA +0 +0 +8
   \[13\] .shstrtab +.*
   \[14\] .symtab +.*
   \[15\] .strtab +.*
@@ -36,10 +36,10 @@ There are 4 program headers, starting at
 
 Program Headers:
   Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
-  LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x100000
-  LOAD +0x0+11ac 0x0+1011ac 0x0+1011ac 0x0+244 0x0+244 RW +0x100000
-  DYNAMIC +0x0+1210 0x0+101210 0x0+101210 0x0+130 0x0+130 RW +0x8
-  TLS +0x0+11ac 0x0+1011ac 0x0+1011ac 0x0+60 0x0+80 R +0x1
+  LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x200000
+  LOAD +0x0+11ac 0x0+2011ac 0x0+2011ac 0x0+244 0x0+244 RW +0x200000
+  DYNAMIC +0x0+1210 0x0+201210 0x0+201210 0x0+130 0x0+130 RW +0x8
+  TLS +0x0+11ac 0x0+2011ac 0x0+2011ac 0x0+60 0x0+80 R +0x1
 
  Section to Segment mapping:
   Segment Sections...
--- binutils/ld/testsuite/ld-x86-64/tlspic.sd.2mb	2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlspic.sd	2006-05-25 07:43:30.000000000 -0700
@@ -8,12 +8,12 @@
 .*: +file format elf64-x86-64
 
 Contents of section .got:
- 101340 00000000 00000000 20000000 00000000  .*
- 101350 00000000 00000000 00000000 00000000  .*
- 101360 00000000 00000000 00000000 00000000  .*
- 101370 00000000 00000000 60000000 00000000  .*
- 101380 00000000 00000000 00000000 00000000  .*
- 101390 00000000 00000000 00000000 00000000  .*
- 1013a0 00000000 00000000 00000000 00000000  .*
- 1013b0 00000000 00000000 00000000 00000000  .*
- 1013c0 40000000 00000000 00000000 00000000  .*
+ 201340 00000000 00000000 20000000 00000000  .*
+ 201350 00000000 00000000 00000000 00000000  .*
+ 201360 00000000 00000000 00000000 00000000  .*
+ 201370 00000000 00000000 60000000 00000000  .*
+ 201380 00000000 00000000 00000000 00000000  .*
+ 201390 00000000 00000000 00000000 00000000  .*
+ 2013a0 00000000 00000000 00000000 00000000  .*
+ 2013b0 00000000 00000000 00000000 00000000  .*
+ 2013c0 40000000 00000000 00000000 00000000  .*
--- binutils/ld/testsuite/ld-x86-64/tlspic.td.2mb	2004-05-11 10:08:36.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/tlspic.td	2006-05-25 07:36:49.000000000 -0700
@@ -8,9 +8,9 @@
 .*: +file format elf64-x86-64
 
 Contents of section .tdata:
- 1011ac 11000000 12000000 13000000 14000000  .*
- 1011bc 15000000 16000000 17000000 18000000  .*
- 1011cc 41000000 42000000 43000000 44000000  .*
- 1011dc 45000000 46000000 47000000 48000000  .*
- 1011ec 01010000 02010000 03010000 04010000  .*
- 1011fc 05010000 06010000 07010000 08010000  .*
+ 2011ac 11000000 12000000 13000000 14000000  .*
+ 2011bc 15000000 16000000 17000000 18000000  .*
+ 2011cc 41000000 42000000 43000000 44000000  .*
+ 2011dc 45000000 46000000 47000000 48000000  .*
+ 2011ec 01010000 02010000 03010000 04010000  .*
+ 2011fc 05010000 06010000 07010000 08010000  .*

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

* Re: PATCH: Change x86-64 maximum page size to 2MB
  2006-05-26  4:33   ` PATCH: Change x86-64 maximum page size to 2MB H. J. Lu
@ 2006-05-26 21:48     ` Daniel Jacobowitz
  2006-05-27  0:47       ` H. J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-05-26 21:48 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Nick Clifton, binutils, discuss

On Thu, May 25, 2006 at 04:10:19PM -0700, H. J. Lu wrote:
> On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> > Hi H. J.
> > 
> > >The current x86-64 maximum page size is 1MB. With the future
> > >development, 2MB is better for performance. Using 2MB won't break
> > >anything, except for up to 2MB gap in virtual address space per file,
> > >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> > >shouldn't be an issue for most applications. I have a patch:
> > >
> > >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> > >
> > >which can be used to implement "-z max-page-size=xxxx" so that people
> > >can control maximum page size at the link time if they prefer different
> > >maximum page size.
> > 
> > This seems to be perfectly reasonable.
> 
> I tested this patch on gcc, glibc, 2.4 and 2.6 kernels. I will check
> it in shortly.

If you do this without setting ELF_MINPAGESIZE, won't BFD start to
reject some files?

It doesn't happen obviously, they'll just get corrupted on objcopy;
see the one use of ->minpagesize.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: PATCH: Change x86-64 maximum page size to 2MB
  2006-05-26 21:48     ` Daniel Jacobowitz
@ 2006-05-27  0:47       ` H. J. Lu
  2006-05-27 16:33         ` H. J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-05-27  0:47 UTC (permalink / raw)
  To: Nick Clifton, binutils, discuss

On Thu, May 25, 2006 at 10:43:03PM -0400, Daniel Jacobowitz wrote:
> On Thu, May 25, 2006 at 04:10:19PM -0700, H. J. Lu wrote:
> > On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> > > Hi H. J.
> > > 
> > > >The current x86-64 maximum page size is 1MB. With the future
> > > >development, 2MB is better for performance. Using 2MB won't break
> > > >anything, except for up to 2MB gap in virtual address space per file,
> > > >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> > > >shouldn't be an issue for most applications. I have a patch:
> > > >
> > > >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> > > >
> > > >which can be used to implement "-z max-page-size=xxxx" so that people
> > > >can control maximum page size at the link time if they prefer different
> > > >maximum page size.
> > > 
> > > This seems to be perfectly reasonable.
> > 
> > I tested this patch on gcc, glibc, 2.4 and 2.6 kernels. I will check
> > it in shortly.
> 
> If you do this without setting ELF_MINPAGESIZE, won't BFD start to
> reject some files?
> 
> It doesn't happen obviously, they'll just get corrupted on objcopy;
> see the one use of ->minpagesize.
> 

Thanks. I am checking in this patch. I will add a testcase once we can
use a different maximum page size.


H.J.
---
2006-05-25  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (ELF_MINPAGESIZE): Set to 0x100000.

--- bfd/elf64-x86-64.c.min	2006-05-25 19:54:47.000000000 -0700
+++ bfd/elf64-x86-64.c	2006-05-25 19:56:07.000000000 -0700
@@ -3631,6 +3631,7 @@ static const struct bfd_elf_special_sect
 #define ELF_ARCH			    bfd_arch_i386
 #define ELF_MACHINE_CODE		    EM_X86_64
 #define ELF_MAXPAGESIZE			    0x200000
+#define ELF_MINPAGESIZE			    0x100000
 
 #define elf_backend_can_gc_sections	    1
 #define elf_backend_can_refcount	    1

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

* Re: PATCH: Change x86-64 maximum page size to 2MB
  2006-05-27  0:47       ` H. J. Lu
@ 2006-05-27 16:33         ` H. J. Lu
  0 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2006-05-27 16:33 UTC (permalink / raw)
  To: Nick Clifton, binutils, discuss

On Thu, May 25, 2006 at 08:03:25PM -0700, H. J. Lu wrote:
> On Thu, May 25, 2006 at 10:43:03PM -0400, Daniel Jacobowitz wrote:
> > On Thu, May 25, 2006 at 04:10:19PM -0700, H. J. Lu wrote:
> > > On Fri, May 19, 2006 at 10:12:01AM +0100, Nick Clifton wrote:
> > > > Hi H. J.
> > > > 
> > > > >The current x86-64 maximum page size is 1MB. With the future
> > > > >development, 2MB is better for performance. Using 2MB won't break
> > > > >anything, except for up to 2MB gap in virtual address space per file,
> > > > >instead of 1MB. x86-64 has 48 bits in virtual address space. It
> > > > >shouldn't be an issue for most applications. I have a patch:
> > > > >
> > > > >http://sourceware.org/ml/binutils/2005-05/msg00644.html
> > > > >
> > > > >which can be used to implement "-z max-page-size=xxxx" so that people
> > > > >can control maximum page size at the link time if they prefer different
> > > > >maximum page size.
> > > > 
> > > > This seems to be perfectly reasonable.
> > > 
> > > I tested this patch on gcc, glibc, 2.4 and 2.6 kernels. I will check
> > > it in shortly.
> > 
> > If you do this without setting ELF_MINPAGESIZE, won't BFD start to
> > reject some files?
> > 
> > It doesn't happen obviously, they'll just get corrupted on objcopy;
> > see the one use of ->minpagesize.
> > 
> 
> Thanks. I am checking in this patch. I will add a testcase once we can
> use a different maximum page size.
> 
> 

Linux/x86-64 supports 4K page size. I am changing ELF_MINPAGESIZE to
4K.


H.J.
2006-05-26  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-x86-64.c (ELF_MINPAGESIZE): Changed to 0x1000.

--- bfd/elf64-x86-64.c.4k	2006-05-26 06:54:45.000000000 -0700
+++ bfd/elf64-x86-64.c	2006-05-26 06:55:31.000000000 -0700
@@ -3631,7 +3631,7 @@ static const struct bfd_elf_special_sect
 #define ELF_ARCH			    bfd_arch_i386
 #define ELF_MACHINE_CODE		    EM_X86_64
 #define ELF_MAXPAGESIZE			    0x200000
-#define ELF_MINPAGESIZE			    0x100000
+#define ELF_MINPAGESIZE			    0x1000
 
 #define elf_backend_can_gc_sections	    1
 #define elf_backend_can_refcount	    1

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

* Re: PATCH: Add "-z max-page-size=xxxx"/"-z common-page-size=xxxx"
  2006-05-24  7:24     ` PATCH: Add "-z max-page-size=xxxx"/"-z common-page-size=xxxx" H. J. Lu
@ 2006-05-31 11:36       ` Nick Clifton
  0 siblings, 0 replies; 9+ messages in thread
From: Nick Clifton @ 2006-05-31 11:36 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

Hi H. J.

> bfd/
> 
> 2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* bfd.c (bfd_emul_get_maxpagesize): New.
> 	(bfd_elf_set_pagesize): Likewise.
> 	(bfd_emul_set_maxpagesize): Likewise.
> 	(bfd_emul_get_commonpagesize): Likewise.
> 	(bfd_emul_set_commonpagesize): Likewise.
> 
> 	* elf-bfd.h (elf_backend_data): Add commonpagesize.
> 	(xvec_get_elf_backend_data): New.
> 	(get_elf_backend_data): Use xvec_get_elf_backend_data.
> 
> 	* elf.c (assign_file_positions_for_load_sections): Set
> 	p->p_vaddr with m->p_vaddr if it is valid. Set p->p_align with
> 	m->p_align if it is valid. Adjust p->p_vaddr only if m->p_vaddr
> 	isn't valid.
> 	(copy_elf_program_header): Copy p_vaddr and p_align. Set
> 	p_vaddr_valid and p_align_valid to 1.
> 
> 	* elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
> 	* elfxx-target.h (elfNN_bed): Likewise.
> 
> 	* elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
> 	* elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
> 	* elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.
> 
> 	* elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
> 	(elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.
> 
> 	* targets.c (bfd_find_target): Support NULL abfd.
> 
> include/elf/
> 
> 2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* internal.h (elf_segment_map): Add p_vaddr, p_align,
> 	p_vaddr_valid and p_align_valid.
> 
> ld/
> 
> 2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* emulparams/arcelf.sh (MAXPAGESIZE): Changed to
> 	"CONSTANT (MAXPAGESIZE)".
> 	* emulparams/armelf_nbsd.sh: Likewise.
> 	* emulparams/armelf_vxworks.sh: Likewise.
> 	* emulparams/armnto.sh: Likewise.
> 	* emulparams/armsymbian.sh: Likewise.
> 	* emulparams/crislinux.sh: Likewise.
> 	* emulparams/elf32_i860.sh: Likewise.
> 	* emulparams/elf32_i960.sh: Likewise.
> 	* emulparams/elf32am33lin.sh: Likewise.
> 	* emulparams/elf32bfinfd.sh: Likewise.
> 	* emulparams/elf32bmipn32-defs.sh: Likewise.
> 	* emulparams/elf32frvfd.sh: Likewise.
> 	* emulparams/elf32i370.sh: Likewise.
> 	* emulparams/elf32lppcnto.sh: Likewise.
> 	* emulparams/elf32mcore.sh: Likewise.
> 	* emulparams/elf32openrisc.sh: Likewise.
> 	* emulparams/elf32ppcnto.sh: Likewise.
> 	* emulparams/elf32ppcwindiss.sh: Likewise.
> 	* emulparams/elf32vax.sh: Likewise.
> 	* emulparams/elf32xc16x.sh: Likewise.
> 	* emulparams/elf32xc16xl.sh: Likewise.
> 	* emulparams/elf32xc16xs.sh: Likewise.
> 	* emulparams/elf64_aix.sh: Likewise.
> 	* emulparams/elf64hppa.sh: Likewise.
> 	* emulparams/elf64mmix.sh: Likewise.
> 	* emulparams/elf_i386_be.sh: Likewise.
> 	* emulparams/elf_i386_chaos.sh: Likewise.
> 	* emulparams/elf_i386_ldso.sh: Likewise.
> 	* emulparams/hppa64linux.sh: Likewise.
> 	* emulparams/hppalinux.sh: Likewise.
> 	* emulparams/hppaobsd.sh: Likewise.
> 	* emulparams/i386lynx.sh: Likewise.
> 	* emulparams/i386moss.sh: Likewise.
> 	* emulparams/i386nto.sh: Likewise.
> 	* emulparams/i386nw.sh: Likewise.
> 	* emulparams/m32relf_linux.sh: Likewise.
> 	* emulparams/m68kpsos.sh: Likewise.
> 	* emulparams/or32elf.sh: Likewise.
> 	* emulparams/pjelf.sh: Likewise.
> 	* emulparams/pjlelf.sh: Likewise.
> 	* emulparams/ppclynx.sh: Likewise.
> 	* emulparams/ppcnw.sh: Likewise.
> 	* emulparams/shelf32_nbsd.sh : Likewise.
> 	* emulparams/shelf_nbsd.sh: Likewise.
> 	* emulparams/shelf_nto.sh: Likewise.
> 	* emulparams/shlelf_nto.sh: Likewise.
> 	* emulparams/xtensa-config.sh: Likewise.
> 
> 	* emulparams/armelf_linux.sh (MAXPAGESIZE): Changed to
> 	"CONSTANT (MAXPAGESIZE)".
> 	(COMMONPAGESIZE): Changed to "CONSTANT (COMMONPAGESIZE)".
> 	* emulparams/elf32_sparc.sh: Likewise.
> 	* emulparams/elf32bmip.sh: Likewise.
> 	* emulparams/elf32ppccommon.sh: Likewise.
> 	* emulparams/elf64_ia64.sh: Likewise.
> 	* emulparams/elf64_s390.sh: Likewise.
> 	* emulparams/elf64_sparc.sh: Likewise.
> 	* emulparams/elf64alpha.sh: Likewise.
> 	* emulparams/elf64ppc.sh: Likewise.
> 	* emulparams/elf_i386.sh: Likewise.
> 	* emulparams/elf_i386_vxworks.sh: Likewise.
> 	* emulparams/elf_s390.sh: Likewise.
> 	* emulparams/elf_x86_64.sh: Likewise.
> 	* emulparams/shlelf32_linux.sh: Likewise.
> 	* emulparams/shlelf_linux.sh: Likewise.
> 
> 	* emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Changed to
> 	"CONSTANT (COMMONPAGESIZE)".
> 	* emulparams/elf32btsmipn32.sh: Likewise.
> 
> 	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
> 	"-z max-page-size=" and "-z common-page-size=".
> 	(gld${EMULATION_NAME}_list_options): Likewise.
> 
> 	* ld.h (ld_config_type): Add maxpagesize and commonpagesize.
> 
> 	* ld.texinfo: Document "-z max-page-size=" and
> 	"-z common-page-size=".
> 
> 	* ldexp.c (exp_print_token): Handle CONSTANT.
> 	(fold_name): Likewise.
> 	* ldgram.y: Likewise.
> 	* ldlex.l: Likewise.
> 
> 	* ldmain.c (main): Initiliaze config.maxpagesize and
> 	config.commonpagesize. Call bfd_emul_set_maxpagesize if
> 	config.maxpagesize isn't 0. Call bfd_emul_set_commonpagesize if
> 	config.commonpagesize config.maxpagesize isn't 0.
> 
> ld/testsuite/
> 
> 2006-05-22  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* ld-elf/binutils.exp: New file.
> 	* ld-elf/maxpage.d: Likewise.
> 	* ld-elf/maxpage.s: Likewise.


Approved (mainline only) - please apply.

Cheers
   Nick


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

end of thread, other threads:[~2006-05-30 10:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17 11:24 RFC: Change x86-64 maximum page size to 2MB H. J. Lu
2006-05-19 12:39 ` Nick Clifton
2006-05-22 23:57   ` H. J. Lu
2006-05-24  7:24     ` PATCH: Add "-z max-page-size=xxxx"/"-z common-page-size=xxxx" H. J. Lu
2006-05-31 11:36       ` Nick Clifton
2006-05-26  4:33   ` PATCH: Change x86-64 maximum page size to 2MB H. J. Lu
2006-05-26 21:48     ` Daniel Jacobowitz
2006-05-27  0:47       ` H. J. Lu
2006-05-27 16:33         ` H. J. Lu

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).