#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. */
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;
\f
static struct hash_control *nds32_relax_info_hash;
static relax_info_t relax_table[] =
*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)
{"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}
};
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);
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;