gas: don't use COFF-specific SF_SET_LOCAL() directly from read.c

Make this a proper obj-format hook instead.
This commit is contained in:
Jan Beulich 2024-10-04 09:37:37 +02:00
parent 833c28eefb
commit ccaa95c887
8 changed files with 23 additions and 3 deletions

View File

@ -298,6 +298,7 @@ const struct format_ops aout_format_ops =
0, /* begin. */
0, /* end. */
0, /* app_file. */
NULL, /* assign_symbol */
obj_aout_frob_symbol,
0, /* frob_file. */
0, /* frob_file_before_adjust. */

View File

@ -1177,6 +1177,15 @@ coff_obj_read_begin_hook (void)
tag_init ();
}
void
coff_assign_symbol (symbolS *symp ATTRIBUTE_UNUSED)
{
#ifndef TE_PE
/* "set" symbols are local unless otherwise specified. */
SF_SET_LOCAL (symp);
#endif
}
symbolS *coff_last_function;
#ifndef OBJ_XCOFF
static symbolS *coff_last_bf;
@ -1910,6 +1919,7 @@ const struct format_ops coff_format_ops =
0, /* begin */
0, /* end. */
c_dot_file_symbol,
coff_assign_symbol,
coff_frob_symbol,
0, /* frob_file */
0, /* frob_file_before_adjust */

View File

@ -251,6 +251,7 @@ extern symbolS *coff_last_function;
#define obj_emit_lineno(WHERE, LINE, FILE_START) abort ()
#define obj_app_file(name) c_dot_file_symbol (name)
#define obj_assign_symbol(S) coff_assign_symbol (S)
#define obj_frob_symbol(S,P) coff_frob_symbol (S, & P)
#define obj_frob_section(S) coff_frob_section (S)
#define obj_frob_file_after_relocs() coff_frob_file_after_relocs ()
@ -322,6 +323,7 @@ extern int S_GET_STORAGE_CLASS (symbolS *);
extern void SA_SET_SYM_ENDNDX (symbolS *, symbolS *);
extern void coff_add_linesym (symbolS *);
extern void c_dot_file_symbol (const char *);
extern void coff_assign_symbol (symbolS *);
extern void coff_frob_symbol (symbolS *, int *);
extern void coff_adjust_symtab (void);
extern void coff_frob_section (segT);

View File

@ -293,6 +293,7 @@ const struct format_ops ecoff_format_ops =
0, /* begin. */
0, /* end. */
ecoff_new_file,
NULL, /* assign_symbol */
obj_ecoff_frob_symbol,
ecoff_frob_file,
0, /* frob_file_before_adjust. */

View File

@ -3282,6 +3282,7 @@ const struct format_ops elf_format_ops =
elf_begin,
elf_end,
elf_file_symbol,
NULL, /* assign_symbol */
elf_frob_symbol,
elf_frob_file,
elf_frob_file_before_adjust,

View File

@ -46,6 +46,11 @@
? (*this_format->app_file) (NAME) \
: (void) 0)
#define obj_assign_symbol(S) \
(this_format->assign_symbol \
? (*this_format->assign_symbol) (S) \
: (void) 0)
#define obj_frob_symbol(S,P) \
(*this_format->frob_symbol) (S, &(P))

View File

@ -46,6 +46,7 @@ struct format_ops {
void (*begin) (void);
void (*end) (void);
void (*app_file) (const char *);
void (*assign_symbol) (symbolS *);
void (*frob_symbol) (symbolS *, int *);
void (*frob_file) (void);
void (*frob_file_before_adjust) (void);

View File

@ -3290,9 +3290,8 @@ assign_symbol (char *name, int mode)
symbol_set_frag (symbolP, dummy_frag);
}
#endif
#if defined (OBJ_COFF) && !defined (TE_PE)
/* "set" symbols are local unless otherwise specified. */
SF_SET_LOCAL (symbolP);
#ifdef obj_assign_symbol
obj_assign_symbol (symbolP);
#endif
}