aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-04-20 12:17:16 +0000
committerNick Clifton <nickc@redhat.com>2004-04-20 12:17:16 +0000
commit6482c264f4a6d239f2abd356e09ae465e74efeb1 (patch)
tree7ff3cb95f0c24d9341f9366e551a0e23bdb5d9bf /gas
parentb4781d441cad5589faa6e3fcbfcfb20d28cc7579 (diff)
downloadgdb-6482c264f4a6d239f2abd356e09ae465e74efeb1.zip
gdb-6482c264f4a6d239f2abd356e09ae465e74efeb1.tar.gz
gdb-6482c264f4a6d239f2abd356e09ae465e74efeb1.tar.bz2
Add support for a .secrel32 x86 reloc to allow DWARF" debug information to used
with COFF based x86 ports.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-i386.c53
-rw-r--r--gas/config/tc-i386.h6
-rw-r--r--gas/testsuite/ChangeLog7
-rw-r--r--gas/testsuite/gas/i386/i386.exp7
-rw-r--r--gas/testsuite/gas/i386/secrel.d43
-rw-r--r--gas/testsuite/gas/i386/secrel.s77
7 files changed, 202 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f98a14d..9f0167c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-20 DJ Delorie <dj@redhat.com>
+
+ * config/tc-i386.h [TE_PE] (TC_CONS_FIX_NEW): Define.
+ * config/tc-i386.c (md_pseudo_table) [TE_PE]: Add "secrel32".
+ [TE_PE] (O_secrel): Define.
+ [TE_PE] (x86_pe_cons_fix_new): New.
+ [TE_PE] (pe_directive_secrel): Likewise.
+ (tc_gen_reloc) [TE_PE]: Support BFD_RELOC_32_SECREL.
+
2004-04-19 Eric Christopher <echristo@redhat.com>
* config/tc-mips.c (mips_dwarf2_addr_size): Revert part
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 5de6a55..f37c259 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -76,6 +76,9 @@ static void set_code_flag PARAMS ((int));
static void set_16bit_gcc_code_flag PARAMS ((int));
static void set_intel_syntax PARAMS ((int));
static void set_cpu_arch PARAMS ((int));
+#ifdef TE_PE
+static void pe_directive_secrel PARAMS ((int));
+#endif
static char *output_invalid PARAMS ((int c));
static int i386_operand PARAMS ((char *operand_string));
static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float));
@@ -444,6 +447,9 @@ const pseudo_typeS md_pseudo_table[] =
{"att_syntax", set_intel_syntax, 0},
{"file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0},
{"loc", dwarf2_directive_loc, 0},
+#ifdef TE_PE
+ {"secrel32", pe_directive_secrel, 0},
+#endif
{0, 0, 0}
};
@@ -3638,6 +3644,50 @@ x86_cons (exp, size)
}
#endif
+#ifdef TE_PE
+
+#define O_secrel (O_max + 1)
+
+void
+x86_pe_cons_fix_new (frag, off, len, exp)
+ fragS *frag;
+ unsigned int off;
+ unsigned int len;
+ expressionS *exp;
+{
+ enum bfd_reloc_code_real r = reloc (len, 0, 0, NO_RELOC);
+
+ if (exp->X_op == O_secrel)
+ {
+ exp->X_op = O_symbol;
+ r = BFD_RELOC_32_SECREL;
+ }
+
+ fix_new_exp (frag, off, len, exp, 0, r);
+}
+
+static void
+pe_directive_secrel (dummy)
+ int dummy ATTRIBUTE_UNUSED;
+{
+ expressionS exp;
+
+ do
+ {
+ expression (&exp);
+ if (exp.X_op == O_symbol)
+ exp.X_op = O_secrel;
+
+ emit_expr (&exp, 4);
+ }
+ while (*input_line_pointer++ == ',');
+
+ input_line_pointer--;
+ demand_empty_rest_of_line ();
+}
+
+#endif
+
static int i386_immediate PARAMS ((char *));
static int
@@ -5165,6 +5215,9 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_RVA:
case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_VTABLE_INHERIT:
+#ifdef TE_PE
+ case BFD_RELOC_32_SECREL:
+#endif
code = fixp->fx_r_type;
break;
default:
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 14b522b..5c48f58 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -408,6 +408,12 @@ extern void x86_cons_fix_new
PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
#endif
+#ifdef TE_PE
+#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_pe_cons_fix_new(FRAG, OFF, LEN, EXP)
+extern void x86_pe_cons_fix_new
+ PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
+#endif
+
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
#define NO_RELOC BFD_RELOC_NONE
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index c99e91f..6d6dfdf 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-20 Brian Ford <ford@vss.fsi.com>
+ DJ Delorie <dj@redhat.com>
+
+ * gas/i386/secrel.s: New test for .secrel32.
+ * gas/i386/secrel.d: Likewise.
+ * gas/i386/i386.exp: Call it for PE targets.
+
2004-04-19 Jakub Jelinek <jakub@redhat.com>
* gas/cfi/cfi-sparc64-1.d: Update.
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 3ccb7e2..946cf9e 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -88,6 +88,13 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "tlsnopic"
}
+ # This is a PE specific test.
+ if { [istarget "*-*-cygwin*"] || [istarget "*-*-pe"]
+ || [istarget "*-*-mingw*"]
+ } then {
+ run_dump_test "secrel"
+ }
+
set ASFLAGS "$old_ASFLAGS"
}
diff --git a/gas/testsuite/gas/i386/secrel.d b/gas/testsuite/gas/i386/secrel.d
new file mode 100644
index 0000000..7df55f7
--- /dev/null
+++ b/gas/testsuite/gas/i386/secrel.d
@@ -0,0 +1,43 @@
+#objdump: -rs
+#name: i386 secrel reloc
+
+.*: +file format pe-i386
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE
+00000024 secrel32 \.text
+00000029 secrel32 \.text
+0000002e secrel32 \.text
+00000033 secrel32 \.text
+00000044 secrel32 \.data
+00000049 secrel32 \.data
+0000004e secrel32 \.data
+00000053 secrel32 \.data
+00000064 secrel32 \.rdata
+00000069 secrel32 \.rdata
+0000006e secrel32 \.rdata
+00000073 secrel32 \.rdata
+00000084 secrel32 ext24
+00000089 secrel32 ext2d
+0000008e secrel32 ext36
+00000093 secrel32 ext3f
+
+
+Contents of section \.text:
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+Contents of section \.data:
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ 0020 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ 0030 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ 0040 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ 0050 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ 0060 3e3e3e3e 04000000 110d0000 00111600 >>>>............
+ 0070 0000111f 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+ 0080 3e3e3e3e 00000000 11000000 00110000 >>>>............
+ 0090 00001100 00000011 3c3c3c3c 3c3c3c3c ........<<<<<<<<
+Contents of section \.rdata:
+ 0000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c >>>><<<<>>>>><<<
+ 0010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c >>>>>><<>>>>>>><
+ 0020 3e3e3e3e >>>>
diff --git a/gas/testsuite/gas/i386/secrel.s b/gas/testsuite/gas/i386/secrel.s
new file mode 100644
index 0000000..eaf59cd
--- /dev/null
+++ b/gas/testsuite/gas/i386/secrel.s
@@ -0,0 +1,77 @@
+.text
+
+ .ascii ">>>>"
+pre04: .ascii "<<<<"
+ .ascii ">>>>>"
+pre0d: .ascii "<<<"
+ .ascii ">>>>>>"
+pre16: .ascii "<<"
+ .ascii ">>>>>>>"
+pre1f: .ascii "<"
+
+.data
+
+ .ascii ">>>>"
+sam04: .ascii "<<<<"
+ .ascii ">>>>>"
+sam0d: .ascii "<<<"
+ .ascii ">>>>>>"
+sam16: .ascii "<<"
+ .ascii ">>>>>>>"
+sam1f: .ascii "<"
+
+ .ascii ">>>>"
+ .secrel32 pre04
+ .byte 0x11
+ .secrel32 pre0d
+ .byte 0x11
+ .secrel32 pre16
+ .byte 0x11
+ .secrel32 pre1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 sam04
+ .byte 0x11
+ .secrel32 sam0d
+ .byte 0x11
+ .secrel32 sam16
+ .byte 0x11
+ .secrel32 sam1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 nex04
+ .byte 0x11
+ .secrel32 nex0d
+ .byte 0x11
+ .secrel32 nex16
+ .byte 0x11
+ .secrel32 nex1f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+ .ascii ">>>>"
+ .secrel32 ext24
+ .byte 0x11
+ .secrel32 ext2d
+ .byte 0x11
+ .secrel32 ext36
+ .byte 0x11
+ .secrel32 ext3f
+ .byte 0x11
+ .ascii "<<<<<<<<"
+
+.section .rdata
+
+ .ascii ">>>>"
+nex04: .ascii "<<<<"
+ .ascii ">>>>>"
+nex0d: .ascii "<<<"
+ .ascii ">>>>>>"
+nex16: .ascii "<<"
+ .ascii ">>>>>>>"
+nex1f: .ascii "<"
+ .ascii ">>>>"