aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2017-11-06 16:32:08 -0800
committerPalmer Dabbelt <palmer@sifive.com>2017-11-07 09:13:52 -0800
commitf77bb6c56b4091ed863d8cd03333a79a8d554ce1 (patch)
treea59c7bf45fb2474e0259e72928345bf9122904d5 /gas/testsuite
parent1270b047fdc68d89f05668ed919d17f5fceeba2a (diff)
downloadgdb-f77bb6c56b4091ed863d8cd03333a79a8d554ce1.zip
gdb-f77bb6c56b4091ed863d8cd03333a79a8d554ce1.tar.gz
gdb-f77bb6c56b4091ed863d8cd03333a79a8d554ce1.tar.bz2
RISC-V: Fix riscv g++ testsuite EH failures.
This fixes some EH failures for the medany code model in the g++ testsuite. The problem is that the assembler is computing some values in the eh_frame section as constants, that instead should have had relocs to be resolved by the linker. This happens in output_cfi_insn in the DW_CFA_advance_loc case where it compares label frags and immediately simplifies if they are the same. We can fix that by forcing a new frag after every instruction that the linker can reduce in size. I've also added a testcase to verify the fix. This was tested with binutils make check, and gcc/g++ make checks on qemu for medlow and medany code models. gas/ * config/tc-riscv.c (append_insn): Call frag_wane and frag_new at end for linker optimizable relocs. * testsuite/gas/riscv/eh-relocs.d: New. * testsuite/gas/riscv/eh-relocs.s: New. * testsuite/gas/riscv/riscv.exp: Run eh-relocs test.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/riscv/eh-relocs.d12
-rw-r--r--gas/testsuite/gas/riscv/eh-relocs.s11
-rw-r--r--gas/testsuite/gas/riscv/riscv.exp1
3 files changed, 24 insertions, 0 deletions
diff --git a/gas/testsuite/gas/riscv/eh-relocs.d b/gas/testsuite/gas/riscv/eh-relocs.d
new file mode 100644
index 0000000..94fa143
--- /dev/null
+++ b/gas/testsuite/gas/riscv/eh-relocs.d
@@ -0,0 +1,12 @@
+#as:
+#objdump: --section=.eh_frame -r
+
+.*:[ ]+file format .*
+
+RELOCATION RECORDS FOR .*
+.*
+0+1c R_RISCV_32_PCREL.*
+0+20 R_RISCV_ADD32.*
+0+20 R_RISCV_SUB32.*
+0+25 R_RISCV_SET6.*
+0+25 R_RISCV_SUB6.*
diff --git a/gas/testsuite/gas/riscv/eh-relocs.s b/gas/testsuite/gas/riscv/eh-relocs.s
new file mode 100644
index 0000000..4e96e7e
--- /dev/null
+++ b/gas/testsuite/gas/riscv/eh-relocs.s
@@ -0,0 +1,11 @@
+ .text
+ .align 2
+ .globl _func1
+ .type _func1, @function
+_func1:
+ .cfi_startproc
+ lla a1,_func2
+ add sp,sp,-16
+ .cfi_def_cfa_offset 16
+ .cfi_endproc
+ .size _func1, .-_func1
diff --git a/gas/testsuite/gas/riscv/riscv.exp b/gas/testsuite/gas/riscv/riscv.exp
index 2ab885a..8a128ac 100644
--- a/gas/testsuite/gas/riscv/riscv.exp
+++ b/gas/testsuite/gas/riscv/riscv.exp
@@ -25,4 +25,5 @@ if [istarget riscv*-*-*] {
run_dump_test "c-addi4spn-fail"
run_dump_test "c-addi16sp-fail"
run_dump_test "satp"
+ run_dump_test "eh-relocs"
}