aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2010-09-02 22:43:46 +0000
committerRichard Henderson <rth@redhat.com>2010-09-02 22:43:46 +0000
commit3251495bd703dad0798b68acb17205f02b293f4b (patch)
tree9c120343d3a05742a1411503f27e6d042e504b34 /gas
parentb129eb0e566d53a2500d505cbb80e8ad4ad6f981 (diff)
downloadgdb-3251495bd703dad0798b68acb17205f02b293f4b.zip
gdb-3251495bd703dad0798b68acb17205f02b293f4b.tar.gz
gdb-3251495bd703dad0798b68acb17205f02b293f4b.tar.bz2
* dw2gencfi.c (TC_DWARF2_EMIT_OFFSET): Provide default.
(output_fde): Use it. Make sure to fully init exp before using it. testsuite/ * gas/cfi/cfi-common-1.d: Use objdump instead of readelf to dump. * gas/cfi/cfi-common-2.d, gas/cfi/cfi-common-3.d, gas/cfi/cfi-common-4.d, gas/cfi/cfi-common-6.d, gas/cfi/cfi-common-7.d, gas/cfi/cfi-x86_64.d: Likewise. * gas/cfi/cfi-x86_64.s: Remove .type directives. * gas/cfi/cfi.exp: Run for pecoff objects too. * gas/cfi/reloc-pe-i386.d, gas/cfi/reloc-pe-i386.s: New test.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/dw2gencfi.c32
-rw-r--r--gas/testsuite/ChangeLog11
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-1.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-2.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-3.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-4.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-6.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-common-7.d3
-rw-r--r--gas/testsuite/gas/cfi/cfi-x86_64.d11
-rw-r--r--gas/testsuite/gas/cfi/cfi-x86_64.s7
-rw-r--r--gas/testsuite/gas/cfi/cfi.exp11
12 files changed, 68 insertions, 27 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8121c32..bae8e5f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-02 Richard Henderson <rth@redhat.com>
+
+ * dw2gencfi.c (TC_DWARF2_EMIT_OFFSET): Provide default.
+ (output_fde): Use it. Make sure to fully init exp before using it.
+
2010-08-31 Kai Tietz <kai.tietz@onevision.com>
* config/obj-coff-seh.c (obj_coff_seh_save): Correct comparison.
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 36bd8d8..974cdfb 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -76,6 +76,24 @@
# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
#endif
+/* ??? Share this with dwarf2cfg.c. */
+#ifndef TC_DWARF2_EMIT_OFFSET
+#define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset
+
+/* Create an offset to .dwarf2_*. */
+
+static void
+generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
+{
+ expressionS exp;
+
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = symbol;
+ exp.X_add_number = 0;
+ emit_expr (&exp, size);
+}
+#endif
+
struct cfi_escape_data {
struct cfi_escape_data *next;
expressionS exp;
@@ -1405,19 +1423,21 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
if (eh_frame)
{
+ exp.X_op = O_subtract;
exp.X_add_symbol = after_size_address;
exp.X_op_symbol = cie->start_address;
+ exp.X_add_number = 0;
+ emit_expr (&exp, offset_size); /* CIE offset. */
}
else
{
- exp.X_op = O_symbol;
- exp.X_add_symbol = cie->start_address;
- exp.X_op_symbol = NULL;
+ TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size);
}
- emit_expr (&exp, offset_size); /* CIE offset. */
if (eh_frame)
{
+ exp.X_op = O_subtract;
+ exp.X_add_number = 0;
#if CFI_DIFF_EXPR_OK
exp.X_add_symbol = fde->start_address;
exp.X_op_symbol = symbol_temp_new_now ();
@@ -1425,7 +1445,6 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
#else
exp.X_op = O_symbol;
exp.X_add_symbol = fde->start_address;
- exp.X_op_symbol = NULL;
#ifdef tc_cfi_emit_pcrel_expr
tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */
#else
@@ -1436,7 +1455,9 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
}
else
{
+ exp.X_op = O_symbol;
exp.X_add_symbol = fde->start_address;
+ exp.X_add_number = 0;
addr_size = DWARF2_ADDR_SIZE (stdoutput);
emit_expr (&exp, addr_size);
}
@@ -1444,6 +1465,7 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
exp.X_op = O_subtract;
exp.X_add_symbol = fde->end_address;
exp.X_op_symbol = fde->start_address; /* Code length. */
+ exp.X_add_number = 0;
emit_expr (&exp, addr_size);
augmentation_size = encoding_size (fde->lsda_encoding);
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 335da7d..6e71940 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-02 Richard Henderson <rth@redhat.com>
+
+ * gas/cfi/cfi-common-1.d: Use objdump instead of readelf to dump.
+ * gas/cfi/cfi-common-2.d, gas/cfi/cfi-common-3.d,
+ gas/cfi/cfi-common-4.d, gas/cfi/cfi-common-6.d,
+ gas/cfi/cfi-common-7.d, gas/cfi/cfi-x86_64.d: Likewise.
+ * gas/cfi/cfi-x86_64.s: Remove .type directives.
+ * gas/cfi/cfi.exp: Run for pecoff objects too.
+
+ * gas/cfi/reloc-pe-i386.d, gas/cfi/reloc-pe-i386.s: New test.
+
2010-08-31 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/11960
diff --git a/gas/testsuite/gas/cfi/cfi-common-1.d b/gas/testsuite/gas/cfi/cfi-common-1.d
index 01303d3..81f3473 100644
--- a/gas/testsuite/gas/cfi/cfi-common-1.d
+++ b/gas/testsuite/gas/cfi/cfi-common-1.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 1
+#...
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-common-2.d b/gas/testsuite/gas/cfi/cfi-common-2.d
index c702fb3..184f17d 100644
--- a/gas/testsuite/gas/cfi/cfi-common-2.d
+++ b/gas/testsuite/gas/cfi/cfi-common-2.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 2
+#...
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-common-3.d b/gas/testsuite/gas/cfi/cfi-common-3.d
index fb7495b..b1611e2 100644
--- a/gas/testsuite/gas/cfi/cfi-common-3.d
+++ b/gas/testsuite/gas/cfi/cfi-common-3.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 3
+#...
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-common-4.d b/gas/testsuite/gas/cfi/cfi-common-4.d
index c69224e..deef6f8 100644
--- a/gas/testsuite/gas/cfi/cfi-common-4.d
+++ b/gas/testsuite/gas/cfi/cfi-common-4.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 4
+#...
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-common-6.d b/gas/testsuite/gas/cfi/cfi-common-6.d
index 35f221e..c4ed010 100644
--- a/gas/testsuite/gas/cfi/cfi-common-6.d
+++ b/gas/testsuite/gas/cfi/cfi-common-6.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 6
+#...
Contents of the .eh_frame section:
00000000 00000018 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-common-7.d b/gas/testsuite/gas/cfi/cfi-common-7.d
index 3bb8549..17a999d 100644
--- a/gas/testsuite/gas/cfi/cfi-common-7.d
+++ b/gas/testsuite/gas/cfi/cfi-common-7.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI common 7
+#...
Contents of the .eh_frame section:
00000000 00000010 00000000 CIE
diff --git a/gas/testsuite/gas/cfi/cfi-x86_64.d b/gas/testsuite/gas/cfi/cfi-x86_64.d
index 36b441c..7d20d2a 100644
--- a/gas/testsuite/gas/cfi/cfi-x86_64.d
+++ b/gas/testsuite/gas/cfi/cfi-x86_64.d
@@ -1,5 +1,6 @@
-#readelf: -wf
+#objdump: -Wf
#name: CFI on x86-64
+#...
Contents of the .eh_frame section:
00000000 00000014 00000000 CIE
@@ -94,7 +95,7 @@ Contents of the .eh_frame section:
DW_CFA_undefined: r16 \(rip\)
DW_CFA_nop
-000000e8 000000cc 00000018 FDE cie=000000d4 pc=00000058..00000097
+000000e8 000000c[8c] 00000018 FDE cie=000000d4 pc=00000058..00000097
DW_CFA_advance_loc: 1 to 00000059
DW_CFA_undefined: r0 \(rax\)
DW_CFA_advance_loc: 1 to 0000005a
@@ -220,8 +221,4 @@ Contents of the .eh_frame section:
DW_CFA_advance_loc: 1 to 00000096
DW_CFA_undefined: r48 \(mm7\)
DW_CFA_nop
- DW_CFA_nop
- DW_CFA_nop
- DW_CFA_nop
- DW_CFA_nop
-
+#pass
diff --git a/gas/testsuite/gas/cfi/cfi-x86_64.s b/gas/testsuite/gas/cfi/cfi-x86_64.s
index 65c2aa2..c5934f2 100644
--- a/gas/testsuite/gas/cfi/cfi-x86_64.s
+++ b/gas/testsuite/gas/cfi/cfi-x86_64.s
@@ -4,7 +4,6 @@
#; - function with a space on the stack
#; allocated for local variables
- .type func_locvars,@function
func_locvars:
.cfi_startproc
@@ -25,7 +24,6 @@ func_locvars:
#; - functions that begins with standard
#; prologue: "pushq %rbp; movq %rsp,%rbp"
- .type func_prologue,@function
func_prologue:
.cfi_startproc
@@ -53,7 +51,6 @@ func_prologue:
#; another register (r12) and then allocates
#; a space for local variables
- .type func_otherreg,@function
func_otherreg:
.cfi_startproc
@@ -78,7 +75,6 @@ func_otherreg:
#; main
#; - typical function
- .type main,@function
main:
.cfi_startproc
@@ -93,7 +89,6 @@ main:
#; _start
#; - standard entry point
- .type _start,@function
.globl _start
_start:
.cfi_startproc
@@ -108,7 +103,6 @@ _start:
#; - test for all .cfi directives.
#; This function is never called and the CFI info doesn't make sense.
- .type func_alldirectives,@function
func_alldirectives:
.cfi_startproc simple
.cfi_def_cfa rsp,8
@@ -139,7 +133,6 @@ func_alldirectives:
#; - test for all .cfi register numbers.
#; This function is never called and the CFI info doesn't make sense.
- .type func_all_registers,@function
func_all_registers:
.cfi_startproc simple
diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp
index 0d4c419..1999db6 100644
--- a/gas/testsuite/gas/cfi/cfi.exp
+++ b/gas/testsuite/gas/cfi/cfi.exp
@@ -1,4 +1,4 @@
-if ![is_elf_format] then {
+if { ![is_elf_format] && ![is_pecoff_format] } then {
return
}
@@ -35,6 +35,10 @@ if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } then {
set ASFLAGS "$old_ASFLAGS"
}
+ if { [is_pecoff_format] } then {
+ run_dump_test "reloc-pe-i386"
+ }
+
} elseif { [istarget alpha*-*-*] } then {
run_dump_test "cfi-alpha-1"
run_dump_test "cfi-alpha-2"
@@ -88,7 +92,10 @@ if { ![istarget "hppa64*-*"] } then {
run_dump_test "cfi-common-2"
run_dump_test "cfi-common-3"
run_dump_test "cfi-common-4"
- run_dump_test "cfi-common-5"
+ if { ![is_pecoff_format] } then {
+ # This test uses .subsection/.previous which are elf-specific.
+ run_dump_test "cfi-common-5"
+ }
run_dump_test "cfi-common-7"
}