From: H.J. Lu Date: Tue, 30 May 2006 16:45:32 +0000 (+0000) Subject: bfd/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=24718e3ba575439155f233fc593a9ebd6d33f3c5;p=binutils-gdb.git bfd/ 2006-05-30 H.J. Lu * 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. ld/ 2006-05-30 H.J. Lu * 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-30 H.J. Lu * ld-elf/binutils.exp: New file. * ld-elf/commonpage1.d: Likewise. * ld-elf/maxpage1.d: Likewise. * ld-elf/maxpage1.s: Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 65de90e5cc9..075bbc3a900 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,37 @@ +2006-05-30 H.J. Lu + + * 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 * po/es.po: Updated Spanish translation. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index cdbeb583de8..b896a6b9b00 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 733f6ee0272..ebfd3146eb5 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 3a32fc447d0..89baa9c463e 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 e2beac74047..ae8ef8f70ac 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 6ed4ad35f62..fd8a4277123 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 9be70f82ce7..b1d18e7c236 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 118690d9a58..cf59095ed47 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 219f7533f15..55aa25b7de9 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 3bfb38a3d44..3f0c7d6c6d9 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 76d0661a116..625d8341856 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 b1ec94230a5..2c29b571b29 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 dd1c302174a..5c928e232a7 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 7799a43f070..42569b78aa6 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 b1211f0c65e..8e7eb53c319 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 953a7767d16..817ccb14390 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 5a5ca348996..fad00f2a0f5 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 849eb944fbe..09e4bc0b398 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 <>, choose the - one in the environment variable <>; 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 <> 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 <>, + choose the one in the environment variable <>; 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 <>. This causes + <> 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 42d6864e9ad..0c75415625d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,95 @@ +2006-05-30 H.J. Lu + + * 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 * po/es.po: Updated Spanish translation. diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh index b1c9c1760ce..f023093e30c 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 39b7f656409..e7c8025d9a2 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 3d948391535..517cd626594 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 7b6445e8308..ca5c907a07b 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 64296129dc2..6891e63432f 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 a52d05b2480..3d7e8649597 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 5e7adda4dd9..b7695a4c8b9 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 98d12f3929b..e41024c9a7a 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 6769fa54d26..1ab42043313 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 10ec3fa573b..1ef729297ab 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 af23252949f..1d31d22282f 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 f8b3a890621..31dbc70b882 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 9047c6a750f..19ec748b7fb 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 5da30490bde..7260be0ecf2 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 b81ac49ec30..8f56ccf4fbe 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 a320eb23ed0..c26b6b3dcb2 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 5ca6797e52a..10c5565cc43 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 42b36f7d63d..7029d471638 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 d9d5d85617a..425238c2afc 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 1f1905542b2..c45260d0236 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 930a9c3c8bc..6d9f2d6a992 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 a65dcd89c57..53e88ddf86a 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 b5fbc8d8e89..1a12890b063 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 dd4a79cb91a..d0b3e3dfb60 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 c0e6138c29f..d217de94007 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 56bbab7deb3..42e846f22e2 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 808feeddc47..f88ccee8177 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 333f2a6fd78..14eb24bec81 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 df36f410977..2454963a970 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 738fea94ff0..39325f57720 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 c5be56e8508..7e5e54d391e 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 ea75d319838..a26bbb63e0d 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 0c0f5d89e3d..cef4bff96e1 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 47a0bb009c7..2c3b7d4dd2b 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 26c3153f069..b0a1fdc5008 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 22b207fce16..7f867fb8cff 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 8285723fba0..75fd075e910 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 af7010b6836..bdeaebb3084 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 2c681b763af..460707fc484 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 e018231f043..a652913f86e 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 a477a693286..d62184fc9c2 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 8bce8f722c0..cb36283da4f 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 8d057dc3df1..d958504a834 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 9af2af503fc..f9ed236ad4b 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 aaf8c7251f5..5ab4f4bc02c 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 89a253f2e0a..4c4f94334ba 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 0227dc5c335..0d3bf949423 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 3235ebea01a..18e0860c0f5 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 eece4473976..659c7f2c9d5 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 e4872edec51..256d4c8d141 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 621b4755b8b..dd5558cf000 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 be2ad23240c..9a4ee9778e9 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 b784a3ca54a..4771f6b50fa 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 34eb8ca549c..22d1598e0ec 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 04d163038e5..5f6b46719fe 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 acfd2b346c5..97eba8fcb39 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 35958fdea6a..eb568105aa5 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 2534687114e..5c5769ea796 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 c3ead43675b..14b2745caad 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 14965ef95b5..63aee8f4084 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 3fcd4925492..ad295e96845 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 f2252fb845f..70a0610ad7e 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 59d4179d312..ba32e79e9e5 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 528b7257f3b..b06df263207 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 d23e69a6c47..c6c04f6b29b 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 5a5e504edde..82e96a4a7cd 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 dffcff81b47..cafb6c5b46c 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1846,6 +1846,22 @@ cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <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 3829e6ae00a..1f9d2fa1734 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 vers_defns %type vers_tag %type 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 56ec39164b4..10339dd1779 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -316,6 +316,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "PROVIDE_HIDDEN" { RTOKEN(PROVIDE_HIDDEN); } "KEEP" { RTOKEN(KEEP); } "EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); } +"CONSTANT" { RTOKEN(CONSTANT);} "#".*\n? { ++ lineno; } "\n" { ++ lineno; RTOKEN(NEWLINE); } "*".* { /* Mri comment line */ } diff --git a/ld/ldmain.c b/ld/ldmain.c index db87a40b6aa..88811904aed 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 f2ea63079bb..405a18a01a2 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-05-30 H.J. Lu + + * 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 * 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 00000000000..77ba7611309 --- /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 00000000000..5b685b29a8b --- /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 00000000000..f7f2dbfc831 --- /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 00000000000..b64ee3a9d36 --- /dev/null +++ b/ld/testsuite/ld-elf/maxpage1.s @@ -0,0 +1,7 @@ + .text + .global _start +_start: + .long 0 + + .data + .long 0