1 /* symbols.c -symbol table-
3 Copyright (C) 1987, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #include "obstack.h" /* For "symbols.h" */
30 #ifndef WORKING_DOT_WORD
31 extern int new_broken_words
;
34 /* symbol-name => struct symbol pointer */
35 static struct hash_control
*sy_hash
;
37 /* Below are commented in "symbols.h". */
38 symbolS
*symbol_rootP
;
39 symbolS
*symbol_lastP
;
42 symbolS
*dot_text_symbol
;
43 symbolS
*dot_data_symbol
;
44 symbolS
*dot_bss_symbol
;
48 static void fb_label_init
PARAMS ((void));
54 symbol_rootP
= NULL
; /* In case we have 0 symbols (!!) */
55 sy_hash
= hash_new ();
56 memset ((char *) (&abs_symbol
), '\0', sizeof (abs_symbol
));
58 abs_symbol
.bsym
= bfd_abs_section
.symbol
;
60 /* Can't initialise a union. Sigh. */
61 S_SET_SEGMENT (&abs_symbol
, absolute_section
);
63 #ifdef LOCAL_LABELS_FB
65 #endif /* LOCAL_LABELS_FB */
71 * Return a pointer to a new symbol.
72 * Die if we can't make a new symbol.
73 * Fill in the symbol's values.
74 * Add symbol to end of symbol chain.
77 * Please always call this to create a new symbol.
79 * Changes since 1985: Symbol names may not contain '\0'. Sigh.
80 * 2nd argument is now a SEG rather than a TYPE. The mapping between
81 * segments and types is mostly encapsulated herein (actually, we inherit it
82 * from macros in struc-symbol.h).
86 symbol_new (name
, segment
, value
, frag
)
87 CONST
char *name
; /* It is copied, the caller can destroy/modify */
88 segT segment
; /* Segment identifier (SEG_<something>) */
89 valueT value
; /* Symbol value */
90 fragS
*frag
; /* Associated fragment */
92 unsigned int name_length
;
93 char *preserved_copy_of_name
;
96 name_length
= strlen (name
) + 1; /* +1 for \0 */
97 obstack_grow (¬es
, name
, name_length
);
98 preserved_copy_of_name
= obstack_finish (¬es
);
99 #ifdef STRIP_UNDERSCORE
100 if (preserved_copy_of_name
[0] == '_')
101 preserved_copy_of_name
++;
103 symbolP
= (symbolS
*) obstack_alloc (¬es
, sizeof (symbolS
));
105 /* symbol must be born in some fixed state. This seems as good as any. */
106 memset (symbolP
, 0, sizeof (symbolS
));
110 symbolP
->bsym
= bfd_make_empty_symbol (stdoutput
);
111 assert (symbolP
->bsym
!= 0);
112 symbolP
->bsym
->udata
= (PTR
) symbolP
;
114 S_SET_NAME (symbolP
, preserved_copy_of_name
);
116 S_SET_SEGMENT (symbolP
, segment
);
117 S_SET_VALUE (symbolP
, value
);
118 symbol_clear_list_pointers(symbolP
);
120 symbolP
->sy_frag
= frag
;
121 symbolP
->sy_forward
= NULL
;
122 #ifndef BFD_ASSEMBLER
123 symbolP
->sy_number
= ~0;
124 symbolP
->sy_name_offset
= ~0;
128 * Link to end of symbol chain.
130 symbol_append (symbolP
, symbol_lastP
, &symbol_rootP
, &symbol_lastP
);
132 obj_symbol_new_hook (symbolP
);
135 verify_symbol_chain(symbol_rootP
, symbol_lastP
);
145 * We have just seen "<name>:".
146 * Creates a struct symbol unless it already exists.
148 * Gripes if we are redefining a symbol incompatibly (and ignores it).
152 colon (sym_name
) /* just seen "x:" - rattle symbols & frags */
153 register char *sym_name
; /* symbol name, as a cannonical string */
154 /* We copy this string: OK to alter later. */
156 register symbolS
*symbolP
; /* symbol we are working with */
158 #ifdef LOCAL_LABELS_DOLLAR
159 /* Sun local labels go out of scope whenever a non-local symbol is
162 if (*sym_name
!= 'L')
163 dollar_label_clear ();
164 #endif /* LOCAL_LABELS_DOLLAR */
166 #ifndef WORKING_DOT_WORD
167 if (new_broken_words
)
169 struct broken_word
*a
;
174 extern const int md_short_jump_size
;
175 extern const int md_long_jump_size
;
176 possible_bytes
= (md_short_jump_size
177 + new_broken_words
* md_long_jump_size
);
180 frag_opcode
= frag_var (rs_broken_word
,
184 (symbolS
*) broken_words
,
188 /* We want to store the pointer to where to insert the jump table in the
189 fr_opcode of the rs_broken_word frag. This requires a little
192 && (frag_tmp
->fr_type
!= rs_broken_word
193 || frag_tmp
->fr_opcode
))
194 frag_tmp
= frag_tmp
->fr_next
;
196 frag_tmp
->fr_opcode
= frag_opcode
;
197 new_broken_words
= 0;
199 for (a
= broken_words
; a
&& a
->dispfrag
== 0; a
= a
->next_broken_word
)
200 a
->dispfrag
= frag_tmp
;
202 #endif /* WORKING_DOT_WORD */
204 if ((symbolP
= symbol_find (sym_name
)) != 0)
206 #ifdef RESOLVE_SYMBOL_REDEFINITION
207 if (RESOLVE_SYMBOL_REDEFINITION (symbolP
))
211 * Now check for undefined symbols
213 if (!S_IS_DEFINED (symbolP
))
215 if (S_GET_VALUE (symbolP
) == 0)
217 symbolP
->sy_frag
= frag_now
;
219 S_GET_OTHER(symbolP
) = const_flag
;
221 S_SET_VALUE (symbolP
, (valueT
) ((char*)obstack_next_free (&frags
) - frag_now
->fr_literal
));
222 S_SET_SEGMENT (symbolP
, now_seg
);
225 #endif /* if we have one, it better be zero. */
231 * There are still several cases to check:
232 * A .comm/.lcomm symbol being redefined as
233 * initialized data is OK
234 * A .comm/.lcomm symbol being redefined with
235 * a larger size is also OK
237 * This only used to be allowed on VMS gas, but Sun cc
238 * on the sparc also depends on it.
241 if (((!S_IS_DEBUG (symbolP
)
242 && !S_IS_DEFINED (symbolP
)
243 && S_IS_EXTERNAL (symbolP
))
244 || S_GET_SEGMENT (symbolP
) == bss_section
)
245 && (now_seg
== data_section
246 || now_seg
== S_GET_SEGMENT (symbolP
)))
249 * Select which of the 2 cases this is
251 if (now_seg
!= data_section
)
254 * New .comm for prev .comm symbol.
255 * If the new size is larger we just
256 * change its value. If the new size
257 * is smaller, we ignore this symbol
259 if (S_GET_VALUE (symbolP
)
260 < ((unsigned) frag_now_fix ()))
262 S_SET_VALUE (symbolP
, (valueT
) frag_now_fix ());
267 /* It is a .comm/.lcomm being converted to initialized
269 symbolP
->sy_frag
= frag_now
;
271 S_GET_OTHER(symbolP
) = const_flag
;
273 S_SET_VALUE (symbolP
, (valueT
) frag_now_fix ());
274 S_SET_SEGMENT (symbolP
, now_seg
); /* keep N_EXT bit */
279 #if defined (S_GET_OTHER) && defined (S_GET_DESC)
280 as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%d.%d.%ld.",
282 segment_name (S_GET_SEGMENT (symbolP
)),
283 S_GET_OTHER (symbolP
), S_GET_DESC (symbolP
),
284 (long) S_GET_VALUE (symbolP
));
286 as_fatal ("Symbol \"%s\" is already defined as \"%s\"/%d.",
288 segment_name (S_GET_SEGMENT (symbolP
)),
289 S_GET_VALUE (symbolP
));
292 } /* if the undefined symbol has no value */
296 /* Don't blow up if the definition is the same */
297 if (!(frag_now
== symbolP
->sy_frag
298 && S_GET_VALUE (symbolP
) == (char*)obstack_next_free (&frags
) - frag_now
->fr_literal
299 && S_GET_SEGMENT (symbolP
) == now_seg
))
300 as_fatal ("Symbol %s already defined.", sym_name
);
301 } /* if this symbol is not yet defined */
306 symbolP
= symbol_new (sym_name
,
308 (valueT
) ((char*)obstack_next_free (&frags
) - frag_now
->fr_literal
),
311 S_SET_OTHER (symbolP
, const_flag
);
314 symbol_table_insert (symbolP
);
315 } /* if we have seen this symbol before */
317 pa_define_label(symbolP
);
325 * symbol_table_insert()
327 * Die if we can't insert the symbol.
332 symbol_table_insert (symbolP
)
335 register char *error_string
;
338 know (S_GET_NAME (symbolP
));
340 if (*(error_string
= hash_jam (sy_hash
, S_GET_NAME (symbolP
), (char *) symbolP
)))
342 as_fatal ("Inserting \"%s\" into symbol table failed: %s",
343 S_GET_NAME (symbolP
), error_string
);
345 } /* symbol_table_insert() */
348 * symbol_find_or_make()
350 * If a symbol name does not exist, create it as undefined, and insert
351 * it into the symbol table. Return a pointer to it.
354 symbol_find_or_make (name
)
357 register symbolS
*symbolP
;
359 symbolP
= symbol_find (name
);
363 symbolP
= symbol_make (name
);
365 symbol_table_insert (symbolP
);
366 } /* if symbol wasn't found */
369 } /* symbol_find_or_make() */
377 /* Let the machine description default it, e.g. for register names. */
378 symbolP
= md_undefined_symbol ((char *) name
);
381 symbolP
= symbol_new (name
, undefined_section
, (valueT
) 0, &zero_address_frag
);
384 } /* symbol_make() */
389 * Implement symbol table lookup.
390 * In: A symbol's name as a string: '\0' can't be part of a symbol name.
391 * Out: NULL if the name was not in the symbol table, else the address
392 * of a struct symbol associated with that name.
399 #ifdef STRIP_UNDERSCORE
400 return (symbol_find_base (name
, 1));
401 #else /* STRIP_UNDERSCORE */
402 return (symbol_find_base (name
, 0));
403 #endif /* STRIP_UNDERSCORE */
404 } /* symbol_find() */
407 symbol_find_base (name
, strip_underscore
)
409 int strip_underscore
;
411 if (strip_underscore
&& *name
== '_')
413 return ((symbolS
*) hash_find (sy_hash
, name
));
417 * Once upon a time, symbols were kept in a singly linked list. At
418 * least coff needs to be able to rearrange them from time to time, for
419 * which a doubly linked list is much more convenient. Loic did these
420 * as macros which seemed dangerous to me so they're now functions.
424 /* Link symbol ADDME after symbol TARGET in the chain. */
426 symbol_append (addme
, target
, rootPP
, lastPP
)
434 know (*rootPP
== NULL
);
435 know (*lastPP
== NULL
);
439 } /* if the list is empty */
441 if (target
->sy_next
!= NULL
)
443 #ifdef SYMBOLS_NEED_BACKPOINTERS
444 target
->sy_next
->sy_previous
= addme
;
445 #endif /* SYMBOLS_NEED_BACKPOINTERS */
449 know (*lastPP
== target
);
451 } /* if we have a next */
453 addme
->sy_next
= target
->sy_next
;
454 target
->sy_next
= addme
;
456 #ifdef SYMBOLS_NEED_BACKPOINTERS
457 addme
->sy_previous
= target
;
458 #endif /* SYMBOLS_NEED_BACKPOINTERS */
461 #ifdef SYMBOLS_NEED_BACKPOINTERS
462 /* Remove SYMBOLP from the list. */
464 symbol_remove (symbolP
, rootPP
, lastPP
)
469 if (symbolP
== *rootPP
)
471 *rootPP
= symbolP
->sy_next
;
472 } /* if it was the root */
474 if (symbolP
== *lastPP
)
476 *lastPP
= symbolP
->sy_previous
;
477 } /* if it was the tail */
479 if (symbolP
->sy_next
!= NULL
)
481 symbolP
->sy_next
->sy_previous
= symbolP
->sy_previous
;
484 if (symbolP
->sy_previous
!= NULL
)
486 symbolP
->sy_previous
->sy_next
= symbolP
->sy_next
;
490 verify_symbol_chain (*rootPP
, *lastPP
);
494 /* Set the chain pointers of SYMBOL to null. */
496 symbol_clear_list_pointers (symbolP
)
499 symbolP
->sy_next
= NULL
;
500 symbolP
->sy_previous
= NULL
;
503 /* Link symbol ADDME before symbol TARGET in the chain. */
505 symbol_insert (addme
, target
, rootPP
, lastPP
)
511 if (target
->sy_previous
!= NULL
)
513 target
->sy_previous
->sy_next
= addme
;
517 know (*rootPP
== target
);
521 addme
->sy_previous
= target
->sy_previous
;
522 target
->sy_previous
= addme
;
523 addme
->sy_next
= target
;
526 verify_symbol_chain (*rootPP
, *lastPP
);
530 #endif /* SYMBOLS_NEED_BACKPOINTERS */
533 verify_symbol_chain (rootP
, lastP
)
537 symbolS
*symbolP
= rootP
;
542 for (; symbol_next (symbolP
) != NULL
; symbolP
= symbol_next (symbolP
))
544 #ifdef SYMBOLS_NEED_BACKPOINTERS
545 know (symbolP
->sy_next
->sy_previous
== symbolP
);
547 /* Walk the list anyways, to make sure pointers are still good. */
549 #endif /* SYMBOLS_NEED_BACKPOINTERS */
552 assert (lastP
== symbolP
);
556 verify_symbol_chain_2 (sym
)
559 symbolS
*p
= sym
, *n
= sym
;
560 #ifdef SYMBOLS_NEED_BACKPOINTERS
561 while (symbol_previous (p
))
562 p
= symbol_previous (p
);
564 while (symbol_next (n
))
566 verify_symbol_chain (p
, n
);
569 #ifdef LOCAL_LABELS_DOLLAR
571 /* Dollar labels look like a number followed by a dollar sign. Eg, "42$".
572 They are *really* local. That is, they go out of scope whenever we see a
573 label that isn't local. Also, like fb labels, there can be multiple
574 instances of a dollar label. Therefor, we name encode each instance with
575 the instance number, keep a list of defined symbols separate from the real
576 symbol table, and we treat these buggers as a sparse array. */
578 static long *dollar_labels
;
579 static long *dollar_label_instances
;
580 static char *dollar_label_defines
;
581 static long dollar_label_count
;
582 static long dollar_label_max
;
585 dollar_label_defined (label
)
590 know ((dollar_labels
!= NULL
) || (dollar_label_count
== 0));
592 for (i
= dollar_labels
; i
< dollar_labels
+ dollar_label_count
; ++i
)
594 return dollar_label_defines
[i
- dollar_labels
];
596 /* if we get here, label isn't defined */
598 } /* dollar_label_defined() */
601 dollar_label_instance (label
)
606 know ((dollar_labels
!= NULL
) || (dollar_label_count
== 0));
608 for (i
= dollar_labels
; i
< dollar_labels
+ dollar_label_count
; ++i
)
610 return (dollar_label_instances
[i
- dollar_labels
]);
612 /* If we get here, we haven't seen the label before, therefore its instance
618 dollar_label_clear ()
620 memset (dollar_label_defines
, '\0', dollar_label_count
);
623 #define DOLLAR_LABEL_BUMP_BY 10
626 define_dollar_label (label
)
631 for (i
= dollar_labels
; i
< dollar_labels
+ dollar_label_count
; ++i
)
634 ++dollar_label_instances
[i
- dollar_labels
];
635 dollar_label_defines
[i
- dollar_labels
] = 1;
639 /* if we get to here, we don't have label listed yet. */
641 if (dollar_labels
== NULL
)
643 dollar_labels
= (long *) xmalloc (DOLLAR_LABEL_BUMP_BY
* sizeof (long));
644 dollar_label_instances
= (long *) xmalloc (DOLLAR_LABEL_BUMP_BY
* sizeof (long));
645 dollar_label_defines
= xmalloc (DOLLAR_LABEL_BUMP_BY
);
646 dollar_label_max
= DOLLAR_LABEL_BUMP_BY
;
647 dollar_label_count
= 0;
649 else if (dollar_label_count
== dollar_label_max
)
651 dollar_label_max
+= DOLLAR_LABEL_BUMP_BY
;
652 dollar_labels
= (long *) xrealloc ((char *) dollar_labels
,
653 dollar_label_max
* sizeof (long));
654 dollar_label_instances
= (long *) xrealloc ((char *) dollar_label_instances
,
655 dollar_label_max
* sizeof (long));
656 dollar_label_defines
= xrealloc (dollar_label_defines
, dollar_label_max
);
657 } /* if we needed to grow */
659 dollar_labels
[dollar_label_count
] = label
;
660 dollar_label_instances
[dollar_label_count
] = 1;
661 dollar_label_defines
[dollar_label_count
] = 1;
662 ++dollar_label_count
;
666 * dollar_label_name()
668 * Caller must copy returned name: we re-use the area for the next name.
670 * The mth occurence of label n: is turned into the symbol "Ln^Am"
671 * where n is the label number and m is the instance number. "L" makes
672 * it a label discarded unless debugging and "^A"('\1') ensures no
673 * ordinary symbol SHOULD get the same name as a local label
674 * symbol. The first "4:" is "L4^A1" - the m numbers begin at 1.
676 * fb labels get the same treatment, except that ^B is used in place of ^A.
679 char * /* Return local label name. */
680 dollar_label_name (n
, augend
)
681 register long n
; /* we just saw "n$:" : n a number */
682 register int augend
; /* 0 for current instance, 1 for new instance */
685 /* Returned to caller, then copied. used for created names ("4f") */
686 static char symbol_name_build
[24];
689 char symbol_name_temporary
[20]; /* build up a number, BACKWARDS */
692 know (augend
== 0 || augend
== 1);
693 p
= symbol_name_build
;
696 /* Next code just does sprintf( {}, "%d", n); */
698 q
= symbol_name_temporary
;
699 for (*q
++ = 0, i
= n
; i
; ++q
)
704 while ((*p
= *--q
) != '\0')
709 /* instance number */
710 q
= symbol_name_temporary
;
711 for (*q
++ = 0, i
= dollar_label_instance (n
) + augend
; i
; ++q
)
716 while ((*p
++ = *--q
) != '\0');;
718 /* The label, as a '\0' ended string, starts at symbol_name_build. */
719 return symbol_name_build
;
722 #endif /* LOCAL_LABELS_DOLLAR */
724 #ifdef LOCAL_LABELS_FB
727 * Sombody else's idea of local labels. They are made by "n:" where n
728 * is any decimal digit. Refer to them with
729 * "nb" for previous (backward) n:
730 * or "nf" for next (forward) n:.
732 * We do a little better and let n be any number, not just a single digit, but
733 * since the other guy's assembler only does ten, we treat the first ten
736 * Like someone else's assembler, we have one set of local label counters for
737 * entire assembly, not one set per (sub)segment like in most assemblers. This
738 * implies that one can refer to a label in another segment, and indeed some
739 * crufty compilers have done just that.
741 * Since there could be a LOT of these things, treat them as a sparse array.
744 #define FB_LABEL_SPECIAL (10)
746 static long fb_low_counter
[FB_LABEL_SPECIAL
];
747 static long *fb_labels
;
748 static long *fb_label_instances
;
749 static long fb_label_count
= 0;
750 static long fb_label_max
= 0;
752 /* this must be more than FB_LABEL_SPECIAL */
753 #define FB_LABEL_BUMP_BY (FB_LABEL_SPECIAL + 6)
758 memset ((void *) fb_low_counter
, '\0', sizeof (fb_low_counter
));
759 } /* fb_label_init() */
761 /* add one to the instance number of this fb label */
763 fb_label_instance_inc (label
)
768 if (label
< FB_LABEL_SPECIAL
)
770 ++fb_low_counter
[label
];
774 if (fb_labels
!= NULL
)
776 for (i
= fb_labels
+ FB_LABEL_SPECIAL
;
777 i
< fb_labels
+ fb_label_count
; ++i
)
781 ++fb_label_instances
[i
- fb_labels
];
783 } /* if we find it */
784 } /* for each existing label */
787 /* if we get to here, we don't have label listed yet. */
789 if (fb_labels
== NULL
)
791 fb_labels
= (long *) xmalloc (FB_LABEL_BUMP_BY
* sizeof (long));
792 fb_label_instances
= (long *) xmalloc (FB_LABEL_BUMP_BY
* sizeof (long));
793 fb_label_max
= FB_LABEL_BUMP_BY
;
794 fb_label_count
= FB_LABEL_SPECIAL
;
797 else if (fb_label_count
== fb_label_max
)
799 fb_label_max
+= FB_LABEL_BUMP_BY
;
800 fb_labels
= (long *) xrealloc ((char *) fb_labels
,
801 fb_label_max
* sizeof (long));
802 fb_label_instances
= (long *) xrealloc ((char *) fb_label_instances
,
803 fb_label_max
* sizeof (long));
804 } /* if we needed to grow */
806 fb_labels
[fb_label_count
] = label
;
807 fb_label_instances
[fb_label_count
] = 1;
810 } /* fb_label_instance_inc() */
813 fb_label_instance (label
)
818 if (label
< FB_LABEL_SPECIAL
)
820 return (fb_low_counter
[label
]);
823 if (fb_labels
!= NULL
)
825 for (i
= fb_labels
+ FB_LABEL_SPECIAL
;
826 i
< fb_labels
+ fb_label_count
; ++i
)
830 return (fb_label_instances
[i
- fb_labels
]);
831 } /* if we find it */
832 } /* for each existing label */
835 /* We didn't find the label, so this must be a reference to the
843 * Caller must copy returned name: we re-use the area for the next name.
845 * The mth occurence of label n: is turned into the symbol "Ln^Bm"
846 * where n is the label number and m is the instance number. "L" makes
847 * it a label discarded unless debugging and "^B"('\2') ensures no
848 * ordinary symbol SHOULD get the same name as a local label
849 * symbol. The first "4:" is "L4^B1" - the m numbers begin at 1.
851 * dollar labels get the same treatment, except that ^A is used in place of ^B. */
853 char * /* Return local label name. */
854 fb_label_name (n
, augend
)
855 long n
; /* we just saw "n:", "nf" or "nb" : n a number */
856 long augend
; /* 0 for nb, 1 for n:, nf */
859 /* Returned to caller, then copied. used for created names ("4f") */
860 static char symbol_name_build
[24];
863 char symbol_name_temporary
[20]; /* build up a number, BACKWARDS */
866 know (augend
== 0 || augend
== 1);
867 p
= symbol_name_build
;
870 /* Next code just does sprintf( {}, "%d", n); */
872 q
= symbol_name_temporary
;
873 for (*q
++ = 0, i
= n
; i
; ++q
)
878 while ((*p
= *--q
) != '\0')
883 /* instance number */
884 q
= symbol_name_temporary
;
885 for (*q
++ = 0, i
= fb_label_instance (n
) + augend
; i
; ++q
)
890 while ((*p
++ = *--q
) != '\0');;
892 /* The label, as a '\0' ended string, starts at symbol_name_build. */
893 return (symbol_name_build
);
894 } /* fb_label_name() */
896 #endif /* LOCAL_LABELS_FB */
900 * decode name that may have been generated by foo_label_name() above. If
901 * the name wasn't generated by foo_label_name(), then return it unaltered.
902 * This is used for error messages.
906 decode_local_label_name (s
)
914 const char *message_format
= "\"%d\" (instance number %d of a %s label)";
919 for (label_number
= 0, p
= s
+ 1; isdigit (*p
); ++p
)
921 label_number
= (10 * label_number
) + *p
- '0';
937 for (instance_number
= 0, p
= s
+ 1; isdigit (*p
); ++p
)
939 instance_number
= (10 * instance_number
) + *p
- '0';
942 symbol_decode
= obstack_alloc (¬es
, strlen (message_format
) + 30);
943 (void) sprintf (symbol_decode
, message_format
, label_number
,
944 instance_number
, type
);
946 return (symbol_decode
);
947 } /* decode_local_label_name() */
949 /* Get the value of a symbol. */
955 if (s
->sy_value
.X_seg
!= absolute_section
)
956 as_bad ("Attempt to get value of unresolved symbol");
957 return (valueT
) s
->sy_value
.X_add_number
;
960 /* Set the value of a symbol. */
967 s
->sy_value
.X_seg
= absolute_section
;
968 s
->sy_value
.X_add_number
= (offsetT
) val
;
977 flagword flags
= s
->bsym
->flags
;
980 if (flags
& BSF_LOCAL
&& flags
& (BSF_EXPORT
| BSF_GLOBAL
))
983 return (flags
& (BSF_EXPORT
| BSF_GLOBAL
)) != 0;
990 return s
->bsym
->section
== &bfd_com_section
;
997 return s
->bsym
->section
!= undefined_section
;
1004 if (s
->bsym
->flags
& BSF_DEBUGGING
)
1013 flagword flags
= s
->bsym
->flags
;
1016 if (flags
& BSF_LOCAL
&& flags
& (BSF_EXPORT
| BSF_GLOBAL
))
1019 return (S_GET_NAME (s
)
1021 && (strchr (S_GET_NAME (s
), '\001')
1022 || strchr (S_GET_NAME (s
), '\002')
1023 || (S_LOCAL_NAME (s
)
1024 && !flagseen
['L'])));
1031 return S_IS_EXTERNAL (s
);
1038 return S_GET_NAME (s
) == 0;
1045 return s
->bsym
->name
;
1052 return s
->bsym
->section
;
1056 S_SET_SEGMENT (s
, seg
)
1060 s
->bsym
->section
= seg
;
1067 s
->bsym
->flags
|= BSF_EXPORT
| BSF_GLOBAL
;
1068 s
->bsym
->flags
&= ~BSF_LOCAL
;
1072 S_CLEAR_EXTERNAL (s
)
1075 s
->bsym
->flags
|= BSF_LOCAL
;
1076 s
->bsym
->flags
&= ~(BSF_EXPORT
| BSF_GLOBAL
);
1080 S_SET_NAME (s
, name
)
1084 s
->bsym
->name
= name
;
1086 #endif /* BFD_ASSEMBLER */
1088 /* end of symbols.c */
This page took 0.052585 seconds and 4 git commands to generate.