Skip to content

Instantly share code, notes, and snippets.

@xiangzhai
Last active September 27, 2018 03:41
Show Gist options
  • Select an option

  • Save xiangzhai/8af6034c0a456b0f7727ddf96c6ff703 to your computer and use it in GitHub Desktop.

Select an option

Save xiangzhai/8af6034c0a456b0f7727ddf96c6ff703 to your computer and use it in GitHub Desktop.
Do not enable loongson3 fixes by default
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index a221800..9a173b9 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -940,14 +940,17 @@ static int mips_fix_rm7000;
static bfd_boolean mips_fix_cn63xxp1;
/* ...likewise -mfix-loongson3-llsc
- * Default is add sync before ll/lld
- * So make the default value as one.
+ * Add sync before ll/lld when...
*/
static bfd_boolean mips_fix_loongson3_llsc = TRUE;
+static bfd_boolean mips_force_enable_fix_loongson3_llsc = FALSE;
+static bfd_boolean mips_force_disable_fix_loongson3_llsc = FALSE;
/* ...likewise -mfix-loongson3-loads
*/
static bfd_boolean mips_fix_loongson3_loads = TRUE;
+static bfd_boolean mips_force_enable_fix_loongson3_loads = FALSE;
+static bfd_boolean mips_force_disable_fix_loongson3_loads = FALSE;
/* We don't relax branches by default, since this causes us to expand
`la .l2 - .l1' if there's a branch between .l1 and .l2, because we
@@ -4191,7 +4194,11 @@ md_assemble (char *str)
goto out;
}
- if (mips_fix_loongson3_llsc)
+ mips_fix_loongson3_llsc = mips_opts.arch == CPU_GS464 ||
+ mips_opts.arch == CPU_GS464E ||
+ mips_opts.arch == CPU_GS264E;
+ if ((mips_fix_loongson3_llsc || mips_force_enable_fix_loongson3_llsc) &&
+ !mips_force_disable_fix_loongson3_llsc)
{
static expressionS bak_imm_expr;
static expressionS bak_offset_expr;
@@ -6844,7 +6851,11 @@ nops_for_insn (int ignore, const struct mips_cl_insn *hist,
nops = tmp_nops;
}
- if (mips_fix_loongson3_loads && !mips_opts.micromips)
+ mips_fix_loongson3_loads = mips_opts.arch == CPU_GS464 ||
+ mips_opts.arch == CPU_GS464E ||
+ mips_opts.arch == CPU_GS264E;
+ if ((mips_fix_loongson3_loads || mips_force_enable_fix_loongson3_loads) &&
+ !mips_force_disable_fix_loongson3_loads && !mips_opts.micromips)
{
tmp_nops = nops_for_loongson3_loads (ignore, insn);
if (tmp_nops > nops)
@@ -14797,19 +14808,19 @@ md_parse_option (int c, const char *arg)
break;
case OPTION_FIX_LOONGSON3_LLSC:
- mips_fix_loongson3_llsc = TRUE;
+ mips_force_enable_fix_loongson3_llsc = TRUE;
break;
case OPTION_NO_FIX_LOONGSON3_LLSC:
- mips_fix_loongson3_llsc = FALSE;
+ mips_force_disable_fix_loongson3_llsc = TRUE;
break;
case OPTION_FIX_LOONGSON3_LOADS:
- mips_fix_loongson3_loads = 1;
+ mips_force_enable_fix_loongson3_loads = 1;
break;
case OPTION_NO_FIX_LOONGSON3_LOADS:
- mips_fix_loongson3_loads = 0;
+ mips_force_disable_fix_loongson3_loads = 1;
break;
case OPTION_FIX_LOONGSON2F_JUMP:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment