]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR ld/10569
authorAlan Modra <amodra@gmail.com>
Sun, 30 Aug 2009 05:47:43 +0000 (05:47 +0000)
committerAlan Modra <amodra@gmail.com>
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 09414fc27ae4cedc7ddb0322f192046f42e4001c..034fe522b0d2ae1a9664b5b02371918b0998f912 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 534a69c2c24e1686ea980fad06f8ba22544c27dc..9c89bba27aaf9645a6e2ca6f0f5177e83090f13b 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 3436c6100c6007498327ec70d994b7048fc8f7e3..b29703627f51b22bdad5fbf21d9498d060db76d5 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 99bf08f3c49f568ea759d5d08aa0805829659455..7133f37df3e9fe51f0c553cf1d457a330b1ff7b2 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 5b6d653d64ae9b5ea58e886e6971b0138fbc6a97..ca18af966ed4d8edfdb3ea1dd03c92947aad4605 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 4629883bcc4bec88422000d8445a1cb2014fc7fd..a4c3e219379f4f1859caf5f1d6ffb67cf49db881 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 3b8fed63116774edec688d0b582b6278f7bf6ac5..a7636dbcf2157327e307d96bd0205c0e91f076df 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;