]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: don't use COFF-specific SF_SET_LOCAL() directly from read.c
authorJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2024 07:37:37 +0000 (09:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2024 07:37:37 +0000 (09:37 +0200)
Make this a proper obj-format hook instead.

gas/config/obj-aout.c
gas/config/obj-coff.c
gas/config/obj-coff.h
gas/config/obj-ecoff.c
gas/config/obj-elf.c
gas/config/obj-multi.h
gas/obj.h
gas/read.c

index 318520c9fd2fcf1327336ba197d4999d77356884..d6384d8bed8deb70906ca236077fbab1af379f4b 100644 (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.  */
index 13dc4ff1c6d316e5c3018cf530bc46adcf2567b8..66552412446d82a8b67307d726fc605d68b6f560 100644 (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 */
index 9b8e492b66df2590b29866a91711e25a3c51c531..7bde5848dae62c563cca0adee1d5d07c077888ea 100644 (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);
index 11f42a4e764d7d6099eef70c4ecf50f4a78e4300..9dfa0ee9cb7615339b8e582fcc877a2c1f651d75 100644 (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.  */
index e28ba0a62d52f4d4f6e2f282ea25560b7bf342fb..93a15892450b4a7a4eca0f77b82792d29db15463 100644 (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,
index 6700fe54be0f51aad1418a000802367e99fd2dfe..4069ce68d3488ada5779d98ad0cb4cf8a19f2c13 100644 (file)
         ? (*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))
 
index 22b56e101b5210c292eff149562965ef3b150324..672cf3ff06cce1dfde3f3a532563365cb1a0e479 100644 (file)
--- 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);
index bc31d328a3da6d6acaec9c2de2b5acb50e0c9c94..bf577872dc5fb1003b155d21512ff7cddf4b5c4e 100644 (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
     }