aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
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/write.c
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/write.c')
-rw-r--r--gas/write.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gas/write.c b/gas/write.c
index c096eb5..14fbf04 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -769,8 +769,7 @@ adjust_reloc_syms (abfd, sec, xxx)
/* If this symbol is equated to an undefined symbol, convert
the fixup to being against that symbol. */
- if (sym != NULL && symbol_equated_p (sym)
- && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
+ if (sym != NULL && symbol_equated_reloc_p (sym))
{
fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
sym = symbol_get_value_expression (sym)->X_add_symbol;
@@ -983,11 +982,10 @@ write_relocs (abfd, sec, xxx)
}
/* If this is an undefined symbol which was equated to another
- symbol, then use generate the reloc against the latter symbol
+ symbol, then generate the reloc against the latter symbol
rather than the former. */
sym = fixp->fx_addsy;
- while (symbol_equated_p (sym)
- && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
+ while (symbol_equated_reloc_p (sym))
{
symbolS *n;
@@ -1059,8 +1057,7 @@ write_relocs (abfd, sec, xxx)
symbol, then generate the reloc against the latter symbol
rather than the former. */
sym = fixp->fx_addsy;
- while (symbol_equated_p (sym)
- && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
+ while (symbol_equated_reloc_p (sym))
sym = symbol_get_value_expression (sym)->X_add_symbol;
fixp->fx_addsy = sym;
@@ -1960,8 +1957,7 @@ write_object_file ()
/* Skip symbols which were equated to undefined or common
symbols. */
- if (symbol_equated_p (symp)
- && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
+ if (symbol_equated_reloc_p (symp))
{
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
continue;
@@ -2264,6 +2260,12 @@ relax_segment (segment_frag_root, segment)
break;
case rs_machine_dependent:
+ /* If fr_symbol is an expression, this call to
+ resolve_symbol_value sets up the correct segment, which will
+ likely be needed in md_estimate_size_before_relax. */
+ if (fragP->fr_symbol)
+ resolve_symbol_value (fragP->fr_symbol);
+
address += md_estimate_size_before_relax (fragP, segment);
break;