[4/9] gas: don't use COFF-specific SF_SET_LOCAL() directly from read.c

Message ID 619227a1-01df-4fca-9642-86586e88db91@suse.com
State New
Headers
Series gas: tidying of emulations |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Jan Beulich Sept. 27, 2024, 1:03 p.m. UTC
  Make this a proper obj-format hook instead.
  

Patch

--- 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.  */
--- 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 */
--- 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
 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);
--- 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.  */
--- 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,
--- 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))
 
--- 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);
--- a/gas/read.c
+++ b/gas/read.c
@@ -3289,9 +3289,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
     }