Fix riscv malloc error on small alignment after norvc.
gas/ * config/tc-riscv.c (riscv_frag_align_code): New local insn_alignment. Early return if bytes less than or equal to insn_alignment. * testsuite/gas/riscv/align-1.l: New. * testsuite/gas/riscv/align-1.s: New. * testsuite/gas/riscv/riscv.exp: Use run_dump_tests. Use run_list_test for align-1.
This commit is contained in:
parent
f923328821
commit
36877bfb88
|
@ -1,5 +1,12 @@
|
|||
2017-11-29 Jim Wilson <jimw@sifive.com>
|
||||
|
||||
* config/tc-riscv.c (riscv_frag_align_code): New local insn_alignment.
|
||||
Early return if bytes less than or equal to insn_alignment.
|
||||
* testsuite/gas/riscv/align-1.l: New.
|
||||
* testsuite/gas/riscv/align-1.s: New.
|
||||
* testsuite/gas/riscv/riscv.exp: Use run_dump_tests. Use run_list_test
|
||||
for align-1.
|
||||
|
||||
PR gas/22464
|
||||
* doc/c-i386.texi (-n): Clarify docs.
|
||||
|
||||
|
|
|
@ -2319,10 +2319,18 @@ bfd_boolean
|
|||
riscv_frag_align_code (int n)
|
||||
{
|
||||
bfd_vma bytes = (bfd_vma) 1 << n;
|
||||
bfd_vma worst_case_bytes = bytes - (riscv_opts.rvc ? 2 : 4);
|
||||
char *nops = frag_more (worst_case_bytes);
|
||||
bfd_vma insn_alignment = riscv_opts.rvc ? 2 : 4;
|
||||
bfd_vma worst_case_bytes = bytes - insn_alignment;
|
||||
char *nops;
|
||||
expressionS ex;
|
||||
|
||||
/* If we are moving to a smaller alignment than the instruction size, then no
|
||||
alignment is required. */
|
||||
if (bytes <= insn_alignment)
|
||||
return TRUE;
|
||||
|
||||
nops = frag_more (worst_case_bytes);
|
||||
|
||||
/* When not relaxing, riscv_handle_align handles code alignment. */
|
||||
if (!riscv_opts.relax)
|
||||
return FALSE;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# No warning or error expected.
|
|
@ -0,0 +1,3 @@
|
|||
.option norvc
|
||||
.align 2
|
||||
.align 1
|
|
@ -19,13 +19,6 @@
|
|||
# MA 02110-1301, USA.
|
||||
|
||||
if [istarget riscv*-*-*] {
|
||||
run_dump_test "t_insns"
|
||||
run_dump_test "fmv.x"
|
||||
run_dump_test "c-lui-fail"
|
||||
run_dump_test "c-addi4spn-fail"
|
||||
run_dump_test "c-addi16sp-fail"
|
||||
run_dump_test "satp"
|
||||
run_dump_test "eh-relocs"
|
||||
run_dump_test "c-lw"
|
||||
run_dump_test "c-ld"
|
||||
run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
|
||||
run_list_test "align-1"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue