aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog34
-rw-r--r--bfd/bfd-in2.h8
-rw-r--r--bfd/bfd.c127
-rw-r--r--bfd/elf-bfd.h8
-rw-r--r--bfd/elf32-arm.c3
-rw-r--r--bfd/elf32-mips.c1
-rw-r--r--bfd/elf32-ppc.c1
-rw-r--r--bfd/elf32-sh.c3
-rw-r--r--bfd/elf32-sh64.c3
-rw-r--r--bfd/elf32-sparc.c1
-rw-r--r--bfd/elf64-alpha.c1
-rw-r--r--bfd/elf64-ppc.c1
-rw-r--r--bfd/elf64-sparc.c1
-rw-r--r--bfd/elf64-x86-64.c1
-rw-r--r--bfd/elfn32-mips.c1
-rw-r--r--bfd/elfxx-ia64.c2
-rw-r--r--bfd/elfxx-target.h7
-rw-r--r--bfd/targets.c35
-rw-r--r--ld/ChangeLog92
-rw-r--r--ld/emulparams/arcelf.sh2
-rw-r--r--ld/emulparams/armelf_linux.sh4
-rw-r--r--ld/emulparams/armelf_nbsd.sh2
-rw-r--r--ld/emulparams/armelf_vxworks.sh2
-rw-r--r--ld/emulparams/armnto.sh2
-rw-r--r--ld/emulparams/armsymbian.sh5
-rwxr-xr-xld/emulparams/bfin.sh2
-rw-r--r--ld/emulparams/crislinux.sh2
-rw-r--r--ld/emulparams/elf32_i860.sh2
-rw-r--r--ld/emulparams/elf32_i960.sh2
-rw-r--r--ld/emulparams/elf32_sparc.sh4
-rw-r--r--ld/emulparams/elf32am33lin.sh2
-rw-r--r--ld/emulparams/elf32bfinfd.sh2
-rw-r--r--ld/emulparams/elf32bmip.sh4
-rw-r--r--ld/emulparams/elf32bmipn32-defs.sh2
-rwxr-xr-xld/emulparams/elf32bmipn32.sh2
-rw-r--r--ld/emulparams/elf32btsmipn32.sh2
-rw-r--r--ld/emulparams/elf32frvfd.sh2
-rw-r--r--ld/emulparams/elf32i370.sh2
-rw-r--r--ld/emulparams/elf32lppcnto.sh2
-rw-r--r--ld/emulparams/elf32mcore.sh2
-rwxr-xr-xld/emulparams/elf32openrisc.sh2
-rw-r--r--ld/emulparams/elf32ppccommon.sh4
-rw-r--r--ld/emulparams/elf32ppcnto.sh2
-rw-r--r--ld/emulparams/elf32ppcwindiss.sh2
-rw-r--r--ld/emulparams/elf32vax.sh2
-rw-r--r--ld/emulparams/elf32xc16x.sh2
-rw-r--r--ld/emulparams/elf32xc16xl.sh2
-rw-r--r--ld/emulparams/elf32xc16xs.sh2
-rw-r--r--ld/emulparams/elf64_aix.sh2
-rw-r--r--ld/emulparams/elf64_ia64.sh4
-rw-r--r--ld/emulparams/elf64_s390.sh4
-rw-r--r--ld/emulparams/elf64_sparc.sh4
-rw-r--r--ld/emulparams/elf64alpha.sh4
-rwxr-xr-xld/emulparams/elf64hppa.sh2
-rw-r--r--ld/emulparams/elf64mmix.sh6
-rw-r--r--ld/emulparams/elf64ppc.sh4
-rw-r--r--ld/emulparams/elf_i386.sh4
-rw-r--r--ld/emulparams/elf_i386_be.sh2
-rw-r--r--ld/emulparams/elf_i386_chaos.sh2
-rw-r--r--ld/emulparams/elf_i386_ldso.sh2
-rw-r--r--ld/emulparams/elf_i386_vxworks.sh4
-rw-r--r--ld/emulparams/elf_s390.sh4
-rw-r--r--ld/emulparams/elf_x86_64.sh4
-rw-r--r--ld/emulparams/hppa64linux.sh2
-rw-r--r--ld/emulparams/hppalinux.sh2
-rw-r--r--ld/emulparams/hppaobsd.sh2
-rw-r--r--ld/emulparams/i386lynx.sh2
-rw-r--r--ld/emulparams/i386moss.sh2
-rw-r--r--ld/emulparams/i386nto.sh2
-rw-r--r--ld/emulparams/i386nw.sh2
-rw-r--r--ld/emulparams/m32relf_linux.sh2
-rw-r--r--ld/emulparams/m68kelf.sh2
-rw-r--r--ld/emulparams/m68kpsos.sh2
-rw-r--r--ld/emulparams/or32elf.sh2
-rw-r--r--ld/emulparams/pjelf.sh2
-rw-r--r--ld/emulparams/pjlelf.sh2
-rw-r--r--ld/emulparams/ppclynx.sh2
-rw-r--r--ld/emulparams/ppcnw.sh2
-rw-r--r--ld/emulparams/shelf32_nbsd.sh2
-rw-r--r--ld/emulparams/shelf_nbsd.sh2
-rw-r--r--ld/emulparams/shelf_nto.sh2
-rw-r--r--ld/emulparams/shlelf32_linux.sh4
-rw-r--r--ld/emulparams/shlelf_linux.sh4
-rw-r--r--ld/emulparams/shlelf_nto.sh2
-rw-r--r--ld/emulparams/xtensa-config.sh2
-rw-r--r--ld/emultempl/elf32.em18
-rw-r--r--ld/ld.h6
-rw-r--r--ld/ld.texinfo6
-rw-r--r--ld/ldexp.c11
-rw-r--r--ld/ldgram.y3
-rw-r--r--ld/ldlex.l1
-rw-r--r--ld/ldmain.c10
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-elf/binutils.exp80
-rw-r--r--ld/testsuite/ld-elf/commonpage1.d8
-rw-r--r--ld/testsuite/ld-elf/maxpage1.d8
-rw-r--r--ld/testsuite/ld-elf/maxpage1.s7
97 files changed, 559 insertions, 105 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 65de90e..075bbc3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,37 @@
+2006-05-30 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.
+ * bfd-in2.h: Regenerated.
+
+ * elf-bfd.h (elf_backend_data): Add commonpagesize.
+ (xvec_get_elf_backend_data): New.
+ (get_elf_backend_data): Use xvec_get_elf_backend_data.
+
+ * 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.
+
2006-05-30 Nick Clifton <nickc@redhat.com>
* po/es.po: Updated Spanish translation.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index cdbeb58..b896a6b 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -4709,6 +4709,14 @@ void bfd_preserve_restore (bfd *, struct bfd_preserve *);
void bfd_preserve_finish (bfd *, struct bfd_preserve *);
+bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
/* Extracted from archive.c. */
symindex bfd_get_next_mapent
(bfd *abfd, symindex previous, carsym **sym);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 733f6ee..ebfd314 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1513,3 +1513,130 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
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);
+}
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3a32fc4..89baa9c 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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;
@@ -1196,8 +1199,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. */
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e2beac7..ae8ef8f 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -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
@@ -8406,6 +8406,7 @@ const struct elf_size_info elf32_arm_size_info = {
#define ELF_MAXPAGESIZE 0x8000
#endif
#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define bfd_elf32_mkobject elf32_arm_mkobject
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 6ed4ad3..fd8a427 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1599,6 +1599,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
/* 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"
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 9be70f8..b1d18e7 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -7436,6 +7436,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#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
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 118690d..cf59095 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -7371,6 +7371,7 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
#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 asection *plt,
#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
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 219f753..55aa25b 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -785,6 +785,7 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
#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_section sh64_elf_special_sections[] =
#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"
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 3bfb38a..3f0c7d6 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -172,6 +172,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
#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
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 76d0661..625d834 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -5231,6 +5231,7 @@ static const struct elf_size_info alpha_elf_size_info =
#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
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index b1ec942..2c29b57 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index dd1c302..5c928e2 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -814,6 +814,7 @@ const struct elf_size_info elf64_sparc_size_info =
#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
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 7799a43..42569b7 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3632,6 +3632,7 @@ static const struct bfd_elf_special_section
#define ELF_MACHINE_CODE EM_X86_64
#define ELF_MAXPAGESIZE 0x200000
#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index b1211f0..8e7eb53 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -2384,6 +2384,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
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"
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 953a776..817ccb1 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -5717,6 +5717,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#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 (bfd *abfd ATTRIBUTE_UNUSED,
#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x1000 /* 4K */
+#undef ELF_COMMONPAGESIZE
#undef elfNN_bed
#define elfNN_bed elfNN_ia64_hpux_bed
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 5a5ca34..fad00f2 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -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 \
@@ -559,12 +563,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,
diff --git a/bfd/targets.c b/bfd/targets.c
index 849eb94..09e4bc0 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -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, bfd *abfd)
/* 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;
}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 42d6864..0c75415 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,95 @@
+2006-05-30 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.
+
2006-05-30 Nick Clifton <nickc@redhat.com>
* po/es.po: Updated Spanish translation.
diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh
index b1c9c17..f023093 100644
--- a/ld/emulparams/arcelf.sh
+++ b/ld/emulparams/arcelf.sh
@@ -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=
diff --git a/ld/emulparams/armelf_linux.sh b/ld/emulparams/armelf_linux.sh
index 39b7f65..e7c8025 100644
--- a/ld/emulparams/armelf_linux.sh
+++ b/ld/emulparams/armelf_linux.sh
@@ -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
diff --git a/ld/emulparams/armelf_nbsd.sh b/ld/emulparams/armelf_nbsd.sh
index 3d94839..517cd62 100644
--- a/ld/emulparams/armelf_nbsd.sh
+++ b/ld/emulparams/armelf_nbsd.sh
@@ -1,5 +1,5 @@
. ${srcdir}/emulparams/armelf.sh
-MAXPAGESIZE=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
TEXT_START_ADDR=0x00008000
TARGET2_TYPE=got-rel
diff --git a/ld/emulparams/armelf_vxworks.sh b/ld/emulparams/armelf_vxworks.sh
index 7b6445e..ca5c907 100644
--- a/ld/emulparams/armelf_vxworks.sh
+++ b/ld/emulparams/armelf_vxworks.sh
@@ -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
diff --git a/ld/emulparams/armnto.sh b/ld/emulparams/armnto.sh
index 6429612..6891e63 100644
--- a/ld/emulparams/armnto.sh
+++ b/ld/emulparams/armnto.sh
@@ -17,7 +17,7 @@ GENERATE_SHLIB_SCRIPT=yes
ARCH=arm
MACHINE=
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ENTRY=_start
diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh
index a52d05b..3d7e864 100644
--- a/ld/emulparams/armsymbian.sh
+++ b/ld/emulparams/armsymbian.sh
@@ -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)"
diff --git a/ld/emulparams/bfin.sh b/ld/emulparams/bfin.sh
index 5e7adda..b7695a4 100755
--- a/ld/emulparams/bfin.sh
+++ b/ld/emulparams/bfin.sh
@@ -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
diff --git a/ld/emulparams/crislinux.sh b/ld/emulparams/crislinux.sh
index 98d12f3..e41024c 100644
--- a/ld/emulparams/crislinux.sh
+++ b/ld/emulparams/crislinux.sh
@@ -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
diff --git a/ld/emulparams/elf32_i860.sh b/ld/emulparams/elf32_i860.sh
index 6769fa5..1ab4204 100644
--- a/ld/emulparams/elf32_i860.sh
+++ b/ld/emulparams/elf32_i860.sh
@@ -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
diff --git a/ld/emulparams/elf32_i960.sh b/ld/emulparams/elf32_i960.sh
index 10ec3fa..1ef7292 100644
--- a/ld/emulparams/elf32_i960.sh
+++ b/ld/emulparams/elf32_i960.sh
@@ -5,4 +5,4 @@ ARCH=i960
MACHINE=
TEXT_START_ADDR=0
EMBEDDED=yes
-MAXPAGESIZE=0x2000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emulparams/elf32_sparc.sh b/ld/emulparams/elf32_sparc.sh
index af23252..1d31d22 100644
--- a/ld/emulparams/elf32_sparc.sh
+++ b/ld/emulparams/elf32_sparc.sh
@@ -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
diff --git a/ld/emulparams/elf32am33lin.sh b/ld/emulparams/elf32am33lin.sh
index f8b3a89..31dbc70 100644
--- a/ld/emulparams/elf32am33lin.sh
+++ b/ld/emulparams/elf32am33lin.sh
@@ -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=
diff --git a/ld/emulparams/elf32bfinfd.sh b/ld/emulparams/elf32bfinfd.sh
index 9047c6a..19ec748 100644
--- a/ld/emulparams/elf32bfinfd.sh
+++ b/ld/emulparams/elf32bfinfd.sh
@@ -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
diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh
index 5da3049..7260be0 100644
--- a/ld/emulparams/elf32bmip.sh
+++ b/ld/emulparams/elf32bmip.sh
@@ -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=
diff --git a/ld/emulparams/elf32bmipn32-defs.sh b/ld/emulparams/elf32bmipn32-defs.sh
index b81ac49..8f56ccf 100644
--- a/ld/emulparams/elf32bmipn32-defs.sh
+++ b/ld/emulparams/elf32bmipn32-defs.sh
@@ -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.
diff --git a/ld/emulparams/elf32bmipn32.sh b/ld/emulparams/elf32bmipn32.sh
index a320eb2..c26b6b3 100755
--- a/ld/emulparams/elf32bmipn32.sh
+++ b/ld/emulparams/elf32bmipn32.sh
@@ -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="
diff --git a/ld/emulparams/elf32btsmipn32.sh b/ld/emulparams/elf32btsmipn32.sh
index 5ca6797..10c5565 100644
--- a/ld/emulparams/elf32btsmipn32.sh
+++ b/ld/emulparams/elf32btsmipn32.sh
@@ -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.*)'
diff --git a/ld/emulparams/elf32frvfd.sh b/ld/emulparams/elf32frvfd.sh
index 42b36f7..7029d47 100644
--- a/ld/emulparams/elf32frvfd.sh
+++ b/ld/emulparams/elf32frvfd.sh
@@ -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
diff --git a/ld/emulparams/elf32i370.sh b/ld/emulparams/elf32i370.sh
index d9d5d85..425238c 100644
--- a/ld/emulparams/elf32i370.sh
+++ b/ld/emulparams/elf32i370.sh
@@ -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=
diff --git a/ld/emulparams/elf32lppcnto.sh b/ld/emulparams/elf32lppcnto.sh
index 1f19055..c45260d 100644
--- a/ld/emulparams/elf32lppcnto.sh
+++ b/ld/emulparams/elf32lppcnto.sh
@@ -1,5 +1,5 @@
. ${srcdir}/emulparams/elf32ppc.sh
OUTPUT_FORMAT="elf32-powerpcle"
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
TEXT_START_ADDR=0x48040000
diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index 930a9c3..6d9f2d6 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -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
diff --git a/ld/emulparams/elf32openrisc.sh b/ld/emulparams/elf32openrisc.sh
index a65dcd8..53e88dd 100755
--- a/ld/emulparams/elf32openrisc.sh
+++ b/ld/emulparams/elf32openrisc.sh
@@ -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
diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh
index b5fbc8d..1a12890 100644
--- a/ld/emulparams/elf32ppccommon.sh
+++ b/ld/emulparams/elf32ppccommon.sh
@@ -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);'
diff --git a/ld/emulparams/elf32ppcnto.sh b/ld/emulparams/elf32ppcnto.sh
index dd4a79c..d0b3e3d 100644
--- a/ld/emulparams/elf32ppcnto.sh
+++ b/ld/emulparams/elf32ppcnto.sh
@@ -1,4 +1,4 @@
. ${srcdir}/emulparams/elf32ppc.sh
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
TEXT_START_ADDR=0x48040000
diff --git a/ld/emulparams/elf32ppcwindiss.sh b/ld/emulparams/elf32ppcwindiss.sh
index c0e6138..d217de9 100644
--- a/ld/emulparams/elf32ppcwindiss.sh
+++ b/ld/emulparams/elf32ppcwindiss.sh
@@ -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.
diff --git a/ld/emulparams/elf32vax.sh b/ld/emulparams/elf32vax.sh
index 56bbab7..42e846f 100644
--- a/ld/emulparams/elf32vax.sh
+++ b/ld/emulparams/elf32vax.sh
@@ -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=
diff --git a/ld/emulparams/elf32xc16x.sh b/ld/emulparams/elf32xc16x.sh
index 808feed..f88ccee 100644
--- a/ld/emulparams/elf32xc16x.sh
+++ b/ld/emulparams/elf32xc16x.sh
@@ -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
diff --git a/ld/emulparams/elf32xc16xl.sh b/ld/emulparams/elf32xc16xl.sh
index 333f2a6..14eb24b 100644
--- a/ld/emulparams/elf32xc16xl.sh
+++ b/ld/emulparams/elf32xc16xl.sh
@@ -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
diff --git a/ld/emulparams/elf32xc16xs.sh b/ld/emulparams/elf32xc16xs.sh
index df36f41..2454963 100644
--- a/ld/emulparams/elf32xc16xs.sh
+++ b/ld/emulparams/elf32xc16xs.sh
@@ -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
diff --git a/ld/emulparams/elf64_aix.sh b/ld/emulparams/elf64_aix.sh
index 738fea9..39325f5 100644
--- a/ld/emulparams/elf64_aix.sh
+++ b/ld/emulparams/elf64_aix.sh
@@ -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
diff --git a/ld/emulparams/elf64_ia64.sh b/ld/emulparams/elf64_ia64.sh
index c5be56e..7e5e54d 100644
--- a/ld/emulparams/elf64_ia64.sh
+++ b/ld/emulparams/elf64_ia64.sh
@@ -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))"
diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh
index ea75d31..a26bbb6 100644
--- a/ld/emulparams/elf64_s390.sh
+++ b/ld/emulparams/elf64_s390.sh
@@ -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=
diff --git a/ld/emulparams/elf64_sparc.sh b/ld/emulparams/elf64_sparc.sh
index 0c0f5d8..cef4bff 100644
--- a/ld/emulparams/elf64_sparc.sh
+++ b/ld/emulparams/elf64_sparc.sh
@@ -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=
diff --git a/ld/emulparams/elf64alpha.sh b/ld/emulparams/elf64alpha.sh
index 47a0bb0..2c3b7d4 100644
--- a/ld/emulparams/elf64alpha.sh
+++ b/ld/emulparams/elf64alpha.sh
@@ -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=
diff --git a/ld/emulparams/elf64hppa.sh b/ld/emulparams/elf64hppa.sh
index 26c3153..b0a1fdc 100755
--- a/ld/emulparams/elf64hppa.sh
+++ b/ld/emulparams/elf64hppa.sh
@@ -4,7 +4,7 @@ LIB_PATH="=/usr/lib/pa20_64:=/opt/langtools/lib/pa20_64"
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
diff --git a/ld/emulparams/elf64mmix.sh b/ld/emulparams/elf64mmix.sh
index 22b207f..7f867fb 100644
--- a/ld/emulparams/elf64mmix.sh
+++ b/ld/emulparams/elf64mmix.sh
@@ -12,11 +12,7 @@ TEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
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
diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh
index 8285723..75fd075 100644
--- a/ld/emulparams/elf64ppc.sh
+++ b/ld/emulparams/elf64ppc.sh
@@ -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
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index af7010b..bdeaebb 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -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=
diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh
index 2c681b7..460707f 100644
--- a/ld/emulparams/elf_i386_be.sh
+++ b/ld/emulparams/elf_i386_be.sh
@@ -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
diff --git a/ld/emulparams/elf_i386_chaos.sh b/ld/emulparams/elf_i386_chaos.sh
index e018231..a652913 100644
--- a/ld/emulparams/elf_i386_chaos.sh
+++ b/ld/emulparams/elf_i386_chaos.sh
@@ -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=
diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh
index a477a69..d62184f 100644
--- a/ld/emulparams/elf_i386_ldso.sh
+++ b/ld/emulparams/elf_i386_ldso.sh
@@ -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=
diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh
index 8bce8f7..cb36283 100644
--- a/ld/emulparams/elf_i386_vxworks.sh
+++ b/ld/emulparams/elf_i386_vxworks.sh
@@ -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=
diff --git a/ld/emulparams/elf_s390.sh b/ld/emulparams/elf_s390.sh
index 8d057dc..d958504 100644
--- a/ld/emulparams/elf_s390.sh
+++ b/ld/emulparams/elf_s390.sh
@@ -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=
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index 9af2af5..f9ed236 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -2,8 +2,8 @@ SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-x86-64"
TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x200000
-COMMONPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
NONPAGED_TEXT_START_ADDR=0x400000
ARCH="i386:x86-64"
MACHINE=
diff --git a/ld/emulparams/hppa64linux.sh b/ld/emulparams/hppa64linux.sh
index aaf8c72..5ab4f4b 100644
--- a/ld/emulparams/hppa64linux.sh
+++ b/ld/emulparams/hppa64linux.sh
@@ -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"
diff --git a/ld/emulparams/hppalinux.sh b/ld/emulparams/hppalinux.sh
index 89a253f..4c4f943 100644
--- a/ld/emulparams/hppalinux.sh
+++ b/ld/emulparams/hppalinux.sh
@@ -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
diff --git a/ld/emulparams/hppaobsd.sh b/ld/emulparams/hppaobsd.sh
index 0227dc5..0d3bf94 100644
--- a/ld/emulparams/hppaobsd.sh
+++ b/ld/emulparams/hppaobsd.sh
@@ -3,4 +3,4 @@
OUTPUT_FORMAT="elf32-hppa"
TEXT_START_ADDR=0x1000
TARGET_PAGE_SIZE=0x1000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emulparams/i386lynx.sh b/ld/emulparams/i386lynx.sh
index 3235ebe..18e0860 100644
--- a/ld/emulparams/i386lynx.sh
+++ b/ld/emulparams/i386lynx.sh
@@ -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=
diff --git a/ld/emulparams/i386moss.sh b/ld/emulparams/i386moss.sh
index eece447..659c7f2 100644
--- a/ld/emulparams/i386moss.sh
+++ b/ld/emulparams/i386moss.sh
@@ -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=
diff --git a/ld/emulparams/i386nto.sh b/ld/emulparams/i386nto.sh
index e4872ed..256d4c8 100644
--- a/ld/emulparams/i386nto.sh
+++ b/ld/emulparams/i386nto.sh
@@ -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
diff --git a/ld/emulparams/i386nw.sh b/ld/emulparams/i386nw.sh
index 621b475..dd5558c 100644
--- a/ld/emulparams/i386nw.sh
+++ b/ld/emulparams/i386nw.sh
@@ -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
diff --git a/ld/emulparams/m32relf_linux.sh b/ld/emulparams/m32relf_linux.sh
index be2ad23..9a4ee97 100644
--- a/ld/emulparams/m32relf_linux.sh
+++ b/ld/emulparams/m32relf_linux.sh
@@ -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).
diff --git a/ld/emulparams/m68kelf.sh b/ld/emulparams/m68kelf.sh
index b784a3c..4771f6b 100644
--- a/ld/emulparams/m68kelf.sh
+++ b/ld/emulparams/m68kelf.sh
@@ -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=
diff --git a/ld/emulparams/m68kpsos.sh b/ld/emulparams/m68kpsos.sh
index 34eb8ca..22d1598 100644
--- a/ld/emulparams/m68kpsos.sh
+++ b/ld/emulparams/m68kpsos.sh
@@ -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
diff --git a/ld/emulparams/or32elf.sh b/ld/emulparams/or32elf.sh
index 04d1630..5f6b467 100644
--- a/ld/emulparams/or32elf.sh
+++ b/ld/emulparams/or32elf.sh
@@ -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
diff --git a/ld/emulparams/pjelf.sh b/ld/emulparams/pjelf.sh
index acfd2b3..97eba8f 100644
--- a/ld/emulparams/pjelf.sh
+++ b/ld/emulparams/pjelf.sh
@@ -1,5 +1,5 @@
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-pj"
TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=pj
diff --git a/ld/emulparams/pjlelf.sh b/ld/emulparams/pjlelf.sh
index 35958fd..eb56810 100644
--- a/ld/emulparams/pjlelf.sh
+++ b/ld/emulparams/pjlelf.sh
@@ -1,5 +1,5 @@
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-pjl"
TEXT_START_ADDR=0x1000000
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=pj
diff --git a/ld/emulparams/ppclynx.sh b/ld/emulparams/ppclynx.sh
index 2534687..5c5769e 100644
--- a/ld/emulparams/ppclynx.sh
+++ b/ld/emulparams/ppclynx.sh
@@ -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=
diff --git a/ld/emulparams/ppcnw.sh b/ld/emulparams/ppcnw.sh
index c3ead43..14b2745 100644
--- a/ld/emulparams/ppcnw.sh
+++ b/ld/emulparams/ppcnw.sh
@@ -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
diff --git a/ld/emulparams/shelf32_nbsd.sh b/ld/emulparams/shelf32_nbsd.sh
index 14965ef..63aee8f 100644
--- a/ld/emulparams/shelf32_nbsd.sh
+++ b/ld/emulparams/shelf32_nbsd.sh
@@ -5,7 +5,7 @@
OUTPUT_FORMAT="elf32-sh64-nbsd"
TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ENTRY=__start
diff --git a/ld/emulparams/shelf_nbsd.sh b/ld/emulparams/shelf_nbsd.sh
index 3fcd492..ad295e9 100644
--- a/ld/emulparams/shelf_nbsd.sh
+++ b/ld/emulparams/shelf_nbsd.sh
@@ -5,7 +5,7 @@
OUTPUT_FORMAT="elf32-sh-nbsd"
TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
DATA_START_SYMBOLS='__data_start = . ;';
diff --git a/ld/emulparams/shelf_nto.sh b/ld/emulparams/shelf_nto.sh
index f2252fb..70a0610 100644
--- a/ld/emulparams/shelf_nto.sh
+++ b/ld/emulparams/shelf_nto.sh
@@ -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
diff --git a/ld/emulparams/shlelf32_linux.sh b/ld/emulparams/shlelf32_linux.sh
index 59d4179..ba32e79 100644
--- a/ld/emulparams/shlelf32_linux.sh
+++ b/ld/emulparams/shlelf32_linux.sh
@@ -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
diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh
index 528b725..b06df26 100644
--- a/ld/emulparams/shlelf_linux.sh
+++ b/ld/emulparams/shlelf_linux.sh
@@ -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
diff --git a/ld/emulparams/shlelf_nto.sh b/ld/emulparams/shlelf_nto.sh
index d23e69a..c6c04f6 100644
--- a/ld/emulparams/shlelf_nto.sh
+++ b/ld/emulparams/shlelf_nto.sh
@@ -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
diff --git a/ld/emulparams/xtensa-config.sh b/ld/emulparams/xtensa-config.sh
index 5a5e504..82e96a4 100644
--- a/ld/emulparams/xtensa-config.sh
+++ b/ld/emulparams/xtensa-config.sh
@@ -1,3 +1,3 @@
# Xtensa configuration settings.
-MAXPAGESIZE=0x1000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index dffcff8..cafb6c5 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -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
diff --git a/ld/ld.h b/ld/ld.h
index e1aa62c..174e5b9 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -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;
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index fc2413e..182f060 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -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.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index c9d707e..b33329d 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -99,6 +99,7 @@ exp_print_token (token_code_type code, int infix_p)
{ 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;
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 3829e6a..1f9d2fa 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -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 ')'
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 56ec391..10339dd 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -316,6 +316,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<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 */ }
diff --git a/ld/ldmain.c b/ld/ldmain.c
index db87a40..8881190 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -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)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f2ea630..405a18a 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/binutils.exp: New file.
+ * ld-elf/commonpage1.d: Likewise.
+ * ld-elf/maxpage1.d: Likewise.
+ * ld-elf/maxpage1.s: Likewise.
+
2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
* ld-x86-64/tlsbin.dd: Updated for 2MB maximum page size.
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
new file mode 100644
index 0000000..77ba761
--- /dev/null
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -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" maxpage1
+strip_test "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
diff --git a/ld/testsuite/ld-elf/commonpage1.d b/ld/testsuite/ld-elf/commonpage1.d
new file mode 100644
index 0000000..5b685b2
--- /dev/null
+++ b/ld/testsuite/ld-elf/commonpage1.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x200000 -z common-page-size=0x100000
+#readelf: -l --wide
+
+#...
+ LOAD+.*0x200000
+ LOAD+.*0x200000
+#pass
diff --git a/ld/testsuite/ld-elf/maxpage1.d b/ld/testsuite/ld-elf/maxpage1.d
new file mode 100644
index 0000000..f7f2dbf
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage1.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x200000
+#readelf: -l --wide
+
+#...
+ LOAD+.*0x200000
+ LOAD+.*0x200000
+#pass
diff --git a/ld/testsuite/ld-elf/maxpage1.s b/ld/testsuite/ld-elf/maxpage1.s
new file mode 100644
index 0000000..b64ee3a
--- /dev/null
+++ b/ld/testsuite/ld-elf/maxpage1.s
@@ -0,0 +1,7 @@
+ .text
+ .global _start
+_start:
+ .long 0
+
+ .data
+ .long 0