]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move struct plugin_data_struct to plugin.c
authorAlan Modra <amodra@gmail.com>
Wed, 6 Aug 2025 02:06:03 +0000 (11:36 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 7 Aug 2025 12:44:49 +0000 (22:14 +0930)
It isn't needed anywhere except plugin.c.  The typedef can disappear.
Also make a forward declaraion for ld_plugin_input_file in plugin.h
so that this header can be used without first including plugin-api.h.

bfd/
* plugin.h (struct ld_plugin_input_file): Forward declare.
(struct plugin_data_struct): Move to..
* plugin.c: ..here.
(add_symbols): Size plugin_data without using type.
* archive.c: Don't include plugin-api.h.
* elflink.c: Likewise.
* format.c: Likewise.
binutils/
* ar.c: Don't include plugin-api.h or ansidecl.h.  Only
include plugin.h when BFD_SUPPORTS_PLUGINS.
* nm.c: Don't include plugin-api.h.  Only include plugin.h
when BFD_SUPPORTS_PLUGINS.
* objcopy.c: Likewise.
ld/
* ldfile.c: Don't include plugin-api.h.
* ldmain.c: Likewise.

bfd/archive.c
bfd/elflink.c
bfd/format.c
bfd/plugin.c
bfd/plugin.h
binutils/ar.c
binutils/nm.c
binutils/objcopy.c
ld/ldfile.c
ld/ldmain.c

index 697b2ed23f2183fa8a2d01c3a8f63bb7b94f696d..52d31199fdd4cd636bca280728ea4be0e6a27607 100644 (file)
@@ -142,7 +142,6 @@ SUBSECTION
 #include "filenames.h"
 #include "bfdlink.h"
 #if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
 #include "plugin.h"
 #endif
 
index c4f57cf2f3c6aad1e218b168a6abb948c2071be6..cdd58b25fc820b8b0bf0943eb9d6ec7a2a9f66e4 100644 (file)
@@ -28,7 +28,6 @@
 #include "libiberty.h"
 #include "objalloc.h"
 #if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
 #include "plugin.h"
 #endif
 
index bd9fa8d6c336f03331b69e9ed5ee3e9832f3c592..fba8d2a3d370373c9239175425ff16a98d92d47e 100644 (file)
@@ -47,7 +47,6 @@ SUBSECTION
 #include "bfd.h"
 #include "libbfd.h"
 #if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
 #include "plugin.h"
 #endif
 
index 43ca444e7a12fcf6bc23355c22bdb98d1eed2662..733e7f0f322ec2d801e4b2b22e9913319e1d7c70 100644 (file)
@@ -138,6 +138,14 @@ struct plugin_list_entry
   const char *plugin_name;
 };
 
+struct plugin_data_struct
+{
+  int nsyms;
+  const struct ld_plugin_symbol *syms;
+  int object_only_nsyms;
+  asymbol **object_only_syms;
+};
+
 static const char *plugin_program_name;
 
 void
@@ -336,9 +344,8 @@ add_symbols (void * handle,
             const struct ld_plugin_symbol * syms)
 {
   bfd *abfd = handle;
-  struct plugin_data_struct *plugin_data =
-    bfd_alloc (abfd, sizeof (plugin_data_struct));
-
+  struct plugin_data_struct *plugin_data = bfd_alloc (abfd,
+                                                     sizeof (*plugin_data));
   if (!plugin_data)
     return LDPS_ERR;
 
index 6acb5fa9c86b12189599730a6a62615b5345773f..d981c51799628d4eb0fffa1c57ec3e099675d639 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef _PLUGIN_H_
 #define _PLUGIN_H_
 
+struct ld_plugin_input_file;
+
 void bfd_plugin_set_program_name (const char *);
 int bfd_plugin_open_input (bfd *, struct ld_plugin_input_file *);
 void bfd_plugin_set_plugin (const char *);
@@ -29,13 +31,4 @@ bool bfd_link_plugin_object_p (bfd *);
 void register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *, bool));
 void bfd_plugin_close_file_descriptor (bfd *, int);
 
-typedef struct plugin_data_struct
-{
-  int nsyms;
-  const struct ld_plugin_symbol *syms;
-  int object_only_nsyms;
-  asymbol **object_only_syms;
-}
-plugin_data_struct;
-
 #endif
index de41c9e3dd1ace7dc8229ba348be7ad9425bc2f8..3cac3f3fb2681287e2101152135fb3a6ddc90e1a 100644 (file)
@@ -32,9 +32,9 @@
 #include "arsup.h"
 #include "filenames.h"
 #include "binemul.h"
-#include "plugin-api.h"
+#if BFD_SUPPORTS_PLUGINS
 #include "plugin.h"
-#include "ansidecl.h"
+#endif
 
 #ifdef __GO32___
 #define EXT_NAME_LEN 3         /* Bufflen of addition to name if it's MS-DOS.  */
index d44083dcc948c855fca2401c464d93659aa1375b..a7f0e9d9409fbf3c2a2438da83e46896ed17bd5f 100644 (file)
 #include "libcoff.h"
 #include "bucomm.h"
 #include "demanguse.h"
-#include "plugin-api.h"
-#include "plugin.h"
 #include "safe-ctype.h"
+#if BFD_SUPPORTS_PLUGINS
+#include "plugin.h"
+#endif
 
 #ifndef streq
 #define streq(a,b) (strcmp ((a),(b)) == 0)
index 3404bec1d08cfd7f50dcd3de11973b4ae9e91f4a..654d2b9b44a908808c74e0a73ce16ddb11409004 100644 (file)
@@ -30,8 +30,9 @@
 #include "coff/internal.h"
 #include "libcoff.h"
 #include "safe-ctype.h"
-#include "plugin-api.h"
+#if BFD_SUPPORTS_PLUGINS
 #include "plugin.h"
+#endif
 
 /* FIXME: See bfd/peXXigen.c for why we include an architecture specific
    header in generic PE code.  */
index 75fd360d5e39f07b73d20c24e7e78ffc6fd10faa..e642c7f6620a8aa532ff0d81a085b36aaafa506d 100644 (file)
@@ -36,7 +36,6 @@
 #include "filenames.h"
 #include <fnmatch.h>
 #if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
 #include "plugin.h"
 #endif /* BFD_SUPPORTS_PLUGINS */
 
index 67c60c3f80d733f47342913d22d2dd47987e0194..13b8e3dce9d6438b1343639dddcb66f8528eb5af 100644 (file)
@@ -42,7 +42,6 @@
 #include "ldctor.h"
 #if BFD_SUPPORTS_PLUGINS
 #include "plugin.h"
-#include "plugin-api.h"
 #endif /* BFD_SUPPORTS_PLUGINS */
 
 /* Somewhere above, sys/stat.h got included.  */