aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-04-26 15:28:08 +0000
committerNick Clifton <nickc@redhat.com>2011-04-26 15:28:08 +0000
commit72b016b4ac0d7532a8f173fe3472e2e88ac49d45 (patch)
treee6d8dcd1c9cabcafcfe1713f55b366a2cbeefbec /ld
parent4964e065b452a479b9ba0d636b28455c496ba9ab (diff)
downloadgdb-72b016b4ac0d7532a8f173fe3472e2e88ac49d45.zip
gdb-72b016b4ac0d7532a8f173fe3472e2e88ac49d45.tar.gz
gdb-72b016b4ac0d7532a8f173fe3472e2e88ac49d45.tar.bz2
* dw2gencfi.c (dwcfi_seg_list): New struct.
(dwcfi_hash): New static hash variable. (get_debugseg_name): New. (alloc_debugseg_item): New. (make_debug_seg): New. (dwcfi_hash_insert): New. (dwcfi_hash_find): New. (dwcfi_hash_find_or_make): New. (cfi_insn_data): New member cur_seg. (cie_entry): Likewise. (fde_entry): New cseg and handled members. (alloc_fde_entry): Initialize cseg member. (alloc_cfi_insn_data): Initialize cur_seg member. (dot_cfi_sections): Compare for beginning of section names via strncmp. (get_cfi_seg): New. (cfi_finish): Treat link-once sections. (is_now_linkonce_segment): New local helper. (output_cie): Ignore cie entries not member of current segment. (output_fde): Likewise. (select_cie_for_fde): Likewise. (cfi_change_reg_numbers): Add new argument for current segment and ignore insn elements, if not part of current segment. * ehopt.c (get_cie_info): Use strncmp for section name matching. (heck_eh_frame): Likewise. * coffcode.h (sec_to_styp_flags): Allow linkonce for debugging sections. * scripttempl/pe.sc: Handle .eh_frame($|.)* sections. * scripttempl/pep.sc: Likewise. * ld-pe/pe.exp: Add cfi/cfi32 tests. * ld-pe/cfi.d: New. * ld-pe/cfi32.d: New. * ld-pe/cfia.s: New. * ld-pe/cfib.s: New.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/scripttempl/pe.sc4
-rw-r--r--ld/scripttempl/pep.sc4
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-pe/cfi.d36
-rw-r--r--ld/testsuite/ld-pe/cfi32.d28
-rw-r--r--ld/testsuite/ld-pe/cfia.s26
-rw-r--r--ld/testsuite/ld-pe/cfib.s16
-rw-r--r--ld/testsuite/ld-pe/pe.exp6
9 files changed, 129 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index b25a87f..dfbb582 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-26 Kai Tietz <ktietz@redhat.com>
+
+ * scripttempl/pe.sc: Handle .eh_frame($|.)* sections.
+ * scripttempl/pep.sc: Likewise.
+
2011-04-24 Alan Modra <amodra@gmail.com>
PR ld/12365
diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
index 7d52cc5..a82d08c 100644
--- a/ld/scripttempl/pe.sc
+++ b/ld/scripttempl/pe.sc
@@ -115,7 +115,7 @@ SECTIONS
.eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
{
- *(.eh_frame)
+ *(.eh_frame*)
}
.pdata ${RELOCATING+BLOCK(__section_alignment__)} :
@@ -250,7 +250,7 @@ SECTIONS
.debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
{
- *(.debug_frame)
+ *(.debug_frame*)
}
.debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
index 8fa5f05..b8315c5 100644
--- a/ld/scripttempl/pep.sc
+++ b/ld/scripttempl/pep.sc
@@ -116,7 +116,7 @@ SECTIONS
.eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
{
- *(.eh_frame)
+ *(.eh_frame*)
}
.pdata ${RELOCATING+BLOCK(__section_alignment__)} :
@@ -256,7 +256,7 @@ SECTIONS
.debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
{
- *(.debug_frame)
+ *(.debug_frame*)
}
.debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7a09d41..1fd011e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2011-04-26 Kai Tietz <ktietz@redhat.com>
+
+ * ld-pe/pe.exp: Add cfi/cfi32 tests.
+ * ld-pe/cfi.d: New.
+ * ld-pe/cfi32.d: New.
+ * ld-pe/cfia.s: New.
+ * ld-pe/cfib.s: New.
+
2011-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12694
diff --git a/ld/testsuite/ld-pe/cfi.d b/ld/testsuite/ld-pe/cfi.d
new file mode 100644
index 0000000..6c5042b
--- /dev/null
+++ b/ld/testsuite/ld-pe/cfi.d
@@ -0,0 +1,36 @@
+#source: cfia.s
+#source: cfib.s
+#ld: --file-align 1 --section-align 1
+#objdump: -Wf
+
+#...
+00000004 00000014 ffffffff CIE
+ Version: 1
+ Augmentation: ""
+ Code alignment factor: 1
+ Data alignment factor: \-8
+ Return address column: 32
+
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r32 \(xmm15\) at cfa\-8
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0000001c 00000024 00000004 FDE cie=00000004 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(rbp\) at cfa\-16
+ DW_CFA_advance_loc: 4 to .*
+^ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_restore: r6 \(rbp\)
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#pass
diff --git a/ld/testsuite/ld-pe/cfi32.d b/ld/testsuite/ld-pe/cfi32.d
new file mode 100644
index 0000000..d13fb1a
--- /dev/null
+++ b/ld/testsuite/ld-pe/cfi32.d
@@ -0,0 +1,28 @@
+#source: cfia.s
+#source: cfib.s
+#ld: --file-align 1 --section-align 1
+#objdump: -Wf
+
+#...
+00000000 00000010 ffffffff CIE
+ Version: 1
+ Augmentation: ""
+ Code alignment factor: 1
+ Data alignment factor: \-4
+ Return address column: 8
+
+ DW_CFA_def_cfa: r4 \(esp\) ofs 4
+ DW_CFA_offset: r8 \(eip\) at cfa\-4
+ DW_CFA_nop
+ DW_CFA_nop
+
+00000014 00000018 00000000 FDE cie=00000000 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(esi\) at cfa\-16
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r7 \(edi\) ofs 8
+ DW_CFA_restore: r6 \(esi\)
+ DW_CFA_nop
+ DW_CFA_nop
+#pass
diff --git a/ld/testsuite/ld-pe/cfia.s b/ld/testsuite/ld-pe/cfia.s
new file mode 100644
index 0000000..d1ea51d
--- /dev/null
+++ b/ld/testsuite/ld-pe/cfia.s
@@ -0,0 +1,26 @@
+ .globl _mainCRTStartup
+ .globl _start
+ .text
+_mainCRTStartup:
+mainCRTStartup:
+_start:
+start:
+ .long -1
+
+ .cfi_sections .debug_frame
+ .section .text$abc,"x"
+ .linkonce discard
+ .align 2
+ .globl _tst
+ .def _tst; .scl 2; .type 32; .endef
+_tst:
+ .cfi_startproc
+ .long 0
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ .long 1
+ .cfi_def_cfa 7, 8
+ .cfi_restore 6
+ .long 2
+ .cfi_endproc
+
diff --git a/ld/testsuite/ld-pe/cfib.s b/ld/testsuite/ld-pe/cfib.s
new file mode 100644
index 0000000..9b761cf
--- /dev/null
+++ b/ld/testsuite/ld-pe/cfib.s
@@ -0,0 +1,16 @@
+ .cfi_sections .debug_frame
+ .section .text$abc,"x"
+ .linkonce discard
+ .align 2
+ .globl _tst
+ .def _tst; .scl 2; .type 32; .endef
+_tst:
+ .cfi_startproc
+ .long 0
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ .long 1
+ .cfi_def_cfa 7, 8
+ .cfi_restore 6
+ .long 2
+ .cfi_endproc
diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp
index 183c5c6..c72c3b1 100644
--- a/ld/testsuite/ld-pe/pe.exp
+++ b/ld/testsuite/ld-pe/pe.exp
@@ -77,6 +77,12 @@ run_dump_test "longsecn-5"
run_dump_test "orphan"
run_dump_test "orphan_nu"
+if {[istarget x86_64-*-mingw*] } {
+ run_dump_test "cfi"
+} elseif {[istarget i*86-*-cygwin*] || [istarget i*86-*-mingw*] } {
+ run_dump_test "cfi32"
+}
+
set foreign_sym_test {
{"non-C aligned common" "" "" {non-c-lang-syms.s}
{{nm -C non-c-lang-syms.d}} "non-c-lang-syms.x"}