From 8be573a79b848e118bbe0247d706827f93252b43 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 30 Aug 2009 05:47:43 +0000 Subject: [PATCH] PR ld/10569 * ldexp.c (fold_name ): Return config.maxpagesize. (fold_name ): Similarly. * ldlang.c (output_target): Make global. * ldlang.h (output_target): Declare. * ldmain.c (main): Set config.maxpagesize from bfd_emul_get_maxpagesize. Similarly for config.commonpagesize. * ldemul.c (set_output_arch_default): Call bfd_emul_set_maxpagesize and bfd_emul_set_commonpagesize. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Don't call bfd_emul_set_maxpagesize or bfd_emul_set_commonpagesize here. --- ld/ChangeLog | 14 ++++++++++++++ ld/emultempl/elf32.em | 5 ----- ld/ldemul.c | 3 +++ ld/ldexp.c | 4 ++-- ld/ldlang.c | 4 ++-- ld/ldlang.h | 1 + ld/ldmain.c | 2 ++ 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 09414fc27ae..034fe522b0d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,17 @@ +2009-08-30 Alan Modra + + PR ld/10569 + * ldexp.c (fold_name ): Return config.maxpagesize. + (fold_name ): Similarly. + * ldlang.c (output_target): Make global. + * ldlang.h (output_target): Declare. + * ldmain.c (main): Set config.maxpagesize from bfd_emul_get_maxpagesize. + Similarly for config.commonpagesize. + * ldemul.c (set_output_arch_default): Call bfd_emul_set_maxpagesize + and bfd_emul_set_commonpagesize. + * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Don't call + bfd_emul_set_maxpagesize or bfd_emul_set_commonpagesize here. + 2009-08-29 Martin Thuresson * ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop) diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 534a69c2c24..9c89bba27aa 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2178,8 +2178,6 @@ fragment <name.name, "MAXPAGESIZE") == 0) - new_abs (bfd_emul_get_maxpagesize (default_target)); + new_abs (config.maxpagesize); else if (strcmp (tree->name.name, "COMMONPAGESIZE") == 0) - new_abs (bfd_emul_get_commonpagesize (default_target)); + new_abs (config.commonpagesize); else einfo (_("%F%S: unknown constant `%s' referenced in expression\n"), tree->name.name); diff --git a/ld/ldlang.c b/ld/ldlang.c index 5b6d653d64a..ca18af966ed 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -52,6 +52,7 @@ static struct obstack map_obstack; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free static const char *startup_file; +static const char *entry_symbol_default = "start"; static bfd_boolean placed_commons = FALSE; static bfd_boolean stripped_excluded_sections = FALSE; static lang_output_section_statement_type *default_common_section; @@ -59,7 +60,6 @@ static bfd_boolean map_option_f; static bfd_vma print_dot; static lang_input_statement_type *first_file; static const char *current_target; -static const char *output_target; static lang_statement_list_type statement_list; static struct bfd_hash_table lang_definedness_table; static lang_statement_list_type *stat_save[10]; @@ -86,13 +86,13 @@ static void lang_finalize_version_expr_head (struct bfd_elf_version_expr_head *); /* Exported variables. */ +const char *output_target; lang_output_section_statement_type *abs_output_section; lang_statement_list_type lang_output_section_statement; lang_statement_list_type *stat_ptr = &statement_list; lang_statement_list_type file_chain = { NULL, NULL }; lang_statement_list_type input_file_chain; struct bfd_sym_chain entry_symbol = { NULL, NULL }; -static const char *entry_symbol_default = "start"; const char *entry_section = ".text"; bfd_boolean entry_from_cmdline; bfd_boolean lang_has_input_file = FALSE; diff --git a/ld/ldlang.h b/ld/ldlang.h index 4629883bcc4..a4c3e219379 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -445,6 +445,7 @@ struct orphan_save lang_output_section_statement_type **os_tail; }; +extern const char *output_target; extern lang_output_section_statement_type *abs_output_section; extern lang_statement_list_type lang_output_section_statement; extern bfd_boolean lang_has_input_file; diff --git a/ld/ldmain.c b/ld/ldmain.c index 3b8fed63116..a7636dbcf21 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -280,6 +280,8 @@ main (int argc, char **argv) emulation = get_emulation (argc, argv); ldemul_choose_mode (emulation); default_target = ldemul_choose_target (argc, argv); + config.maxpagesize = bfd_emul_get_maxpagesize (default_target); + config.commonpagesize = bfd_emul_get_commonpagesize (default_target); lang_init (); ldemul_before_parse (); lang_has_input_file = FALSE; -- 2.30.2