aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-10-04 09:37:37 +0200
committerJan Beulich <jbeulich@suse.com>2024-10-04 09:37:37 +0200
commitccaa95c887891e2db6503aaf252d9781a577ec37 (patch)
tree71372399d6b833c83c7fd7c0b495cb146ba62563
parent833c28eefb87de08bee1a696721d746441d096d6 (diff)
downloadgdb-ccaa95c887891e2db6503aaf252d9781a577ec37.zip
gdb-ccaa95c887891e2db6503aaf252d9781a577ec37.tar.gz
gdb-ccaa95c887891e2db6503aaf252d9781a577ec37.tar.bz2
gas: don't use COFF-specific SF_SET_LOCAL() directly from read.c
Make this a proper obj-format hook instead.
-rw-r--r--gas/config/obj-aout.c1
-rw-r--r--gas/config/obj-coff.c10
-rw-r--r--gas/config/obj-coff.h2
-rw-r--r--gas/config/obj-ecoff.c1
-rw-r--r--gas/config/obj-elf.c1
-rw-r--r--gas/config/obj-multi.h5
-rw-r--r--gas/obj.h1
-rw-r--r--gas/read.c5
8 files changed, 23 insertions, 3 deletions
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c
index 318520c..d6384d8 100644
--- a/gas/config/obj-aout.c
+++ b/gas/config/obj-aout.c
@@ -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. */
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 13dc4ff..6655241 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -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 */
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index 9b8e492..7bde584 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -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);
diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c
index 11f42a4..9dfa0ee 100644
--- a/gas/config/obj-ecoff.c
+++ b/gas/config/obj-ecoff.c
@@ -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. */
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index e28ba0a..93a1589 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -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,
diff --git a/gas/config/obj-multi.h b/gas/config/obj-multi.h
index 6700fe5..4069ce6 100644
--- a/gas/config/obj-multi.h
+++ b/gas/config/obj-multi.h
@@ -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))
diff --git a/gas/obj.h b/gas/obj.h
index 22b56e1..672cf3f 100644
--- a/gas/obj.h
+++ b/gas/obj.h
@@ -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);
diff --git a/gas/read.c b/gas/read.c
index bc31d32..bf57787 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -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
}