aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorliuzhensong <liuzhensong@loongson.cn>2022-03-20 09:18:00 +0800
committerliuzhensong <liuzhensong@loongson.cn>2022-03-20 09:37:12 +0800
commit5fb13d7ef45088d8c2b89a3b4b22c36a0e3a5715 (patch)
tree8c3e44bf1f8f1d03b64c9b24ef488d369c2371f3 /gas/config
parent748594bc07f39fda35aba5f46d6e058b42c9c49d (diff)
downloadgdb-5fb13d7ef45088d8c2b89a3b4b22c36a0e3a5715.zip
gdb-5fb13d7ef45088d8c2b89a3b4b22c36a0e3a5715.tar.gz
gdb-5fb13d7ef45088d8c2b89a3b4b22c36a0e3a5715.tar.bz2
gas:LoongArch: Fix segment error in compilation due to too long symbol name.
Change "char buffer[8192];" into "char *buffer = (char *) malloc(1000 + 6 * len_str);" in function loongarch_expand_macro_with_format_map. gas/ * config/tc-loongarch.c include/ * opcode/loongarch.h opcodes/ * loongarch-coder.c
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-loongarch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index e1cce22..d7ab155 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -876,6 +876,7 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip)
bfd_reloc_code_real_type reloc_type;
struct reloc_info *reloc_info = ip->reloc_info;
size_t i;
+
for (i = 0; i < ip->reloc_num; i++)
{
reloc_type = reloc_info[i].type;
@@ -892,6 +893,7 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip)
as_fatal (_("Internal error: not support relax now"));
else
append_fixed_insn (ip);
+
dwarf2_emit_insn (0);
}
@@ -975,7 +977,8 @@ assember_macro_helper (const char *const args[], void *context_ptr)
}
while (0);
- ret = loongarch_expand_macro (insns_buf, arg_strs, NULL, NULL);
+ ret = loongarch_expand_macro (insns_buf, arg_strs, NULL, NULL,
+ sizeof (args_buf));
}
return ret;
}
@@ -987,6 +990,7 @@ static void
loongarch_assemble_INSNs (char *str)
{
char *rest;
+ size_t len_str = strlen(str);
for (rest = str; *rest != ';' && *rest != '\0'; rest++);
if (*rest == ';')
@@ -1032,7 +1036,7 @@ loongarch_assemble_INSNs (char *str)
char *c_str = loongarch_expand_macro (the_one.insn->macro,
the_one.arg_strs,
assember_macro_helper,
- &the_one);
+ &the_one, len_str);
loongarch_assemble_INSNs (c_str);
free (c_str);
}