Coverage Report

Created: 2025-06-24 06:45

/src/binutils-gdb/gas/symbols.h
Line
Count
Source (jump to first uncovered line)
1
/* symbols.h -
2
   Copyright (C) 1987-2025 Free Software Foundation, Inc.
3
4
   This file is part of GAS, the GNU Assembler.
5
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 3, or (at your option)
9
   any later version.
10
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.
15
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 the Free
18
   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19
   02110-1301, USA.  */
20
21
#ifndef GAS_SYMBOLS_H
22
#define GAS_SYMBOLS_H
23
24
extern struct obstack notes;  /* eg FixS live here.  */
25
26
extern struct obstack cond_obstack; /* this is where we track .ifdef/.endif
27
               (if we do that at all).  */
28
29
extern symbolS *symbol_rootP; /* all the symbol nodes */
30
extern symbolS *symbol_lastP; /* last struct symbol we made, or NULL */
31
32
extern symbolS abs_symbol;
33
extern symbolS dot_symbol;
34
35
extern int symbol_table_frozen;
36
37
/* This is non-zero if symbols are case sensitive, which is the
38
   default.  */
39
extern int symbols_case_sensitive;
40
41
extern void *notes_alloc (size_t);
42
extern void *notes_calloc (size_t, size_t);
43
extern void *notes_memdup (const void *, size_t, size_t);
44
extern char *notes_strdup (const char *);
45
extern char *notes_concat (const char *, ...);
46
extern void notes_free (void *);
47
48
static inline char *
49
notes_memdup0 (const char *in, size_t len)
50
0
{
51
0
  return notes_memdup (in, len, len + 1);
52
0
}
Unexecuted instantiation: fuzz_as.c:notes_memdup0
Unexecuted instantiation: codeview.c:notes_memdup0
Unexecuted instantiation: cond.c:notes_memdup0
Unexecuted instantiation: depend.c:notes_memdup0
Unexecuted instantiation: dw2gencfi.c:notes_memdup0
Unexecuted instantiation: dwarf2dbg.c:notes_memdup0
Unexecuted instantiation: ehopt.c:notes_memdup0
Unexecuted instantiation: expr.c:notes_memdup0
Unexecuted instantiation: frags.c:notes_memdup0
Unexecuted instantiation: gen-sframe.c:notes_memdup0
Unexecuted instantiation: input-scrub.c:notes_memdup0
Unexecuted instantiation: listing.c:notes_memdup0
Unexecuted instantiation: macro.c:notes_memdup0
Unexecuted instantiation: messages.c:notes_memdup0
Unexecuted instantiation: output-file.c:notes_memdup0
Unexecuted instantiation: read.c:notes_memdup0
Unexecuted instantiation: remap.c:notes_memdup0
Unexecuted instantiation: sb.c:notes_memdup0
Unexecuted instantiation: scfidw2gen.c:notes_memdup0
Unexecuted instantiation: stabs.c:notes_memdup0
Unexecuted instantiation: subsegs.c:notes_memdup0
Unexecuted instantiation: symbols.c:notes_memdup0
Unexecuted instantiation: write.c:notes_memdup0
Unexecuted instantiation: app.c:notes_memdup0
Unexecuted instantiation: atof-generic.c:notes_memdup0
Unexecuted instantiation: ecoff.c:notes_memdup0
Unexecuted instantiation: flonum-copy.c:notes_memdup0
Unexecuted instantiation: ginsn.c:notes_memdup0
Unexecuted instantiation: hash.c:notes_memdup0
Unexecuted instantiation: input-file.c:notes_memdup0
Unexecuted instantiation: scfi.c:notes_memdup0
Unexecuted instantiation: sframe-opt.c:notes_memdup0
Unexecuted instantiation: tc-i386.c:notes_memdup0
Unexecuted instantiation: obj-elf.c:notes_memdup0
Unexecuted instantiation: atof-ieee.c:notes_memdup0
53
54
char * symbol_relc_make_expr  (expressionS *);
55
char * symbol_relc_make_sym   (symbolS *);
56
char * symbol_relc_make_value (offsetT);
57
char *decode_local_label_name (char *s);
58
symbolS *symbol_find (const char *name);
59
symbolS *symbol_find_noref (const char *name, int noref);
60
symbolS *symbol_find_exact (const char *name);
61
symbolS *symbol_find_exact_noref (const char *name, int noref);
62
symbolS *symbol_find_or_make (const char *name);
63
symbolS *symbol_make (const char *name);
64
symbolS *symbol_new (const char *, segT, fragS *, valueT);
65
symbolS *symbol_create (const char *, segT, fragS *, valueT);
66
struct local_symbol *local_symbol_make (const char *, segT, fragS *, valueT);
67
symbolS *symbol_clone (symbolS *, int);
68
#undef symbol_clone_if_forward_ref
69
symbolS *symbol_clone_if_forward_ref (symbolS *, int);
70
614k
#define symbol_clone_if_forward_ref(s) symbol_clone_if_forward_ref (s, 0)
71
symbolS *symbol_temp_new (segT, fragS *, valueT);
72
symbolS *symbol_temp_new_now (void);
73
symbolS *symbol_temp_new_now_octets (void);
74
symbolS *symbol_temp_make (void);
75
76
symbolS *colon (const char *sym_name);
77
void local_colon (int n);
78
void symbol_begin (void);
79
void symbol_end (void);
80
void dot_symbol_init (void);
81
void symbol_print_statistics (FILE *);
82
void symbol_table_insert (symbolS * symbolP);
83
valueT resolve_symbol_value (symbolS *);
84
void resolve_local_symbol_values (void);
85
int snapshot_symbol (symbolS **, valueT *, segT *, fragS **);
86
87
void print_symbol_value (symbolS *);
88
void print_expr (expressionS *);
89
void print_expr_1 (FILE *, expressionS *);
90
void print_symbol_value_1 (FILE *, symbolS *);
91
92
int dollar_label_defined (unsigned int);
93
void dollar_label_clear (void);
94
void define_dollar_label (unsigned int);
95
char *dollar_label_name (unsigned int, unsigned int);
96
97
void fb_label_instance_inc (unsigned int);
98
char *fb_label_name (unsigned int, unsigned int);
99
100
extern void copy_symbol_attributes (symbolS *, symbolS *);
101
102
/* Get and set the values of symbols.  These used to be macros.  */
103
extern valueT S_GET_VALUE (symbolS *);
104
extern valueT S_GET_VALUE_WHERE (symbolS *, const char *, unsigned int);
105
extern void S_SET_VALUE (symbolS *, valueT);
106
107
extern int S_IS_FUNCTION (const symbolS *);
108
extern int S_IS_EXTERNAL (const symbolS *);
109
extern int S_IS_WEAK (const symbolS *);
110
extern int S_IS_WEAKREFR (const symbolS *);
111
extern int S_IS_WEAKREFD (const symbolS *);
112
extern int S_IS_COMMON (const symbolS *);
113
extern int S_IS_DEFINED (const symbolS *);
114
extern int S_FORCE_RELOC (const symbolS *, int);
115
extern int S_IS_DEBUG (const symbolS *);
116
extern int S_IS_LOCAL (const symbolS *);
117
extern int S_IS_STABD (const symbolS *);
118
extern int S_CAN_BE_REDEFINED (const symbolS *);
119
extern int S_IS_VOLATILE (const symbolS *);
120
extern int S_IS_FORWARD_REF (const symbolS *);
121
extern const char *S_GET_NAME (const symbolS *);
122
extern segT S_GET_SEGMENT (const symbolS *);
123
extern void S_SET_SEGMENT (symbolS *, segT);
124
extern void S_SET_EXTERNAL (symbolS *);
125
extern void S_SET_NAME (symbolS *, const char *);
126
extern void S_CLEAR_EXTERNAL (symbolS *);
127
extern void S_SET_WEAK (symbolS *);
128
extern void S_SET_WEAKREFR (symbolS *);
129
extern void S_CLEAR_WEAKREFR (symbolS *);
130
extern void S_SET_WEAKREFD (symbolS *);
131
extern void S_CLEAR_WEAKREFD (symbolS *);
132
extern void S_SET_THREAD_LOCAL (symbolS *);
133
extern void S_SET_VOLATILE (symbolS *);
134
extern void S_CLEAR_VOLATILE (symbolS *);
135
extern void S_SET_FORWARD_REF (symbolS *);
136
137
#ifndef WORKING_DOT_WORD
138
struct broken_word
139
  {
140
    /* Linked list -- one of these structures per ".word x-y+C"
141
       expression.  */
142
    struct broken_word *next_broken_word;
143
    /* Segment and subsegment for broken word.  */
144
    segT seg;
145
    subsegT subseg;
146
    /* Which frag is this broken word in?  */
147
    fragS *frag;
148
    /* Where in the frag is it?  */
149
    char *word_goes_here;
150
    /* Where to add the break.  */
151
    fragS *dispfrag;    /* where to add the break */
152
    /* Operands of expression.  */
153
    symbolS *add;
154
    symbolS *sub;
155
    offsetT addnum;
156
157
    int added;      /* nasty thing happened yet? */
158
    /* 1: added and has a long-jump */
159
    /* 2: added but uses someone elses long-jump */
160
161
    /* Pointer to broken_word with a similar long-jump.  */
162
    struct broken_word *use_jump;
163
  };
164
extern struct broken_word *broken_words;
165
#endif /* ifdef WORKING_DOT_WORD */
166
167
/*
168
 * Current means for getting from symbols to segments and vice verse.
169
 * This will change for infinite-segments support (e.g. COFF).
170
 */
171
extern const segT N_TYPE_seg[]; /* subseg.c */
172
173
#define SEGMENT_TO_SYMBOL_TYPE(seg)  ( seg_N_TYPE [(int) (seg)] )
174
extern const short seg_N_TYPE[];/* subseg.c */
175
176
#define N_REGISTER  30  /* Fake N_TYPE value for SEG_REGISTER */
177
178
void symbol_clear_list_pointers (symbolS * symbolP);
179
180
void symbol_insert (symbolS * addme, symbolS * target,
181
        symbolS ** rootP, symbolS ** lastP);
182
void symbol_remove (symbolS * symbolP, symbolS ** rootP,
183
        symbolS ** lastP);
184
185
extern int symbol_on_chain (symbolS *s, symbolS *rootPP, symbolS *lastPP);
186
187
void verify_symbol_chain (symbolS * rootP, symbolS * lastP);
188
189
void symbol_append (symbolS * addme, symbolS * target,
190
        symbolS ** rootP, symbolS ** lastP);
191
192
extern symbolS *symbol_previous (const symbolS *);
193
extern symbolS *symbol_next (const symbolS *);
194
195
extern expressionS *symbol_get_value_expression (symbolS *);
196
extern void symbol_set_value_expression (symbolS *, const expressionS *);
197
extern offsetT *symbol_X_add_number (const symbolS *);
198
extern void symbol_set_value_now (symbolS *);
199
extern void symbol_set_frag (symbolS *, fragS *);
200
extern fragS *symbol_get_frag (const symbolS *);
201
extern fragS *symbol_get_frag_and_value (const symbolS *, addressT *);
202
extern void symbol_mark_used (symbolS *);
203
extern void symbol_clear_used (symbolS *);
204
extern int symbol_used_p (const symbolS *);
205
extern void symbol_mark_used_in_reloc (symbolS *);
206
extern void symbol_clear_used_in_reloc (symbolS *);
207
extern int symbol_used_in_reloc_p (const symbolS *);
208
extern void symbol_mark_mri_common (symbolS *);
209
extern void symbol_clear_mri_common (symbolS *);
210
extern int symbol_mri_common_p (const symbolS *);
211
extern void symbol_mark_written (symbolS *);
212
extern void symbol_clear_written (symbolS *);
213
extern int symbol_written_p (const symbolS *);
214
extern void symbol_mark_removed (symbolS *);
215
extern int symbol_removed_p (const symbolS *);
216
extern void symbol_mark_resolved (symbolS *);
217
extern int symbol_resolved_p (const symbolS *);
218
extern void symbol_mark_resolving (symbolS *);
219
extern void symbol_clear_resolving (symbolS *);
220
extern int symbol_resolving_p (const symbolS *);
221
extern int symbol_section_p (const symbolS *);
222
extern int symbol_equated_p (const symbolS *);
223
extern int symbol_equated_reloc_p (const symbolS *);
224
extern int symbol_constant_p (const symbolS *);
225
extern int symbol_shadow_p (const symbolS *);
226
extern symbolS *symbol_symbolS (symbolS *);
227
extern asymbol *symbol_get_bfdsym (symbolS *);
228
extern void symbol_set_bfdsym (symbolS *, asymbol *);
229
extern int symbol_same_p (const symbolS *, const symbolS *);
230
231
#ifdef OBJ_SYMFIELD_TYPE
232
OBJ_SYMFIELD_TYPE *symbol_get_obj (symbolS *);
233
void symbol_set_obj (symbolS *, OBJ_SYMFIELD_TYPE *);
234
#endif
235
236
#ifdef TC_SYMFIELD_TYPE
237
TC_SYMFIELD_TYPE *symbol_get_tc (symbolS *);
238
void symbol_set_tc (symbolS *, TC_SYMFIELD_TYPE *);
239
#endif
240
241
#endif /* GAS_SYMBOLS_H */