aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2015-01-12 15:24:20 +0100
committerJan Beulich <jbeulich@suse.com>2015-01-12 15:24:20 +0100
commit696025802ec3273fde5cbf82c215a3d795435c1a (patch)
treea48fff046770366376dad6bcf409bc651277b2da /gas/testsuite
parent3c758495736df25d141a4ea13c7aba24f5bb9753 (diff)
downloadgdb-696025802ec3273fde5cbf82c215a3d795435c1a.zip
gdb-696025802ec3273fde5cbf82c215a3d795435c1a.tar.gz
gdb-696025802ec3273fde5cbf82c215a3d795435c1a.tar.bz2
gas: allow labeling of CFI instructions
When runtime patching code (like e.g. done by the Linux kernel) there may be cases where the set of stack frame alterations differs between unpatched and patched code. Consequently the corresponding unwind data needs patching too. Locating the right places within an FDE, however, is rather cumbersome without a way to insert labels in the resulting section. Hence this patch introduces a new directive, .cfi_label. Note that with the way CFI data gets emitted currently (at the end of the assembly process) this can't support local FB- and dollar-labels. gas/ 2015-01-12 Jan Beulich <jbeulich@suse.com> * gas/dw2gencfi.c (cfi_add_label, dot_cfi_label): New. (cfi_pseudo_table): Add "cfi_label". (output_cfi_insn): Handle CFI_label. (select_cie_for_fde): Als terminate CIE when encountering CFI_label. * dw2gencfi.h (cfi_add_label): Declare. (struct cfi_insn_data): New member "sym_name". (CFI_label): New. * read.c (read_symbol_name): Drop "static". * read.h (read_symbol_name): Declare. gas/testsuite/ 2015-01-12 Jan Beulich <jbeulich@suse.com> gas/cfi/cfi-label.d, gas/cfi/cfi-label.s: New. gas/cfi/cfi.exp: Run new tests.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/cfi/cfi-label.d43
-rw-r--r--gas/testsuite/gas/cfi/cfi-label.s19
-rw-r--r--gas/testsuite/gas/cfi/cfi.exp4
4 files changed, 71 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index ef359a1..54d9c6e 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2015-01-12 Jan Beulich <jbeulich@suse.com>
+ gas/cfi/cfi-label.d, gas/cfi/cfi-label.s: New.
+ gas/cfi/cfi.exp: Run new tests.
+
+2015-01-12 Jan Beulich <jbeulich@suse.com>
+
* gas/arm/neon-addressing-bad.s: Add test for invalid VSHL,
VQSHL, and VQSHLU immediates.
* gas/arm/neon-addressing-bad.l: Update accordingly.
diff --git a/gas/testsuite/gas/cfi/cfi-label.d b/gas/testsuite/gas/cfi/cfi-label.d
new file mode 100644
index 0000000..e96c795
--- /dev/null
+++ b/gas/testsuite/gas/cfi/cfi-label.d
@@ -0,0 +1,43 @@
+#objdump: -tWf
+#name: .cfi_label directive
+
+.*\.o: file format elf.*
+
+SYMBOL TABLE:
+0*00 l d \.text 0*00 \.text
+0*00 l d \.data 0*00 \.data
+0*00 l d \.bss 0*00 \.bss
+0*00 l F \.text 0*04 cfilabel
+0*2f l \.eh_frame 0*00 cfi2
+0*00 l d \.eh_frame 0*00 \.eh_frame
+0*2b g \.eh_frame 0*00 cfi1
+
+
+Contents of the .eh_frame section:
+
+0*00 0*14 0*00 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -[48]
+ Return address column: (8|16)
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r.* \([er]sp\) ofs [48]
+ DW_CFA_offset: r.* \([er]ip\) at cfa-[48]
+ DW_CFA_nop
+ DW_CFA_nop
+
+0*18 0*1[8c] 0*1c FDE cie=0*00 pc=0*00..0*04
+ DW_CFA_remember_state
+ DW_CFA_advance_loc: 1 to 0*01
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_advance_loc: 1 to 0*02
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_advance_loc: 1 to 0*03
+ DW_CFA_nop
+ DW_CFA_restore_state
+#pass
diff --git a/gas/testsuite/gas/cfi/cfi-label.s b/gas/testsuite/gas/cfi/cfi-label.s
new file mode 100644
index 0000000..f0297ab
--- /dev/null
+++ b/gas/testsuite/gas/cfi/cfi-label.s
@@ -0,0 +1,19 @@
+ .text
+cfilabel:
+ .cfi_startproc
+ .cfi_remember_state
+ nop
+ .globl cfi1
+ .cfi_label cfi1
+ .cfi_escape 0, 0, 0
+ nop
+ .cfi_label cfi2
+ .cfi_escape 0, 0
+ nop
+ .cfi_label .Lcfi3
+ .cfi_escape 0
+ .cfi_restore_state
+ ret
+ .cfi_endproc
+ .type cfilabel, STT_FUNC
+ .size cfilabel, . - cfilabel
diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp
index 33ae13e..be84941 100644
--- a/gas/testsuite/gas/cfi/cfi.exp
+++ b/gas/testsuite/gas/cfi/cfi.exp
@@ -51,6 +51,10 @@ if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } then {
set ASFLAGS "$old_ASFLAGS"
}
+ if { [is_elf_format] } then {
+ run_dump_test "cfi-label"
+ }
+
if { [is_pecoff_format] } then {
run_dump_test "reloc-pe-i386"
}