aboutsummaryrefslogtreecommitdiff
path: root/gas/config
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/config
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/config')
-rw-r--r--gas/config/tc-i386.c53
-rw-r--r--gas/config/tc-i386.h6
2 files changed, 59 insertions, 0 deletions
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