aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-08-30 05:47:43 +0000
committerAlan Modra <amodra@gmail.com>2009-08-30 05:47:43 +0000
commit8be573a79b848e118bbe0247d706827f93252b43 (patch)
tree72e4a7cf537707c87ad6aafd8ce64b7352875df5
parent095106a28929849695bf377fdfffdd67015704b7 (diff)
downloadgdb-8be573a79b848e118bbe0247d706827f93252b43.zip
gdb-8be573a79b848e118bbe0247d706827f93252b43.tar.gz
gdb-8be573a79b848e118bbe0247d706827f93252b43.tar.bz2
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.
-rw-r--r--ld/ChangeLog14
-rw-r--r--ld/emultempl/elf32.em5
-rw-r--r--ld/ldemul.c3
-rw-r--r--ld/ldexp.c4
-rw-r--r--ld/ldlang.c4
-rw-r--r--ld/ldlang.h1
-rw-r--r--ld/ldmain.c2
7 files changed, 24 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 09414fc..034fe52 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -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)
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 534a69c..9c89bba 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -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;
diff --git a/ld/ldemul.c b/ld/ldemul.c
index 3436c61..b297036 100644
--- a/ld/ldemul.c
+++ b/ld/ldemul.c
@@ -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
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 99bf08f..7133f37 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -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);
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 5b6d653..ca18af9 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 4629883..a4c3e21 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 3b8fed6..a7636db 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;