1 /* symbols.c -symbol table-
2 Copyright (C) 1987 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 #include "obstack.h" /* For "symbols.h" */
26 #include "struc-symbol.h"
35 #include "input-scrub.h"
36 #include "dwarf2dbg.h"
38 /* symbol-name => struct symbol pointer */
39 struct hash_control
*sy_hash
= NULL
;
41 /* FixS & symbols live here */
42 struct obstack notes
= { 0 };
44 /* all the symbol nodes */
45 symbolS
*symbol_rootP
= NULL
;
46 /* last struct symbol we made, or NULL */
47 symbolS
*symbol_lastP
= NULL
;
48 /* The last symbol we assigned an index to. */
49 symbolS
*symbol_lastIndexedP
= NULL
;
51 symbolS abs_symbol
= { {{0}} };
54 * Un*x idea of local labels. They are made by "n:" where n
55 * is any decimal digit. Refer to them with
56 * "nb" for previous (backward) n:
57 * or "nf" for next (forward) n:.
59 * Like Un*x AS, we have one set of local label counters for entire assembly,
60 * not one set per (sub)segment like in most assemblers. This implies that
61 * one can refer to a label in another segment, and indeed some crufty
62 * compilers have done just that.
64 * I document the symbol names here to save duplicating words elsewhere.
65 * The mth occurence of label n: is turned into the symbol "Ln^Am" where
66 * n is a digit and m is a decimal number. "L" makes it a label discarded
67 * unless debugging and "^A"('\1') ensures no ordinary symbol SHOULD get the
68 * same name as a local label symbol. The first "4:" is "L4^A1" - the m
72 typedef short unsigned int local_label_countT
;
74 static void make_stab_for_symbol(
77 static void make_subprogram_for_symbol(
80 static void fb_label_init(void);
88 symbol_rootP
= NULL
; /* In case we have 0 symbols (!!) */
90 memset((char *)(&abs_symbol
), '\0', sizeof(abs_symbol
));
91 abs_symbol
.sy_type
= N_ABS
; /* Can't initialise a union. Sigh. */
96 /* Somebody else's idea of local labels. They are made by "n:" where n
97 is any decimal digit. Refer to them with
98 "nb" for previous (backward) n:
99 or "nf" for next (forward) n:.
101 We do a little better and let n be any number, not just a single digit, but
102 since the other guy's assembler only does ten, we treat the first ten
105 Like someone else's assembler, we have one set of local label counters for
106 entire assembly, not one set per (sub)segment like in most assemblers. This
107 implies that one can refer to a label in another segment, and indeed some
108 crufty compilers have done just that.
110 Since there could be a LOT of these things, treat them as a sparse
113 #define LOCAL_LABEL_CHAR '\002'
114 #define FB_LABEL_SPECIAL (10)
116 static int32_t fb_low_counter
[FB_LABEL_SPECIAL
];
117 static int32_t *fb_labels
;
118 static int32_t *fb_label_instances
;
119 static int32_t fb_label_count
;
120 static int32_t fb_label_max
;
122 /* This must be more than FB_LABEL_SPECIAL. */
123 #define FB_LABEL_BUMP_BY (FB_LABEL_SPECIAL + 6)
128 memset ((void *) fb_low_counter
, '\0', sizeof (fb_low_counter
));
131 /* Add one to the instance number of this fb label. */
134 fb_label_instance_inc (int32_t label
)
138 if (label
< FB_LABEL_SPECIAL
)
140 ++fb_low_counter
[label
];
144 if (fb_labels
!= NULL
)
146 for (i
= fb_labels
+ FB_LABEL_SPECIAL
;
147 i
< fb_labels
+ fb_label_count
; ++i
)
151 ++fb_label_instances
[i
- fb_labels
];
153 } /* if we find it */
154 } /* for each existing label */
157 /* If we get to here, we don't have label listed yet. */
159 if (fb_labels
== NULL
)
161 fb_labels
= (int32_t *) xmalloc (FB_LABEL_BUMP_BY
* sizeof (int32_t));
162 fb_label_instances
= (int32_t *) xmalloc (FB_LABEL_BUMP_BY
* sizeof (int32_t));
163 fb_label_max
= FB_LABEL_BUMP_BY
;
164 fb_label_count
= FB_LABEL_SPECIAL
;
167 else if (fb_label_count
== fb_label_max
)
169 fb_label_max
+= FB_LABEL_BUMP_BY
;
170 fb_labels
= (int32_t *) xrealloc ((char *) fb_labels
,
171 fb_label_max
* sizeof (int32_t));
172 fb_label_instances
= (int32_t *) xrealloc ((char *) fb_label_instances
,
173 fb_label_max
* sizeof (int32_t));
174 } /* if we needed to grow */
176 fb_labels
[fb_label_count
] = label
;
177 fb_label_instances
[fb_label_count
] = 1;
182 fb_label_instance (int32_t label
)
186 if (label
< FB_LABEL_SPECIAL
)
188 return (fb_low_counter
[label
]);
191 if (fb_labels
!= NULL
)
193 for (i
= fb_labels
+ FB_LABEL_SPECIAL
;
194 i
< fb_labels
+ fb_label_count
; ++i
)
198 return (fb_label_instances
[i
- fb_labels
]);
199 } /* if we find it */
200 } /* for each existing label */
203 /* We didn't find the label, so this must be a reference to the
208 /* Caller must copy returned name: we re-use the area for the next name.
210 The mth occurence of label n: is turned into the symbol "Ln^Bm"
211 where n is the label number and m is the instance number. "L" makes
212 it a label discarded unless debugging and "^B"('\2') ensures no
213 ordinary symbol SHOULD get the same name as a local label
214 symbol. The first "4:" is "L4^B1" - the m numbers begin at 1. */
216 char * /* Return local label name. */
217 fb_label_name (int32_t n
, /* We just saw "n:", "nf" or "nb" : n a number. */
218 int32_t augend
/* 0 for nb, 1 for n:, nf. */)
221 /* Returned to caller, then copied. Used for created names ("4f"). */
222 static char symbol_name_build
[24];
225 char symbol_name_temporary
[20]; /* Build up a number, BACKWARDS. */
229 know ((uint32_t) augend
<= 2 /* See mmix_fb_label. */);
231 know ((uint32_t) augend
<= 1);
233 p
= symbol_name_build
;
234 #ifdef LOCAL_LABEL_PREFIX
235 *p
++ = LOCAL_LABEL_PREFIX
;
239 /* Next code just does sprintf( {}, "%d", n); */
241 q
= symbol_name_temporary
;
242 for (*q
++ = 0, i
= n
; i
; ++q
)
247 while ((*p
= *--q
) != '\0')
250 *p
++ = LOCAL_LABEL_CHAR
; /* ^B */
252 /* Instance number. */
253 q
= symbol_name_temporary
;
254 for (*q
++ = 0, i
= fb_label_instance (n
) + augend
; i
; ++q
)
259 while ((*p
++ = *--q
) != '\0');
261 /* The label, as a '\0' ended string, starts at symbol_name_build. */
262 return (symbol_name_build
);
265 /* Decode name that may have been generated by foo_label_name() above.
266 If the name wasn't generated by foo_label_name(), then return it
267 unaltered. This is used for error messages. */
270 decode_local_label_name (char *s
)
279 #ifdef LOCAL_LABEL_PREFIX
280 if (s
[index
] == LOCAL_LABEL_PREFIX
)
287 for (label_number
= 0, p
= s
+ index
+ 1; isdigit (*p
); ++p
)
288 label_number
= (10 * label_number
) + *p
- '0';
290 if (*p
== LOCAL_LABEL_CHAR
)
295 for (instance_number
= 0, p
++; isdigit (*p
); ++p
)
296 instance_number
= (10 * instance_number
) + *p
- '0';
298 #define MESSAGE_FORMAT "\"%d\" (instance number %d of a %s label)"
299 symbol_decode
= obstack_alloc (¬es
, strlen (MESSAGE_FORMAT
) + 30);
300 sprintf (symbol_decode
, MESSAGE_FORMAT
, label_number
, instance_number
, type
);
302 return symbol_decode
;
307 int n
) /* just saw "n:" */
309 fb_label_instance_inc (n
);
310 colon (fb_label_name (n
, 0), 1);
316 * Return a pointer to a new symbol.
317 * Die if we can't make a new symbol.
318 * Fill in the symbol's values.
319 * Add symbol to end of symbol chain.
322 * Please always call this to create a new symbol.
324 * Changes since 1985: Symbol names may not contain '\0'. Sigh.
328 char *name
, /* We copy this: OK to alter your copy. */
329 unsigned char type
, /* As in <nlist.h>. */
330 char other
, /* As in <nlist.h>. */
331 short desc
, /* As in <nlist.h>. */
332 valueT value
, /* As in <nlist.h>, often an address. */
333 /* Often used as offset from frag address. */
334 struct frag
*frag
) /* For sy_frag. */
336 register symbolS
* symbolP
;
337 register char * preserved_copy_of_name
;
338 register unsigned int name_length
;
341 name_length
= strlen(name
) + 1;
342 obstack_grow(¬es
,name
,name_length
);
343 p
=obstack_finish(¬es
);
344 /* obstack_1done( ¬es, name, name_length, &p ); */
345 preserved_copy_of_name
= p
;
346 p
=obstack_alloc(¬es
,sizeof(struct symbol
));
347 /* obstack_1blank( ¬es, sizeof(struct symbol), &p ); */
348 symbolP
= (symbolS
*) p
;
349 symbolP
-> sy_name
= preserved_copy_of_name
;
350 symbolP
-> sy_type
= type
;
351 symbolP
-> sy_other
= other
;
352 symbolP
-> sy_desc
= desc
;
353 symbolP
-> sy_value
= value
;
354 symbolP
-> sy_frag
= frag
;
355 symbolP
-> sy_prev_by_index
= NULL
; /* Don't know what this is yet. */
356 symbolP
-> sy_has_been_resolved
= 0;
357 symbolP
-> sy_next
= NULL
; /* End of chain. */
358 symbolP
-> sy_forward
= NULL
; /* JF */
359 symbolP
-> expression
= NULL
;
361 symbolP
-> sy_name_offset
= ~ 0; /* Impossible offset catches errors. */
362 symbolP
-> sy_number
= ~ 0; /* Ditto. */
365 * Link to end of symbol chain.
369 symbol_lastP
-> sy_next
= symbolP
;
373 symbol_rootP
= symbolP
;
375 symbol_lastP
= symbolP
;
382 symbol_create (const char *name
, /* It is copied, the caller can destroy/modify. */
383 segT segment
, /* Segment identifier (SEG_<something>). */
384 valueT valu
, /* Symbol value. */
385 fragS
*frag
/* Associated fragment. */)
388 return symbol_new ((char *)name
, 0, segment
, 0, valu
, frag
);
392 * symbol_assign_index()
394 * Assigns the next index to the given symbol.
396 * Asserts that the symbol has not been assigned an index yet.
401 struct symbol
*symbolP
)
403 if (symbolP
->sy_prev_by_index
!= NULL
)
405 as_fatal("symbol %s already has an index", symbolP
->sy_name
);
407 symbolP
->sy_prev_by_index
= symbol_lastIndexedP
;
408 symbol_lastIndexedP
= symbolP
;
414 * We have just seen "<name>:".
415 * Creates a struct symbol unless it already exists.
417 * Gripes if we are redefining a symbol incompatibly (and ignores it).
420 /* This is used to work around compiler optimizer bug #50416 */
421 static volatile unsigned int temp
;
424 colon( /* just seen "x:" - rattle symbols & frags */
425 char *sym_name
, /* symbol name, as a cannonical string */
426 /* We copy this string: OK to alter later. */
427 int local_colon
)/* non-zero if called from local_colon() */
429 register struct symbol
* symbolP
; /* symbol we are working with */
431 if (frchain_now
== NULL
)
434 as_fatal("with -n a section directive must be seen before assembly "
437 if (inlineasm_checks
&& local_colon
== 0)
439 if (inlineasm_file_name
)
440 as_warn_where_with_column(inlineasm_file_name
, inlineasm_line_number
,
441 inlineasm_column_number
, "label definition in inlineasm");
443 as_bad("label definition in inlineasm");
445 if ((symbolP
= symbol_table_lookup( sym_name
)))
448 * Now check for undefined symbols
450 if ((symbolP
-> sy_type
& N_TYPE
) == N_UNDF
)
452 temp
= symbolP
->sy_desc
;
453 if( symbolP
-> sy_other
== 0
454 /* bug #50416 -O causes this not to work for:
455 && ((symbolP->sy_desc) & (~REFERENCE_TYPE)) == 0
457 && (temp
& (~(REFERENCE_TYPE
| N_WEAK_REF
| N_WEAK_DEF
|
458 N_ARM_THUMB_DEF
| N_SYMBOL_RESOLVER
|
459 N_NO_DEAD_STRIP
| REFERENCED_DYNAMICALLY
))) == 0
460 && symbolP
-> sy_value
== 0)
462 symbolP
-> sy_frag
= frag_now
;
463 symbolP
-> sy_value
= obstack_next_free(& frags
) - frag_now
-> fr_literal
;
465 symbolP
-> sy_type
|= N_SECT
; /* keep N_EXT bit */
466 symbolP
-> sy_other
= frchain_now
->frch_nsect
;
467 symbolP
-> sy_desc
&= ~REFERENCE_TYPE
;
468 symbolP
-> sy_desc
&= ~(N_WEAK_REF
& N_WEAK_DEF
);
469 symbol_assign_index(symbolP
);
470 #ifdef NeXT_MOD /* generate stabs for debugging assembly code */
472 make_stab_for_symbol(symbolP
);
474 if(debug_type
== DEBUG_DWARF2
)
475 make_subprogram_for_symbol(symbolP
);
479 as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.%d."
482 seg_name
[(int) N_TYPE_seg
[symbolP
-> sy_type
& N_TYPE
]],
483 symbolP
-> sy_other
, symbolP
-> sy_desc
,
484 symbolP
-> sy_value
);
489 as_fatal("Symbol %s already defined.",sym_name
);
494 symbolP
= symbol_new (sym_name
,
496 frchain_now
->frch_nsect
,
498 (valueT
)(obstack_next_free(&frags
)-frag_now
->fr_literal
),
500 symbol_table_insert (symbolP
);
501 symbol_assign_index (symbolP
);
502 #ifdef NeXT_MOD /* generate stabs for debugging assembly code */
504 make_stab_for_symbol(symbolP
);
506 if(debug_type
== DEBUG_DWARF2
)
507 make_subprogram_for_symbol(symbolP
);
510 tc_frob_label(symbolP
);
516 * symbol_table_insert()
518 * Die if we can't insert the symbol.
523 struct symbol
*symbolP
)
525 const char * error_string
;
528 know( symbolP
-> sy_name
);
529 error_string
= hash_jam (sy_hash
, symbolP
-> sy_name
, (char *)symbolP
);
530 if (error_string
!= NULL
&& error_string
[0] != '\0')
532 as_fatal( "Inserting \"%s\" into symbol table failed: %s",
533 symbolP
-> sy_name
, error_string
);
538 * symbol_find_or_make()
540 * If a symbol name does not exist, create it as undefined, and insert
541 * it into the symbol table. Return a pointer to it.
547 register symbolS
* symbolP
;
549 symbolP
= symbol_table_lookup (name
);
552 symbolP
= symbol_new (name
, N_UNDF
, 0, 0, 0, & zero_address_frag
);
553 symbol_table_insert (symbolP
);
561 * Implement symbol table lookup.
562 * In: A symbol's name as a string: '\0' can't be part of a symbol name.
563 * Out: NULL if the name was not in the symbol table, else the address
564 * of a struct symbol associated with that name.
570 return ( (symbolS
*) hash_find( sy_hash
, name
));
574 * symbol_table_lookup()
576 * Same as symbol_find() except assumes the symbol is being looked up and is
577 * a non-lazy symbol reference.
583 register symbolS
* symbolP
;
585 symbolP
= (symbolS
*) hash_find( sy_hash
, name
);
587 symbolP
->sy_desc
&= ~REFERENCE_FLAG_UNDEFINED_LAZY
;
591 #ifdef NeXT_MOD /* generate stabs for debugging assembly code */
593 * make_stab_for_symbol() is called when -g is present for a label that is
594 * being defined. If the label is a text label and in the (__TEXT,__text)
595 * section and not a local label create a stab for it.
597 * See the detailed comments about stabs in read_a_source_file() for a
598 * description of what is going on here.
602 make_stab_for_symbol(
609 if(symbolP
->sy_name
[0] == 'L')
611 if((symbolP
->sy_type
& N_TYPE
) != N_SECT
)
613 if(symbolP
->sy_other
!= text_nsect
)
616 stabnamelen
= strlen(symbolP
->sy_name
) + sizeof(":f3");
617 stabname
= xmalloc(stabnamelen
);
618 strcpy(stabname
, symbolP
->sy_name
);
619 if(symbolP
->sy_type
& N_EXT
)
620 strcat(stabname
, ":F3");
622 strcat(stabname
, ":f3");
627 text_nsect
, /* n_sect */
628 logical_input_line
, /* n_desc, line number */
633 #endif /* NeXT generate stabs for debugging assembly code */
636 * make_subprogram_for_symbol() gathers the info that is needed for each
637 * symbol that will have a dwarf2_subprogram when generating dwarf debugging
638 * info for assembly files.
642 make_subprogram_for_symbol(
645 struct dwarf2_subprogram_info
*i
;
646 static struct dwarf2_subprogram_info
*last_dwarf2_subprogram_info
= NULL
;
648 if(symbolP
->sy_name
[0] == 'L')
650 if((symbolP
->sy_type
& N_TYPE
) != N_SECT
)
652 if(symbolP
->sy_other
!= text_nsect
)
655 i
= xmalloc(sizeof(struct dwarf2_subprogram_info
));
656 i
->name
= symbolP
->sy_name
;
657 if(i
->name
[0] == '_')
659 i
->file_number
= dwarf2_file_number
;
660 i
->line_number
= logical_input_line
;
662 * We can't used the symbolP directly as it may have the N_ARM_THUMB_DEF
663 * bit set. And that will cause the AT_high_pc and AT_low_pc values to
664 * have the low bit set after relocation producing bad dwarf. So we
665 * create a temporary symbol that will not have the N_ARM_THUMB_DEF bit
668 i
->symbol
= symbol_temp_new(symbolP
->sy_other
, symbolP
->sy_value
,
671 if(dwarf2_subprograms_info
== NULL
){
672 dwarf2_subprograms_info
= i
;
673 last_dwarf2_subprogram_info
= i
;
676 last_dwarf2_subprogram_info
->next
= i
;
677 last_dwarf2_subprogram_info
= i
;
682 * indirect_symbol_new()
684 * Return a pointer to a new indirect_symbol.
685 * Die if we can't make a new indirect_symbol.
686 * Fill in the indirect_symbol's values.
687 * Add symbol to end of section's indirect symbol chain.
691 char *name
, /* We copy this: OK to alter your copy. */
692 struct frag
*frag
, /* For sy_frag. */
693 uint32_t offset
) /* Offset from frag address. */
696 char *preserved_copy_of_name
;
697 uint32_t name_length
;
699 struct frag
*fr_next
;
701 #ifdef CHECK_INDIRECTS
702 uint32_t stride
, fr_fix
;
706 * First see if the last frag recorded for an indirect symbol turned
707 * out to be zero sized then changed that recorded frag to the next
708 * non-zero frag in the list. I think this happens because we record
709 * the frag before we fill it and if we run out of space that frag gets
710 * a zero size and a new one is created.
712 if(frchain_now
->frch_isym_last
!= NULL
&&
713 frchain_now
->frch_isym_last
->isy_frag
->fr_fix
== 0){
714 if(frchain_now
->frch_isym_last
->isy_frag
->fr_next
!= NULL
){
715 fr_next
= frchain_now
->frch_isym_last
->isy_frag
->fr_next
;
716 while(fr_next
->fr_fix
== 0 &&
717 fr_next
->fr_type
== rs_fill
&&
718 fr_next
->fr_next
!= NULL
)
719 fr_next
= fr_next
->fr_next
;
720 frchain_now
->frch_isym_last
->isy_frag
= fr_next
;
724 name_length
= strlen(name
) + 1;
725 obstack_grow(¬es
, name
, name_length
);
726 p
= obstack_finish(¬es
);
727 preserved_copy_of_name
= p
;
728 p
= obstack_alloc(¬es
, sizeof(struct indirect_symbol
));
729 isymbolP
= (isymbolS
*)p
;
730 isymbolP
->isy_name
= preserved_copy_of_name
;
731 isymbolP
->isy_offset
= offset
;
732 isymbolP
->isy_frag
= frag
;
733 isymbolP
->isy_next
= NULL
; /* End of chain. */
734 isymbolP
->isy_symbol
= NULL
;
737 * Link to end of indirect symbol chain and check for missing indirect
740 if(frchain_now
->frch_isym_root
== NULL
){
741 #ifdef CHECK_INDIRECTS
743 as_bad("missing or bad indirect symbol for section (%s,%s)",
744 frchain_now
->frch_section
.segname
,
745 frchain_now
->frch_section
.sectname
);
747 frchain_now
->frch_isym_root
= isymbolP
;
748 frchain_now
->frch_isym_last
= isymbolP
;
751 #ifdef CHECK_INDIRECTS
752 if((frchain_now
->frch_section
.flags
& SECTION_TYPE
) ==
754 stride
= frchain_now
->frch_section
.reserved2
;
756 stride
= sizeof(uint32_t);
757 if(frag
== frchain_now
->frch_isym_last
->isy_frag
){
758 if(offset
- frchain_now
->frch_isym_last
->isy_offset
!= stride
)
759 as_bad("missing or bad indirect symbol for section "
760 "(%s,%s)", frchain_now
->frch_section
.segname
,
761 frchain_now
->frch_section
.sectname
);
764 if(frchain_now
->frch_isym_last
->isy_frag
->fr_fix
< stride
){
766 fr_next
= frchain_now
->frch_isym_last
->isy_frag
;
767 while(fr_fix
+ fr_next
->fr_fix
< stride
&&
768 fr_next
->fr_type
== rs_fill
&&
769 fr_next
->fr_next
!= NULL
){
770 fr_fix
+= fr_next
->fr_fix
;
771 fr_next
= fr_next
->fr_next
;
773 if(frag
!= fr_next
->fr_next
||
774 fr_fix
+ fr_next
->fr_fix
!= stride
||
776 as_bad("missing or bad indirect symbol for section "
777 "(%s,%s)", frchain_now
->frch_section
.segname
,
778 frchain_now
->frch_section
.sectname
);
781 fr_next
= frchain_now
->frch_isym_last
->isy_frag
->fr_next
;
783 * Because of section changes there maybe some zero length
784 * frags after the last one that passed through here. So
785 * skip them and get to the last real one.
787 while(fr_next
->fr_fix
== 0 &&
788 fr_next
->fr_type
== rs_fill
&&
789 fr_next
->fr_next
!= NULL
)
790 fr_next
= fr_next
->fr_next
;
791 if(frag
!= fr_next
|| offset
!= 0)
792 as_bad("missing or bad indirect symbol for section "
793 "(%s,%s)", frchain_now
->frch_section
.segname
,
794 frchain_now
->frch_section
.sectname
);
798 frchain_now
->frch_isym_last
->isy_next
= isymbolP
;
799 frchain_now
->frch_isym_last
= isymbolP
;
801 if((frchain_now
->frch_section
.flags
& SECTION_TYPE
) ==
802 S_NON_LAZY_SYMBOL_POINTERS
){
803 symbolP
= (symbolS
*)hash_find(sy_hash
, name
);
805 symbolP
->sy_desc
&= ~REFERENCE_FLAG_UNDEFINED_LAZY
;
811 S_GET_NAME (symbolS
*s
)
817 S_IS_DEFINED (symbolS
*s
)
819 return (s
->sy_type
& N_TYPE
) != N_UNDF
;
823 #ifdef TC_SYMFIELD_TYPE
825 /* Get a pointer to the processor information for a symbol. */
828 symbol_get_tc (symbolS
*s
)
833 /* Set the processor information for a symbol. */
836 symbol_set_tc (symbolS
*s
, TC_SYMFIELD_TYPE
*o
)
841 #endif /* TC_SYMFIELD_TYPE */
844 S_IS_LOCAL (symbolS
*s
)
848 name
= S_GET_NAME (s
);
852 if(name
[0] == 'L' && flagseen
['L'] == FALSE
)
859 symbol_get_frag (symbolS
*s
)
865 * symbol_temp_new(), symbol_temp_new_now() are used by dwarf2dbg.c to make
866 * symbols in dwarf sections. symbol_temp_make() is used to make an undefined
867 * symbol that its values are later set by symbol_set_value_now() to the current
868 * address in a dwarf section.
870 * These are used in expressions, so the expression values can be put out in
871 * dwarf section contents.
879 return(symbol_new(FAKE_LABEL_NAME
, N_SECT
, nsect
, 0, value
, frag
));
883 symbol_temp_new_now(void)
885 return(symbol_temp_new(now_seg
, frag_now_fix(), frag_now
));
889 symbol_temp_make(void)
891 return(symbol_new(FAKE_LABEL_NAME
, N_UNDF
, 0, 0, 0, & zero_address_frag
));
894 /* Set the value of SYM to the current position in the current segment. */
896 symbol_set_value_now(
899 sym
->sy_type
= N_SECT
;
900 sym
->sy_other
= now_seg
;
901 sym
->sy_value
= frag_now_fix();
902 sym
->sy_frag
= frag_now
;