aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-07-14 22:21:25 +0000
committerIan Lance Taylor <ian@airs.com>1993-07-14 22:21:25 +0000
commit5868b1fe68831aacbf3934406182a20466aeec20 (patch)
treeb4ca8be5c6c65b1aeb7676181dd1d3f26128b06c /gas/write.c
parentbf5b632df7ee9b664c00a02296b9cdcbea634e55 (diff)
downloadgdb-5868b1fe68831aacbf3934406182a20466aeec20.zip
gdb-5868b1fe68831aacbf3934406182a20466aeec20.tar.gz
gdb-5868b1fe68831aacbf3934406182a20466aeec20.tar.bz2
* Removed sy_forward and replaced it with an undefined expression
as the value of a symbol. * struc-symbol.h (struct symbol): Removed sy_forward field. Added sy_resolved and sy_resolving single bit fields. * symbols.c (symbol_new): Don't initialize sy_forward field. (resolve_symbol_value): New function to adjust symbol value by fragment address, using recursion to resolve forward symbols. * symbols.h: Added prototype for new function. * read.c (pseudo_set): Set symbolP->sy_value to an undefined expression rather than setting symbolP->sy_forward. * write.c (write_object_file): Use resolve_symbol_value on symbols, keeping the common case (the old behaviour) inline. * config/obj-aout.c (obj_aout_frob_symbol): Removed sy_forward handling (subsumed by write.c change). * config/obj-coff.c, config/obj-coffbfd.c (obj_coff_val): Set sy_value rather than sy_forward. * config/obj-coffbfd.c (obj_coff_endef, yank_symbols): Check expression segment rather than sy_forward. (yank_symbols): Use resolve_symbol_value. (crawl_symbols): Removed extra pass over symbols. * config/obj-aout.c, config/obj-bout.c, config/obj-coff.c, config/obj-vms.c (obj_crawl_symbol_chain): Removed extra pass over symbols which handled sy_forward; use resolve_symbol_value instead. * config/obj-coff.h, config/obj-coffbfd.h (obj_frob_forward_symbol): Define. * config/obj-elf.c (obj_elf_stab_generic): Check expression segment rather than sy_forward. * config/obj-vms.c (VMS_Check_For_Main): Don't initialize sy_forward; do initialize sy_resolved and sy_resolving. * config/tc-hppa.h (STAB_FIXUP): Use sy_value, not sy_forward.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gas/write.c b/gas/write.c
index 63353e3..ca7c625 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1172,18 +1172,30 @@ write_object_file ()
{
int keep = 0;
- S_SET_VALUE (symp, S_GET_VALUE (symp) + symp->sy_frag->fr_address);
+ if (! symp->sy_resolved)
+ {
+ if (symp->sy_value.X_seg == absolute_section)
+ {
+ /* This is the normal case; skip the call. */
+ S_SET_VALUE (symp,
+ (S_GET_VALUE (symp)
+ + symp->sy_frag->fr_address));
+ symp->sy_resolved = 1;
+ }
+ else
+ resolve_symbol_value (symp);
+ }
+
/* So far, common symbols have been treated like undefined symbols.
Put them in the common section now. */
if (S_IS_DEFINED (symp) == 0
&& S_GET_VALUE (symp) != 0)
S_SET_SEGMENT (symp, &bfd_com_section);
#if 0
- printf ("symbol `%s'\n\t@%x: value=%d flags=%x forward=%x seg=%s\n",
+ printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
S_GET_NAME (symp), symp,
S_GET_VALUE (symp),
symp->bsym->flags,
- symp->sy_forward,
segment_name (symp->bsym->section));
#endif
{