aboutsummaryrefslogtreecommitdiff
path: root/gas/symbols.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1998-01-27 13:33:54 +0000
committerRichard Henderson <rth@redhat.com>1998-01-27 13:33:54 +0000
commitc3b27a64b4e948791421c78d462de240cdba9ced (patch)
treef65c9b3b30d3c8cc0bf801f169afce0bdb3957f0 /gas/symbols.c
parentf3329c1a648a247c79b18675bb57ad79751c3b96 (diff)
downloadgdb-c3b27a64b4e948791421c78d462de240cdba9ced.zip
gdb-c3b27a64b4e948791421c78d462de240cdba9ced.tar.gz
gdb-c3b27a64b4e948791421c78d462de240cdba9ced.tar.bz2
* as.c (parse_args): Add --keep-locals alias for -L.
Add --strip-local-absolute. (show_usage): Update. * as.h (flag_strip_local_absolute): New flag. * symbols.c (S_IS_LOCAL): Use it. * config/obj-aout.h (S_IS_LOCAL): Likewise. * config/obj-bout.h (S_IS_LOCAL): Likewise. * config/obj-coff.h (S_IS_LOCAL): Likewise. PR 14689
Diffstat (limited to 'gas/symbols.c')
-rw-r--r--gas/symbols.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index d6dc8a4..6d8bfcd 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -724,8 +724,8 @@ resolve_symbol_value (symp, finalize)
{
symp->sy_value.X_op = O_symbol;
S_SET_SEGMENT (symp, S_GET_SEGMENT (add_symbol));
+ symp->sy_value.X_add_number = final_val;
}
- symp->sy_value.X_add_number = final_val;
final_val = 0;
resolved = add_symbol->sy_resolved;
goto exit_dont_set_value;
@@ -887,12 +887,12 @@ resolve_symbol_value (symp, finalize)
case O_bit_and: left &= right; break;
case O_add: left += right; break;
case O_subtract: left -= right; break;
- case O_eq: left = left == right ? ~ (offsetT) 0 : 0;
- case O_ne: left = left != right ? ~ (offsetT) 0 : 0;
- case O_lt: left = left < right ? ~ (offsetT) 0 : 0;
- case O_le: left = left <= right ? ~ (offsetT) 0 : 0;
- case O_ge: left = left >= right ? ~ (offsetT) 0 : 0;
- case O_gt: left = left > right ? ~ (offsetT) 0 : 0;
+ case O_eq: left = left == right ? ~ (offsetT) 0 : 0; break;
+ case O_ne: left = left != right ? ~ (offsetT) 0 : 0; break;
+ case O_lt: left = left < right ? ~ (offsetT) 0 : 0; break;
+ case O_le: left = left <= right ? ~ (offsetT) 0 : 0; break;
+ case O_ge: left = left >= right ? ~ (offsetT) 0 : 0; break;
+ case O_gt: left = left > right ? ~ (offsetT) 0 : 0; break;
case O_logical_and: left = left && right; break;
case O_logical_or: left = left || right; break;
default: abort ();
@@ -1364,7 +1364,7 @@ S_IS_EXTERNAL (s)
flagword flags = s->bsym->flags;
/* sanity check */
- if (flags & BSF_LOCAL && flags & BSF_GLOBAL)
+ if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
abort ();
return (flags & BSF_GLOBAL) != 0;
@@ -1408,12 +1408,17 @@ S_IS_LOCAL (s)
const char *name;
/* sanity check */
- if (flags & BSF_LOCAL && flags & BSF_GLOBAL)
+ if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
abort ();
if (bfd_get_section (s->bsym) == reg_section)
return 1;
+ if (flag_strip_local_absolute
+ && (flags & BSF_GLOBAL) == 0
+ && bfd_get_section (s->bsym) == absolute_section)
+ return 1;
+
name = S_GET_NAME (s);
return (name != NULL
&& ! S_IS_DEBUG (s)
@@ -1459,7 +1464,17 @@ S_SET_SEGMENT (s, seg)
symbolS *s;
segT seg;
{
- s->bsym->section = seg;
+ /* Don't reassign section symbols. The direct reason is to prevent seg
+ faults assigning back to const global symbols such as *ABS*, but it
+ shouldn't happen anyway. */
+
+ if (s->bsym->flags & BSF_SECTION_SYM)
+ {
+ if (s->bsym->section != seg)
+ abort();
+ }
+ else
+ s->bsym->section = seg;
}
void