summaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/mipself.em40
1 files changed, 40 insertions, 0 deletions
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index 9ac61a2a47..3c6ec9fdb9 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -33,6 +33,8 @@ fragment <<EOF
static lang_input_statement_type *stub_file;
static bfd *stub_bfd;
+static bfd_boolean insn32;
+
static void
mips_after_parse (void)
{
@@ -199,6 +201,12 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section,
static void
mips_create_output_section_statements (void)
{
+ struct elf_link_hash_table *htab;
+
+ htab = elf_hash_table (&link_info);
+ if (is_elf_hash_table (htab) && is_mips_elf (link_info.output_bfd))
+ _bfd_mips_elf_insn32 (&link_info, insn32);
+
if (is_mips_elf (link_info.output_bfd))
_bfd_mips_elf_init_stubs (&link_info, mips_add_stub_section);
}
@@ -241,6 +249,38 @@ mips_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
EOF
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+PARSE_AND_LIST_PROLOGUE='
+#define OPTION_INSN32 301
+#define OPTION_NO_INSN32 (OPTION_INSN32 + 1)
+'
+
+PARSE_AND_LIST_LONGOPTS='
+ { "insn32", no_argument, NULL, OPTION_INSN32 },
+ { "no-insn32", no_argument, NULL, OPTION_NO_INSN32 },
+'
+
+PARSE_AND_LIST_OPTIONS='
+ fprintf (file, _("\
+ --insn32 Only generate 32-bit microMIPS instructions\n"
+ ));
+ fprintf (file, _("\
+ --no-insn32 Generate all microMIPS instructions\n"
+ ));
+'
+
+PARSE_AND_LIST_ARGS_CASES='
+ case OPTION_INSN32:
+ insn32 = TRUE;
+ break;
+
+ case OPTION_NO_INSN32:
+ insn32 = FALSE;
+ break;
+'
+
LDEMUL_AFTER_PARSE=mips_after_parse
LDEMUL_BEFORE_ALLOCATION=mips_before_allocation
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=mips_create_output_section_statements