aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxuchenghua <xuchenghua@loongson.cn>2015-10-20 03:21:24 (GMT)
committerxuchenghua <xuchenghua@loongson.cn>2015-10-20 03:27:59 (GMT)
commit6305c1a63ea663d2016d0872c66ec5ed5e7aa559 (patch)
tree22d9835bfed0f7d09b2f2f620038d9ed4a90a1ee
parentaef05b378305cd0d007a7f3762fea9955bb16893 (diff)
downloadbinutils-2.24-6305c1a63ea663d2016d0872c66ec5ed5e7aa559.zip
binutils-2.24-6305c1a63ea663d2016d0872c66ec5ed5e7aa559.tar.gz
binutils-2.24-6305c1a63ea663d2016d0872c66ec5ed5e7aa559.tar.bz2
binutils-2.24: Added -mfix-ls3a-llsc and -mnofix-ls3a-llsc optionrefs/changes/50/3150/1
Change md_assemble() to insert sync before "ll" or "lld" instruction. These options is used to control whether insert "sync" instruction before "ll" or "lld" instrction. By default, we insert "sync" before "ll/lld" if we don't use those options. Test: Command:$ cat Test.s ll $t0, 16($sp) Command:$ as -mfix-loongson3-llsc Test.s -o a.out [Or Command:$ as Test.s -o a.out ] Command:$ objdump -d a.out > Test_obj.s Command:$ cat Test_obj.s 00000000 <.text>: 0: 0000000f sync 4: c3a80010 ll t0,16(sp) This commit same as binutils-2.24-23.fc21.loongson.2.src.rpm The patch in src rpm ware patch32. Change-Id: I6f2701472afb1a6936b8f302887cc78ff01c7791
-rw-r--r--gas/config/tc-mips.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index fac244d..928f5b4 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -868,6 +868,12 @@ static int mips_fix_24k;
/* ...likewise -mfix-cn63xxp1 */
static bfd_boolean mips_fix_cn63xxp1;
+/* ...likewise -mfix-loongson3-llsc
+ * Default is add sync before ll/lld
+ * So make the default value as one.
+ */
+static bfd_boolean mips_fix_loongson3_llsc = TRUE;
+
/* 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
fail to compute the offset before expanding the macro to the most
@@ -1352,6 +1358,8 @@ enum options
OPTION_MNO_7000_HILO_FIX,
OPTION_FIX_24K,
OPTION_NO_FIX_24K,
+ OPTION_FIX_LOONGSON3_LLSC,
+ OPTION_NO_FIX_LOONGSON3_LLSC,
OPTION_FIX_LOONGSON2F_JUMP,
OPTION_NO_FIX_LOONGSON2F_JUMP,
OPTION_FIX_LOONGSON2F_NOP,
@@ -1465,6 +1473,8 @@ struct option md_longopts[] =
{"mno-fix-vr4130", no_argument, NULL, OPTION_NO_FIX_VR4130},
{"mfix-24k", no_argument, NULL, OPTION_FIX_24K},
{"mno-fix-24k", no_argument, NULL, OPTION_NO_FIX_24K},
+ {"mfix-loongson3-llsc", no_argument, NULL, OPTION_FIX_LOONGSON3_LLSC},
+ {"mno-fix-loongson3-llsc", no_argument, NULL, OPTION_NO_FIX_LOONGSON3_LLSC},
{"mfix-cn63xxp1", no_argument, NULL, OPTION_FIX_CN63XXP1},
{"mno-fix-cn63xxp1", no_argument, NULL, OPTION_NO_FIX_CN63XXP1},
@@ -3601,9 +3611,40 @@ md_assemble (char *str)
str, insn.insn_opcode));
}
- if (insn_error.msg)
+ if (insn_error.msg) {
report_insn_error (str);
- else if (insn.insn_mo->pinfo == INSN_MACRO)
+ goto out;
+ }
+
+ if (mips_fix_loongson3_llsc == FALSE)
+ {} /*Nothing to Do!*/
+ else
+ {
+ static expressionS bak_imm_expr;
+ static expressionS bak_offset_expr;
+ static bfd_reloc_code_real_type bak_offset_reloc[3] ;
+
+ if ((strcmp (insn.insn_mo->name, "ll") == 0)
+ ||(strcmp (insn.insn_mo->name, "lld") == 0)) {
+ bak_imm_expr = imm_expr;
+ bak_offset_expr = offset_expr;
+
+ bak_offset_reloc[0] = offset_reloc[0];
+ bak_offset_reloc[1] = offset_reloc[1];
+ bak_offset_reloc[2] = offset_reloc[2];
+
+ md_assemble("sync");
+
+ imm_expr = bak_imm_expr;
+ offset_expr = bak_offset_expr;
+
+ offset_reloc[0] = bak_offset_reloc[0];
+ offset_reloc[1] = bak_offset_reloc[1];
+ offset_reloc[2] = bak_offset_reloc[2];
+ }
+ }
+
+ if (insn.insn_mo->pinfo == INSN_MACRO)
{
macro_start ();
if (mips_opts.mips16)
@@ -3620,6 +3661,7 @@ md_assemble (char *str)
append_insn (&insn, NULL, unused_reloc, FALSE);
}
+out:
mips_assembling_insn = FALSE;
}
@@ -13511,6 +13553,14 @@ md_parse_option (int c, char *arg)
mips_fix_24k = 0;
break;
+ case OPTION_FIX_LOONGSON3_LLSC:
+ mips_fix_loongson3_llsc = TRUE;
+ break;
+
+ case OPTION_NO_FIX_LOONGSON3_LLSC:
+ mips_fix_loongson3_llsc = FALSE;
+ break;
+
case OPTION_FIX_LOONGSON2F_JUMP:
mips_fix_loongson2f_jump = TRUE;
break;