aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-05-03 01:08:44 +0000
committerAlan Modra <amodra@gmail.com>2001-05-03 01:08:44 +0000
commit636c26b044901d23dd7277276dd00a346001ec66 (patch)
tree86828ade80810bef6411940cb3f244b7ee931b37 /gas/config
parent14fe918ef2fd49b88be88e9dc0fe025c61440e4e (diff)
downloadgdb-636c26b044901d23dd7277276dd00a346001ec66.zip
gdb-636c26b044901d23dd7277276dd00a346001ec66.tar.gz
gdb-636c26b044901d23dd7277276dd00a346001ec66.tar.bz2
* config/tc-i386.c (i386_displacement): Call as_bad for bad GOTOFF
expressions rather than triggering an assert.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 69dd6c0..57b9b0f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3466,6 +3466,19 @@ i386_displacement (disp_start, disp_end)
exp_seg = expression (exp);
+ SKIP_WHITESPACE ();
+ if (*input_line_pointer)
+ as_bad (_("junk `%s' after expression"), input_line_pointer);
+#if GCC_ASM_O_HACK
+ RESTORE_END_STRING (disp_end + 1);
+#endif
+ RESTORE_END_STRING (disp_end);
+ input_line_pointer = save_input_line_pointer;
+#ifndef LEX_AT
+ if (gotfree_input_line)
+ free (gotfree_input_line);
+#endif
+
#ifdef BFD_ASSEMBLER
/* We do this to make sure that the section symbol is in
the symbol table. We will ultimately change the relocation
@@ -3473,10 +3486,18 @@ i386_displacement (disp_start, disp_end)
if (i.reloc[this_operand] == BFD_RELOC_386_GOTOFF
|| i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL)
{
+ if (exp->X_op != O_symbol)
+ {
+ as_bad (_("bad expression used with @%s"),
+ (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL
+ ? "GOTPCREL"
+ : "GOTOFF"));
+ return 0;
+ }
+
if (S_IS_LOCAL (exp->X_add_symbol)
&& S_GET_SEGMENT (exp->X_add_symbol) != undefined_section)
section_symbol (S_GET_SEGMENT (exp->X_add_symbol));
- assert (exp->X_op == O_symbol);
exp->X_op = O_subtract;
exp->X_op_symbol = GOT_symbol;
if (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL)
@@ -3486,19 +3507,6 @@ i386_displacement (disp_start, disp_end)
}
#endif
- SKIP_WHITESPACE ();
- if (*input_line_pointer)
- as_bad (_("junk `%s' after expression"), input_line_pointer);
-#if GCC_ASM_O_HACK
- RESTORE_END_STRING (disp_end + 1);
-#endif
- RESTORE_END_STRING (disp_end);
- input_line_pointer = save_input_line_pointer;
-#ifndef LEX_AT
- if (gotfree_input_line)
- free (gotfree_input_line);
-#endif
-
if (exp->X_op == O_absent || exp->X_op == O_big)
{
/* Missing or bad expr becomes absolute 0. */