OSDN Git Service

PR ld/10569
authorAlan Modra <amodra@bigpond.net.au>
Sun, 30 Aug 2009 05:47:43 +0000 (05:47 +0000)
committerAlan Modra <amodra@bigpond.net.au>
Sun, 30 Aug 2009 05:47:43 +0000 (05:47 +0000)
* ldexp.c (fold_name <MAXPAGESIZE>): Return config.maxpagesize.
(fold_name <COMMONPAGESIZE>): 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
ld/emultempl/elf32.em
ld/ldemul.c
ld/ldexp.c
ld/ldlang.c
ld/ldlang.h
ld/ldmain.c

index 09414fc..034fe52 100644 (file)
@@ -1,3 +1,17 @@
+2009-08-30  Alan Modra  <amodra@bigpond.net.au>
+
+       PR ld/10569
+       * ldexp.c (fold_name <MAXPAGESIZE>): Return config.maxpagesize.
+       (fold_name <COMMONPAGESIZE>): 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  <martin@mtme.org>
 
        * ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
index 534a69c..9c89bba 100644 (file)
@@ -2178,8 +2178,6 @@ fragment <<EOF
          if (*end || (config.maxpagesize & (config.maxpagesize - 1)) != 0)
            einfo (_("%P%F: invalid maxium page size \`%s'\n"),
                   optarg + 14);
-         ASSERT (default_target != NULL);
-         bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
        }
       else if (CONST_STRNEQ (optarg, "common-page-size="))
        {
@@ -2189,9 +2187,6 @@ fragment <<EOF
              || (config.commonpagesize & (config.commonpagesize - 1)) != 0)
            einfo (_("%P%F: invalid common page size \`%s'\n"),
                   optarg + 17);
-         ASSERT (default_target != NULL);
-         bfd_emul_set_commonpagesize (default_target,
-                                      config.commonpagesize);
        }
       /* What about the other Solaris -z options? FIXME.  */
       break;
index 3436c61..b297036 100644 (file)
@@ -228,6 +228,9 @@ set_output_arch_default (void)
   /* Set the output architecture and machine if possible.  */
   bfd_set_arch_mach (link_info.output_bfd,
                     ldfile_output_architecture, ldfile_output_machine);
+
+  bfd_emul_set_maxpagesize (output_target, config.maxpagesize);
+  bfd_emul_set_commonpagesize (output_target, config.commonpagesize);
 }
 
 void
index 99bf08f..7133f37 100644 (file)
@@ -673,9 +673,9 @@ fold_name (etree_type *tree)
 
     case CONSTANT:
       if (strcmp (tree->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);
index 5b6d653..ca18af9 100644 (file)
@@ -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;
index 4629883..a4c3e21 100644 (file)
@@ -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;
index 3b8fed6..a7636db 100644 (file)
@@ -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;