aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf32-nds32.h7
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-nds32.c53
4 files changed, 70 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 62b68dc..b00836c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-23 Kuan-Lin Chen <kuanlinchentw@gmail.com>
+
+ * elf32-nds32.h: Define mask for ict_model.
+
2018-02-20 Jason Duerstock <jason.duerstock@gmail.com>
* elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
diff --git a/bfd/elf32-nds32.h b/bfd/elf32-nds32.h
index 7e09e01..bf2e93f 100644
--- a/bfd/elf32-nds32.h
+++ b/bfd/elf32-nds32.h
@@ -46,6 +46,13 @@ extern "C" {
#define R_NDS32_RELAX_ENTRY_EX9_FLAG (1 << 2)
/* Enable IFC optimization for this section. */
#define R_NDS32_RELAX_ENTRY_IFC_FLAG (1 << 3)
+/* Two bits for ICT to comply with files without directive. */
+/* ICT small model. */
+#define R_NDS32_RELAX_ENTRY_ICT_SMALL (0x2 << 4)
+/* ICT large model. */
+#define R_NDS32_RELAX_ENTRY_ICT_LARGE (0x3 << 4)
+/* Mask for get ict bits. */
+#define R_NDS32_RELAX_ENTRY_ICT_MASK (0x3 << 4)
/* Relocation flags for R_NDS32_INSN16. */
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 20ea246..7415bdd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2018-02-23 Kuan-Lin Chen <kuanlinchentw@gmail.com>
+
+ * config/tc-nds32.c (ict_model): New function. Hook new
+ directive .ict_model.
+ (nds32_insert_relax_entry): Tag the bits of entry relocation
+ for .ict_model.
+
2018-02-22 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (_i386_insn): Add rex_encoding.
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index b2741b8..463fe23 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -102,6 +102,13 @@ static int in_omit_fp = 0;
extern struct nds32_keyword keyword_gpr[];
/* Tag there is relax relocation having to link. */
static bfd_boolean relaxing = FALSE;
+/* ICT model. */
+enum ict_option {
+ ICT_NONE = 0,
+ ICT_SMALL,
+ ICT_LARGE
+};
+static enum ict_option ict_flag = ICT_NONE;
static struct hash_control *nds32_relax_info_hash;
static relax_info_t relax_table[] =
@@ -3833,6 +3840,45 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED)
*input_line_pointer = saved_char;
ignore_rest_of_line ();
}
+static void
+ict_model (int ignore ATTRIBUTE_UNUSED)
+{
+ char *name;
+ char saved_char;
+ int i;
+ const char *possible_flags[] = { "small", "large" };
+
+ /* Skip whitespaces. */
+ name = input_line_pointer;
+ while (*input_line_pointer && !ISSPACE (*input_line_pointer))
+ input_line_pointer++;
+ saved_char = *input_line_pointer;
+ *input_line_pointer = 0;
+
+ for (i = 0; i < (int) ARRAY_SIZE (possible_flags); i++)
+ {
+ if (strcmp (name, possible_flags[i]) == 0)
+ {
+ switch (i)
+ {
+ case 0:
+ /* flag: verbatim */
+ ict_flag = ICT_SMALL;
+ break;
+ case 1:
+ ict_flag = ICT_LARGE;
+ break;
+ default:
+ break;
+ }
+ /* Already found the flag, no need to continue next loop. */
+ break;
+ }
+ }
+
+ *input_line_pointer = saved_char;
+ ignore_rest_of_line ();
+}
static void
nds32_n12hc (int ignore ATTRIBUTE_UNUSED)
@@ -3901,6 +3947,7 @@ const pseudo_typeS md_pseudo_table[] =
{"innermost_loop_begin", nds32_loop_begin, 1},
{"innermost_loop_end", nds32_loop_begin, 0},
{"relax_hint", nds32_relax_hint, 0},
+ {"ict_model", ict_model, 0},
{NULL, NULL, 0}
};
@@ -6209,7 +6256,7 @@ nds32_insert_relax_entry (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
for (fixp = seginfo->fix_root; fixp; fixp = fixp->fx_next)
if (!fixp->fx_done)
break;
- if (!fixp && !enable_relax_ex9 && !verbatim)
+ if (!fixp && !enable_relax_ex9 && !verbatim && ict_flag == ICT_NONE)
return;
subseg_change (sec, 0);
@@ -6232,6 +6279,10 @@ nds32_insert_relax_entry (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
exp.X_add_number |= R_NDS32_RELAX_ENTRY_IFC_FLAG;
if (verbatim)
exp.X_add_number |= R_NDS32_RELAX_ENTRY_VERBATIM_FLAG;
+ if (ict_flag == ICT_SMALL)
+ exp.X_add_number |= R_NDS32_RELAX_ENTRY_ICT_SMALL;
+ else if (ict_flag == ICT_LARGE)
+ exp.X_add_number |= R_NDS32_RELAX_ENTRY_ICT_LARGE;
}
if (optimize)
exp.X_add_number |= R_NDS32_RELAX_ENTRY_OPTIMIZE_FLAG;