aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2011-05-09 13:17:58 +0000
committerPaul Brook <paul@codesourcery.com>2011-05-09 13:17:58 +0000
commit1bce6bd86f99b05ddc311eb34545165983ff8ddc (patch)
tree67998c9ac603266185a3b7c6898b0d3b8e607200 /gas/testsuite
parent9cf0e28212068b89d962e7c850f33b56a0f50a09 (diff)
downloadbinutils-1bce6bd86f99b05ddc311eb34545165983ff8ddc.zip
binutils-1bce6bd86f99b05ddc311eb34545165983ff8ddc.tar.gz
binutils-1bce6bd86f99b05ddc311eb34545165983ff8ddc.tar.bz2
2011-05-09 Paul Brook <paul@codesourcery.com>
bfd/ * elf32-tic6x.c (is_tic6x_elf_unwind_section_name, elf32_tic6x_fake_sections): New functions. (elf_backend_fake_sections): Define. gas/ * config/tc-tic6x.c (streq): Define. (tic6x_get_unwind): New. (s_tic6x_cantunwind, s_tic6x_handlerdata, s_tic6x_endp, s_tic6x_personalityindex, s_tic6x_personality): New functions. (md_pseudo_table): Add "endp", "handlerdata", "personalityindex", "personality" and "cantunwind". (tic6x_regname_to_dw2regnum, tic6x_frame_initial_instructions, tic6x_start_unwind_section, tic6x_unwind_frame_regs, tic6x_pop_rts_offset_little, tic6x_pop_rts_offset_big, tic6x_unwind_reg_from_dwarf, tic6x_flush_unwind_word, tic6x_unwind_byte, tic6x_unwind_2byte, tic6x_unwind_uleb, tic6x_cfi_startproc, output_exidx_entry, tic6x_output_unwinding, tic6x_cfi_endproc): New. * config/tc-tic6x.h (TIC6X_NUM_UNWIND_REGS): Define. (tic6x_unwind_info): New. (tic6x_segment_info_type): Add marked_pr_dependency, unwind and text_unwind. (TARGET_USE_CFIPOP, tc_regname_to_dw2regnum, tc_cfi_frame_initial_instructions, DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT, tc_cfi_startproc, tc_cfi_endproc, tc_cfi_section_name): Define. * doc/c-tic6x.texi: Document new unwinding directives. * dw2gencfi.c (tc_cfi_startproc, tc_cfi_endproc): Add default definitions. (cfi_insn_data, fde_entry, CFI_adjust_cfa_offset, CFI_return_column, CFI_rel_offset, CFI_escape, CFI_signal_frame, CFI_val_encoded_addr): Move to dw2gencfi.h. (CFI_EMIT_target): Define. (dot_cfi_sections): Check tc_cfi_section_name. (dot_cfi_startproc): Use tc_cfi_startproc. (dot_cfi_endproc): Use tc_cfi_endproc. * dw2gencfi.h (cfi_insn_data, fde_entry, CFI_adjust_cfa_offset, CFI_return_column, CFI_rel_offset, CFI_escape, CFI_signal_frame, CFI_val_encoded_addr): Move to here from dw2gencfi.c. gas/testsuite: * gas/tic6x/unwind-1.d: New test. * gas/tic6x/unwind-1.s: New test. * gas/tic6x/unwind-2.d: New test. * gas/tic6x/unwind-2.s: New test. * gas/tic6x/unwind-3.d: New test. * gas/tic6x/unwind-3.s: New test. * gas/tic6x/unwind-bad-1.d: New test. * gas/tic6x/unwind-bad-1.s: New test. * gas/tic6x/unwind-bad-1.l: New test. * gas/tic6x/unwind-bad-2.d: New test. * gas/tic6x/unwind-bad-2.s: New test. * gas/tic6x/unwind-bad-2.l: New test. include/ * elf/tic6x.h (ELF_STRING_C6000_unwind, ELF_STRING_C6000_unwind_info, ELF_STRING_C6000_unwind_once, ELF_STRING_C6000_unwind_info_once): Define.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog15
-rw-r--r--gas/testsuite/gas/tic6x/unwind-1.d100
-rw-r--r--gas/testsuite/gas/tic6x/unwind-1.s242
-rw-r--r--gas/testsuite/gas/tic6x/unwind-2.d100
-rw-r--r--gas/testsuite/gas/tic6x/unwind-2.s242
-rw-r--r--gas/testsuite/gas/tic6x/unwind-3.d18
-rw-r--r--gas/testsuite/gas/tic6x/unwind-3.s33
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-1.d3
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-1.l12
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-1.s62
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-2.d3
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-2.l14
-rw-r--r--gas/testsuite/gas/tic6x/unwind-bad-2.s113
13 files changed, 957 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 25618f8..d5790a1 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,18 @@
+2011-05-09 Paul Brook <paul@codesourcery.com>
+
+ * gas/tic6x/unwind-1.d: New test.
+ * gas/tic6x/unwind-1.s: New test.
+ * gas/tic6x/unwind-2.d: New test.
+ * gas/tic6x/unwind-2.s: New test.
+ * gas/tic6x/unwind-3.d: New test.
+ * gas/tic6x/unwind-3.s: New test.
+ * gas/tic6x/unwind-bad-1.d: New test.
+ * gas/tic6x/unwind-bad-1.s: New test.
+ * gas/tic6x/unwind-bad-1.l: New test.
+ * gas/tic6x/unwind-bad-2.d: New test.
+ * gas/tic6x/unwind-bad-2.s: New test.
+ * gas/tic6x/unwind-bad-2.l: New test.
+
2011-04-29 Hans-Peter Nilsson <hp@axis.com>
* gas/elf/dwarf2-1.d, gas/elf/dwarf2-2.d: Adjust for change in
diff --git a/gas/testsuite/gas/tic6x/unwind-1.d b/gas/testsuite/gas/tic6x/unwind-1.d
new file mode 100644
index 0000000..1b240f9
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-1.d
@@ -0,0 +1,100 @@
+#readelf: -u
+#name: C6X unwinding directives 1 (little endian)
+#as: -mlittle-endian
+#source: unwind-1.s
+
+Unwind table index '.c6xabi.exidx' .*
+
+0x0: 0x83020227
+ Compact model 3
+ Stack increment 8
+ Registers restored: A11, B3
+ Return register: B3
+
+0x100: 0x808003e7
+ Compact model 0
+ 0x80 0x03 pop {A10, A11}
+ 0xe7 RETURN
+
+0x200: 0x81008863
+ Compact model 1
+ 0x88 0x63 pop {A10, A11, B3, B10, B15}
+
+0x300: 0x83020227
+ Compact model 3
+ Stack increment 8
+ Registers restored: A11, B3
+ Return register: B3
+
+0x400: 0x84000227
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A11, B3
+ Return register: B3
+
+0x500: 0x80a022e7
+ Compact model 0
+ 0xa0 0x22 pop compact {A11, B3}
+ 0xe7 RETURN
+
+0x600: 0x84000227
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A11, B3
+ Return register: B3
+
+0x700: 0x84000637
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A10, A11, B3, B10
+ Return register: B3
+
+0x800: 0x840002d7
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A10, A12, A13, B3
+ Return register: B3
+
+0x900: 0x84000c07
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) B10, B11
+ Return register: B3
+
+0xa00: 0x83ff0027
+ Compact model 3
+ Restore stack from frame pointer
+ Registers restored: A11, A15
+ Return register: B3
+
+0xb00: 0x84ff0027
+ Compact model 4
+ Restore stack from frame pointer
+ Registers restored: \(compact\) A11, A15
+ Return register: B3
+
+0xc00: 0x8001c1f7
+ Compact model 0
+ 0x01 sp = sp \+ 16
+ 0xc1 0xf7 pop frame {B3, \[pad\]}
+
+0xd00: @0x.*
+ Compact model 1
+ 0x01 sp = sp \+ 16
+ 0xc2 0xf7 0xbf pop frame {\[pad\], A11, B3, \[pad\]}
+ 0xe7 RETURN
+ 0xe7 RETURN
+
+0xe00: @0x.*
+ Compact model 1
+ 0x01 sp = sp \+ 16
+ 0xc2 0xf7 0xfb pop frame {A11, \[pad\], B3, \[pad\]}
+ 0xe7 RETURN
+ 0xe7 RETURN
+
+0xf00: @0x.*
+ Compact model 1
+ 0x02 sp = sp \+ 24
+ 0xc2 0x7f 0xff 0xfb pop frame {A11, \[pad\], \[pad\], \[pad\], \[pad\], B3}
+ 0xe7 RETURN
+
diff --git a/gas/testsuite/gas/tic6x/unwind-1.s b/gas/testsuite/gas/tic6x/unwind-1.s
new file mode 100644
index 0000000..3fbc888
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-1.s
@@ -0,0 +1,242 @@
+.cfi_sections .c6xabi.exidx
+
+# standard layout
+.p2align 8
+f0:
+.cfi_startproc
+stw .d2t2 B3, *B15--(16)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.endp
+
+# standard layout (pr0)
+.p2align 8
+f1:
+.cfi_startproc
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *+B15(8)
+.cfi_offset 11, -0
+stw .d2t1 A10, *+B15(4)
+.cfi_offset 10, -4
+nop 4
+.cfi_endproc
+.personalityindex 0
+.endp
+
+# standard layout (pr1)
+.p2align 8
+f2:
+.cfi_startproc
+stw .d2t2 B15, *B15--(24)
+.cfi_def_cfa_offset 24
+.cfi_offset 31, 0
+stw .d2t2 B10, *+B15(20)
+.cfi_offset 26, -4
+stw .d2t2 B3, *+B15(16)
+.cfi_offset 19, -8
+stdw .d2t1 A11:A10, *+B15(8)
+.cfi_offset 11, -12
+.cfi_offset 10, -16
+nop 4
+.cfi_endproc
+.personalityindex 1
+.endp
+
+# standard layout (pr3)
+.p2align 8
+f3:
+.cfi_startproc
+stw .d2t2 B3, *B15--(16)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.personalityindex 3
+.endp
+
+# compact layout
+.p2align 8
+f4:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (pr0)
+.p2align 8
+f5:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.personalityindex 0
+.endp
+
+# compact layout (pr4)
+.p2align 8
+f6:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.personalityindex 4
+.endp
+
+# compact layout (aligned pair)
+.p2align 8
+f7:
+.cfi_startproc
+stw .d2t2 B10, *B15--(8)
+.cfi_offset 26, 0
+.cfi_def_cfa_offset 8
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, -8
+.cfi_def_cfa_offset 8
+stdw .d2t1 A11:A10, *B15--(8)
+.cfi_offset 11, -12
+.cfi_offset 10, -16
+.cfi_def_cfa_offset 24
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (aligned pair + 1)
+.p2align 8
+f8:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stdw .d2t1 A13:A12, *B15--(8)
+.cfi_offset 13, -4
+.cfi_offset 12, -8
+.cfi_def_cfa_offset 16
+stw .d2t1 A10, *B15--(8)
+.cfi_offset 10, -16
+.cfi_def_cfa_offset 24
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (misaligned pair)
+.p2align 8
+f9:
+.cfi_startproc
+stw .d2t2 B11, *B15--(8)
+.cfi_offset 27, 0
+.cfi_def_cfa_offset 8
+stw .d2t2 B10, *B15--(8)
+.cfi_offset 26, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.endp
+
+# standard frame pointer
+.p2align 8
+fa:
+.cfi_startproc
+stw .d2t1 A15, *B15--(16)
+.cfi_def_cfa_offset 8
+.cfi_offset 15, 0
+mv .s1x B15, A15
+addk .s1 16, A15
+.cfi_def_cfa 15, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.endp
+
+# compact frame pointer
+.p2align 8
+fb:
+.cfi_startproc
+stw .d2t1 A15, *B15--(8)
+.cfi_def_cfa_offset 8
+.cfi_offset 15, 0
+mv .s1x B15, A15
+addk .s1 16, A15
+.cfi_def_cfa 15, 0
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fc:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fd:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+stw .d2t1 A11, *+B15(8)
+.cfi_offset 11, -8
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fe:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+stw .d2t1 A11, *+B15(4)
+.cfi_offset 11, -12
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+ff:
+.cfi_startproc
+addk .s2 -24, B15
+stw .d2t2 B3, *+B15(24)
+.cfi_def_cfa_offset 24
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(4)
+.cfi_offset 11, -20
+nop 4
+.cfi_endproc
+.endp
+
diff --git a/gas/testsuite/gas/tic6x/unwind-2.d b/gas/testsuite/gas/tic6x/unwind-2.d
new file mode 100644
index 0000000..c022ec4
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-2.d
@@ -0,0 +1,100 @@
+#readelf: -u
+#name: C6X unwinding directives 2 (big endian)
+#as: -mbig-endian
+#source: unwind-2.s
+
+Unwind table index '.c6xabi.exidx' .*
+
+0x0: 0x83020227
+ Compact model 3
+ Stack increment 8
+ Registers restored: A11, B3
+ Return register: B3
+
+0x100: 0x808003e7
+ Compact model 0
+ 0x80 0x03 pop {A10, A11}
+ 0xe7 RETURN
+
+0x200: 0x81008863
+ Compact model 1
+ 0x88 0x63 pop {A10, A11, B3, B10, B15}
+
+0x300: 0x83020227
+ Compact model 3
+ Stack increment 8
+ Registers restored: A11, B3
+ Return register: B3
+
+0x400: 0x84000227
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A11, B3
+ Return register: B3
+
+0x500: 0x80a022e7
+ Compact model 0
+ 0xa0 0x22 pop compact {A11, B3}
+ 0xe7 RETURN
+
+0x600: 0x84000227
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A11, B3
+ Return register: B3
+
+0x700: 0x84000637
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A10, A11, B3, B10
+ Return register: B3
+
+0x800: 0x840002d7
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) A10, A12, A13, B3
+ Return register: B3
+
+0x900: 0x84000c07
+ Compact model 4
+ Stack increment 0
+ Registers restored: \(compact\) B10, B11
+ Return register: B3
+
+0xa00: 0x83ff0027
+ Compact model 3
+ Restore stack from frame pointer
+ Registers restored: A11, A15
+ Return register: B3
+
+0xb00: 0x84ff0027
+ Compact model 4
+ Restore stack from frame pointer
+ Registers restored: \(compact\) A11, A15
+ Return register: B3
+
+0xc00: 0x8001c1f7
+ Compact model 0
+ 0x01 sp = sp \+ 16
+ 0xc1 0xf7 pop frame {B3, \[pad\]}
+
+0xd00: @0x.*
+ Compact model 1
+ 0x01 sp = sp \+ 16
+ 0xc2 0xf7 0xbf pop frame {\[pad\], A11, B3, \[pad\]}
+ 0xe7 RETURN
+ 0xe7 RETURN
+
+0xe00: @0x.*
+ Compact model 1
+ 0x01 sp = sp \+ 16
+ 0xc2 0xf7 0xfb pop frame {A11, \[pad\], B3, \[pad\]}
+ 0xe7 RETURN
+ 0xe7 RETURN
+
+0xf00: @0x.*
+ Compact model 1
+ 0x02 sp = sp \+ 24
+ 0xc2 0x7f 0xff 0xfb pop frame {A11, \[pad\], \[pad\], \[pad\], \[pad\], B3}
+ 0xe7 RETURN
+
diff --git a/gas/testsuite/gas/tic6x/unwind-2.s b/gas/testsuite/gas/tic6x/unwind-2.s
new file mode 100644
index 0000000..1ab4d67
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-2.s
@@ -0,0 +1,242 @@
+.cfi_sections .c6xabi.exidx
+
+# standard layout
+.p2align 8
+f0:
+.cfi_startproc
+stw .d2t2 B3, *B15--(16)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.endp
+
+# standard layout (pr0)
+.p2align 8
+f1:
+.cfi_startproc
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *+B15(8)
+.cfi_offset 11, -0
+stw .d2t1 A10, *+B15(4)
+.cfi_offset 10, -4
+nop 4
+.cfi_endproc
+.personalityindex 0
+.endp
+
+# standard layout (pr1)
+.p2align 8
+f2:
+.cfi_startproc
+stw .d2t2 B15, *B15--(24)
+.cfi_def_cfa_offset 24
+.cfi_offset 31, 0
+stw .d2t2 B10, *+B15(20)
+.cfi_offset 26, -4
+stw .d2t2 B3, *+B15(16)
+.cfi_offset 19, -8
+stdw .d2t1 A11:A10, *+B15(8)
+.cfi_offset 11, -16
+.cfi_offset 10, -12
+nop 4
+.cfi_endproc
+.personalityindex 1
+.endp
+
+# standard layout (pr3)
+.p2align 8
+f3:
+.cfi_startproc
+stw .d2t2 B3, *B15--(16)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.personalityindex 3
+.endp
+
+# compact layout
+.p2align 8
+f4:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (pr0)
+.p2align 8
+f5:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.personalityindex 0
+.endp
+
+# compact layout (pr4)
+.p2align 8
+f6:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.personalityindex 4
+.endp
+
+# compact layout (aligned pair)
+.p2align 8
+f7:
+.cfi_startproc
+stw .d2t2 B10, *B15--(8)
+.cfi_offset 26, 0
+.cfi_def_cfa_offset 8
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, -8
+.cfi_def_cfa_offset 8
+stdw .d2t1 A11:A10, *B15--(8)
+.cfi_offset 11, -16
+.cfi_offset 10, -12
+.cfi_def_cfa_offset 24
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (aligned pair + 1)
+.p2align 8
+f8:
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stdw .d2t1 A13:A12, *B15--(8)
+.cfi_offset 13, -8
+.cfi_offset 12, -4
+.cfi_def_cfa_offset 16
+stw .d2t1 A10, *B15--(8)
+.cfi_offset 10, -16
+.cfi_def_cfa_offset 24
+nop 4
+.cfi_endproc
+.endp
+
+# compact layout (misaligned pair)
+.p2align 8
+f9:
+.cfi_startproc
+stw .d2t2 B11, *B15--(8)
+.cfi_offset 27, 0
+.cfi_def_cfa_offset 8
+stw .d2t2 B10, *B15--(8)
+.cfi_offset 26, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+.endp
+
+# standard frame pointer
+.p2align 8
+fa:
+.cfi_startproc
+stw .d2t1 A15, *B15--(16)
+.cfi_def_cfa_offset 8
+.cfi_offset 15, 0
+mv .s1x B15, A15
+addk .s1 16, A15
+.cfi_def_cfa 15, 0
+stw .d2t1 A11, *+B15(12)
+.cfi_offset 11, -4
+nop 4
+.cfi_endproc
+.endp
+
+# compact frame pointer
+.p2align 8
+fb:
+.cfi_startproc
+stw .d2t1 A15, *B15--(8)
+.cfi_def_cfa_offset 8
+.cfi_offset 15, 0
+mv .s1x B15, A15
+addk .s1 16, A15
+.cfi_def_cfa 15, 0
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fc:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fd:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+stw .d2t1 A11, *+B15(8)
+.cfi_offset 11, -8
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+fe:
+.cfi_startproc
+sub .s2 B15, 16, B15
+stw .d2t2 B3, *+B15(12)
+.cfi_def_cfa_offset 16
+.cfi_offset 19, -4
+stw .d2t1 A11, *+B15(4)
+.cfi_offset 11, -12
+nop 4
+.cfi_endproc
+.endp
+
+# custom layout
+.p2align 8
+ff:
+.cfi_startproc
+addk .s2 -24, B15
+stw .d2t2 B3, *+B15(24)
+.cfi_def_cfa_offset 24
+.cfi_offset 19, 0
+stw .d2t1 A11, *+B15(4)
+.cfi_offset 11, -20
+nop 4
+.cfi_endproc
+.endp
+
diff --git a/gas/testsuite/gas/tic6x/unwind-3.d b/gas/testsuite/gas/tic6x/unwind-3.d
new file mode 100644
index 0000000..d03243d
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-3.d
@@ -0,0 +1,18 @@
+#readelf: -u
+#name: C6X unwinding directives 3 (segment change)
+#source: unwind-3.s
+
+Unwind table index '.c6xabi.exidx.text.bar' .*
+
+0x0: 0x830e2807
+ Compact model 3
+ Stack increment 56
+ Registers restored: B11, B13
+ Return register: B3
+
+Unwind table index '.c6xabi.exidx' .*
+
+0x0: 0x80008021
+ Compact model 0
+ 0x00 sp = sp \+ 8
+ 0x80 0x21 pop {A10, B3}
diff --git a/gas/testsuite/gas/tic6x/unwind-3.s b/gas/testsuite/gas/tic6x/unwind-3.s
new file mode 100644
index 0000000..0239e23
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-3.s
@@ -0,0 +1,33 @@
+.cfi_sections .c6xabi.exidx
+
+.text
+# standard layout
+.p2align 8
+foo:
+.cfi_startproc
+.personalityindex 0
+stw .d2t2 B3, *B15--(16)
+.cfi_def_cfa_offset 16
+.cfi_offset B3, 0
+
+
+.section .text.bar, "ax"
+
+bar:
+.cfi_startproc
+stw .d2t2 B13, *B15--(16)
+.cfi_def_cfa_offset 64
+.cfi_offset B13, 0
+stw .d2t2 B13, *+B15(12)
+.cfi_offset B11, -4
+nop 4
+.cfi_endproc
+.endp
+
+.text
+
+stw .d2t1 A10, *+B15(12)
+.cfi_offset A10, -4
+nop 4
+.cfi_endproc
+.endp
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-1.d b/gas/testsuite/gas/tic6x/unwind-bad-1.d
new file mode 100644
index 0000000..077062d
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-1.d
@@ -0,0 +1,3 @@
+#name: C6X unwinding directive errors
+#error-output: unwind-bad-1.l
+
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-1.l b/gas/testsuite/gas/tic6x/unwind-bad-1.l
new file mode 100644
index 0000000..523dac1
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-1.l
@@ -0,0 +1,12 @@
+[^:]*: Assembler messages:
+[^:]*:4: Error: unexpected \.handlerdata directive
+[^:]*:9: Error: duplicate \.personalityindex directive
+[^:]*:11: Error: personality routine specified for cantunwind frame
+[^:]*:19: Error: personality routine specified for cantunwind frame
+[^:]*:29: Error: duplicate \.personality directive
+[^:]*:32: Error: unexpected \.cantunwind directive
+[^:]*:34: Error: duplicate \.handlerdata directive
+[^:]*:41: Error: personality routine required before \.handlerdata directive
+[^:]*:48: Error: bad personality routine number
+[^:]*:50: Error: bad personality routine number
+[^:]*:59: Error: missing \.endp before \.cfi_startproc
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-1.s b/gas/testsuite/gas/tic6x/unwind-bad-1.s
new file mode 100644
index 0000000..b68df50
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-1.s
@@ -0,0 +1,62 @@
+.cfi_sections .c6xabi.exidx
+
+# unexpected .handlerdata directive
+.handlerdata
+
+.cfi_startproc
+.personalityindex 0
+# duplicate .personalityindex directive
+.personalityindex 1
+# personality routine specified for cantunwind frame
+.cantunwind
+nop
+.cfi_endproc
+.endp
+
+.cfi_startproc
+.personality foo
+# personality routine specified for cantunwind frame
+.cantunwind
+nop
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+.cfi_endproc
+.personality foo
+# duplicate .personality directive
+.personality bar
+.handlerdata
+# unexpected .cantunwind directive
+.cantunwind
+# duplicate .handlerdata directive
+.handlerdata
+.endp
+
+.cfi_startproc
+nop
+.cfi_endproc
+# personality routine required before .handlerdata directive
+.handlerdata
+.endp
+
+.cfi_startproc
+nop
+.cfi_endproc
+# bad personality routine number
+.personalityindex 16
+# bad personality routine number
+.personalityindex -1
+.endp
+
+.cfi_startproc
+nop
+.cfi_endproc
+.personalityindex 1
+.handlerdata
+# missing .endp before .cfi_startproc
+.cfi_startproc
+.cfi_endproc
+.endp
+
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-2.d b/gas/testsuite/gas/tic6x/unwind-bad-2.d
new file mode 100644
index 0000000..5f8899e
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-2.d
@@ -0,0 +1,3 @@
+#name: C6X unwinding bad frame layouts
+#error-output: unwind-bad-2.l
+
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-2.l b/gas/testsuite/gas/tic6x/unwind-bad-2.l
new file mode 100644
index 0000000..bf171dc
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-2.l
@@ -0,0 +1,14 @@
+[^:]*: Assembler messages:
+[^:]*:8: Error: stack pointer offset too large for personality routine
+[^:]*:20: Error: stack frame layout does not match personality routine
+[^:]*:33: Error: stack frame layout does not match personality routine
+[^:]*:39: Error: unable to generate unwinding opcode for reg 20
+[^:]*:46: Error: unable to generate unwinding opcode for reg 20
+[^:]*:53: Error: unable to generate unwinding opcode for reg 20
+[^:]*:63: Error: unable to restore return address from previously restored reg
+[^:]*:70: Error: unhandled CFA insn for unwinding \(259\)
+[^:]*:77: Error: unable to generate unwinding opcode for frame pointer reg 14
+[^:]*:84: Error: unable to generate unwinding opcode for frame pointer offset
+[^:]*:91: Error: unwound stack pointer not doubleword aligned
+[^:]*:100: Error: stack frame layout too complex for unwinder
+[^:]*:110: Error: unwound frame has negative size
diff --git a/gas/testsuite/gas/tic6x/unwind-bad-2.s b/gas/testsuite/gas/tic6x/unwind-bad-2.s
new file mode 100644
index 0000000..9373bbd
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/unwind-bad-2.s
@@ -0,0 +1,113 @@
+.cfi_sections .c6xabi.exidx
+
+.cfi_startproc
+# stack pointer offset too large for personality routine
+.cfi_def_cfa_offset 0x3f8
+.cfi_endproc
+.personalityindex 3
+.endp
+
+.cfi_startproc
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *+B15(8)
+.cfi_offset 11, -0
+stw .d2t1 A10, *+B15(4)
+.cfi_offset 10, -4
+nop 4
+.cfi_endproc
+# stack frame layout does not match personality routine
+.personalityindex 4
+.endp
+
+.cfi_startproc
+stw .d2t2 B3, *B15--(8)
+.cfi_offset 19, 0
+.cfi_def_cfa_offset 8
+stw .d2t1 A11, *B15--(8)
+.cfi_offset 11, -8
+.cfi_def_cfa_offset 16
+nop 4
+.cfi_endproc
+# stack frame layout does not match personality routine
+.personalityindex 3
+.endp
+
+.cfi_startproc
+stw .d2t2 B4, *B15--(8)
+# unable to generate unwinding opcode for reg 20
+.cfi_offset 20, 0
+.cfi_endproc
+.endp
+
+.cfi_startproc
+mv .s2 B3, B4
+# unable to generate unwinding opcode for reg 20
+.cfi_register 19, 20
+.cfi_endproc
+.endp
+
+.cfi_startproc
+mv .s2 B4, B3
+# unable to generate unwinding opcode for reg 20
+.cfi_register 20, 19
+.cfi_endproc
+.endp
+
+.cfi_startproc
+stw .d2t2 B10, *B15--(8)
+# unable to generate unwinding opcode for reg 20
+.cfi_offset 26, 0
+mv .s2 B3, B10
+# unable to restore return address from previously restored reg
+.cfi_register 19, 26
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+# unhandled CFA insn for unwinding (259)
+.cfi_escape 42
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+# unable to generate unwinding opcode for frame pointer reg 14
+.cfi_def_cfa_register 14
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+# unable to generate unwinding opcode for frame pointer offset
+.cfi_def_cfa 15, 8
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+# unwound stack pointer not doubleword aligned
+.cfi_def_cfa_offset 12
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+.cfi_offset 10, 0
+# stack frame layout too complex for unwinder
+.cfi_offset 11, -0x808
+.cfi_def_cfa_offset 0x10000
+.cfi_endproc
+.endp
+
+.cfi_startproc
+nop
+.cfi_offset 12, -0
+.cfi_offset 11, -4
+.cfi_offset 10, -8
+.cfi_def_cfa_offset 8
+# unwound frame has negative size
+.cfi_endproc
+.endp
+
+