aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-09-09 14:01:17 +0000
committerAlan Modra <amodra@gmail.com>2001-09-09 14:01:17 +0000
commite0890092b6a535a9a232ddbed804a0c98a5b4a2c (patch)
treebb42790c1bc434ddffe208d731a1f587e182b9f8 /gas/config
parentf16fbd61d9f5f2940137ea1aea523652964723eb (diff)
downloadgdb-e0890092b6a535a9a232ddbed804a0c98a5b4a2c.zip
gdb-e0890092b6a535a9a232ddbed804a0c98a5b4a2c.tar.gz
gdb-e0890092b6a535a9a232ddbed804a0c98a5b4a2c.tar.bz2
* expr.c (expr): Move code setting "retval" to the end of the loop,
and rearrange for efficiency. For "PIC code" subtraction, use "rightseg" rather than recalculating. For "symbol OP symbol" subtract, set "retval" to absolute_section if symbols in same section. * symbols.c (resolve_symbol_value): Resolve "sym +/- expr" to an O_symbol. Simplify a +/- b code. Allow equality and non-equality comparisons on symbols from any section. Allow other comparison operators as for subtraction. (symbol_equated_reloc_p): New predicate function. * symbols.h (symbol_equated_reloc_p): Declare. * write.c (adjust_reloc_syms): Use symbol_equated_reloc_p. (write_relocs): Likewise. (write_object_file): Likewise. (relax_segment <rs_machine_dependent>): Ensure segment for expression syms is set correctly. * config/tc-mips.c (md_estimate_size_before_relax): Likewise. * config/tc-i386.c (md_assemble <Output jumps>): Don't lose part of a complex expression when setting up frag_var.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c37
-rw-r--r--gas/config/tc-mips.c3
2 files changed, 26 insertions, 14 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 275b3e6..739ed58 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2741,6 +2741,9 @@ md_assemble (line)
{
int code16;
int prefix;
+ relax_substateT subtype;
+ symbolS *sym;
+ offsetT off;
code16 = 0;
if (flag_code == CODE_16BIT)
@@ -2785,19 +2788,29 @@ md_assemble (line)
if (i.prefix[REX_PREFIX])
*p++ = i.prefix[REX_PREFIX];
*p = i.tm.base_opcode;
- /* 1 possible extra opcode + displacement go in var part.
+
+ if ((unsigned char) *p == JUMP_PC_RELATIVE)
+ subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL);
+ else if ((cpu_arch_flags & Cpu386) != 0)
+ subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL);
+ else
+ subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL);
+ subtype |= code16;
+
+ sym = i.op[0].disps->X_add_symbol;
+ off = i.op[0].disps->X_add_number;
+
+ if (i.op[0].disps->X_op != O_constant
+ && i.op[0].disps->X_op != O_symbol)
+ {
+ /* Handle complex expressions. */
+ sym = make_expr_symbol (i.op[0].disps);
+ off = 0;
+ }
+
+ /* 1 possible extra opcode + 4 byte displacement go in var part.
Pass reloc in fr_var. */
- frag_var (rs_machine_dependent,
- 1 + 4,
- i.reloc[0],
- ((unsigned char) *p == JUMP_PC_RELATIVE
- ? ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL) | code16
- : ((cpu_arch_flags & Cpu386) != 0
- ? ENCODE_RELAX_STATE (COND_JUMP, SMALL) | code16
- : ENCODE_RELAX_STATE (COND_JUMP86, SMALL) | code16)),
- i.op[0].disps->X_add_symbol,
- i.op[0].disps->X_add_number,
- p);
+ frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
}
else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
{
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 0855af0..f9b5811 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -11143,8 +11143,7 @@ md_estimate_size_before_relax (fragp, segtype)
sym = fragp->fr_symbol;
/* Handle the case of a symbol equated to another symbol. */
- while (symbol_equated_p (sym)
- && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
+ while (symbol_equated_reloc_p (sym))
{
symbolS *n;