aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-08-06 11:36:03 +0930
committerAlan Modra <amodra@gmail.com>2025-08-07 22:14:49 +0930
commit97b6ffe44b98479f991ab38b4c59f4fd0f30198e (patch)
tree35673cff954fdfd692c79fb68b6f8238f975cab7
parentbdee55420232f16d73210517e96320636e0f2e7d (diff)
downloadbinutils-97b6ffe44b98479f991ab38b4c59f4fd0f30198e.zip
binutils-97b6ffe44b98479f991ab38b4c59f4fd0f30198e.tar.gz
binutils-97b6ffe44b98479f991ab38b4c59f4fd0f30198e.tar.bz2
Move struct plugin_data_struct to plugin.c
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.
-rw-r--r--bfd/archive.c1
-rw-r--r--bfd/elflink.c1
-rw-r--r--bfd/format.c1
-rw-r--r--bfd/plugin.c13
-rw-r--r--bfd/plugin.h11
-rw-r--r--binutils/ar.c4
-rw-r--r--binutils/nm.c5
-rw-r--r--binutils/objcopy.c3
-rw-r--r--ld/ldfile.c1
-rw-r--r--ld/ldmain.c1
10 files changed, 19 insertions, 22 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 697b2ed..52d3119 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -142,7 +142,6 @@ SUBSECTION
#include "filenames.h"
#include "bfdlink.h"
#if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
#include "plugin.h"
#endif
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c4f57cf..cdd58b2 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -28,7 +28,6 @@
#include "libiberty.h"
#include "objalloc.h"
#if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
#include "plugin.h"
#endif
diff --git a/bfd/format.c b/bfd/format.c
index bd9fa8d..fba8d2a 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -47,7 +47,6 @@ SUBSECTION
#include "bfd.h"
#include "libbfd.h"
#if BFD_SUPPORTS_PLUGINS
-#include "plugin-api.h"
#include "plugin.h"
#endif
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 43ca444..733e7f0 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -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;
diff --git a/bfd/plugin.h b/bfd/plugin.h
index 6acb5fa..d981c51 100644
--- a/bfd/plugin.h
+++ b/bfd/plugin.h
@@ -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
diff --git a/binutils/ar.c b/binutils/ar.c
index de41c9e..3cac3f3 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -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. */
diff --git a/binutils/nm.c b/binutils/nm.c
index d44083d..a7f0e9d 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -36,9 +36,10 @@
#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)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 3404bec..654d2b9 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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. */
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 75fd360..e642c7f 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -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 */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 67c60c3..13b8e3d 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -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. */