]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: put emul decls in emul.h
authorJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2024 07:36:24 +0000 (09:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2024 07:36:24 +0000 (09:36 +0200)
The individual struct emulation instances shouldn't be declared in a .c
file; it and the producers of the symbols want to both see the
declarations, so declarations and definitions don't go out of sync. Move
these declarations to emul.h.

While there also adjust the conditional around this_format: That symbol
is never #define-d anywhere, and it's needed only when USE_EMULATIONS is
defined. (Really, when obj-multi isn't in use, it also is effectively
only ever written to.)

gas/as.c
gas/emul.h
gas/obj.h

index 7117be21df3c217faf72c74d559eb6391ab9c63a..030da2e05011ded8d1ee4a9ac77bf643b2a5ded1 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -130,10 +130,6 @@ static long start_time;
 #ifdef USE_EMULATIONS
 #define EMULATION_ENVIRON "AS_EMULATION"
 
-extern struct emulation mipsbelf, mipslelf, mipself;
-extern struct emulation i386coff, i386elf, i386aout;
-extern struct emulation crisaout, criself;
-
 static struct emulation *const emulations[] = { EMULATIONS };
 static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]);
 
index d4c3f062898bf4ab4e9b07bb2e0527fee82a34a2..d2ca8f5765aa0a97dba618e7007b14cd0ceaa0d5 100644 (file)
@@ -35,6 +35,10 @@ struct emulation
 
 COMMON struct emulation * this_emulation;
 
+extern struct emulation mipsbelf, mipslelf, mipself;
+extern struct emulation i386coff, i386elf, i386aout;
+extern struct emulation crisaout, criself;
+
 extern void common_emul_init (void);
 
 #endif
index 4676d07b65d811b1b7bb0e6cf4c7c5e21d3eb14b..22b56e101b5210c292eff149562965ef3b150324 100644 (file)
--- a/gas/obj.h
+++ b/gas/obj.h
@@ -82,7 +82,7 @@ extern const struct format_ops ecoff_format_ops;
 extern const struct format_ops coff_format_ops;
 extern const struct format_ops aout_format_ops;
 
-#ifndef this_format
+#ifdef USE_EMULATIONS
 COMMON const struct format_ops *this_format;
 #endif