This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Configure option to enable plugin in ar,nm and ranlib by default?
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: binutils at sourceware dot org
- Date: Sat, 15 Sep 2012 14:18:16 +0200
- Subject: Re: Configure option to enable plugin in ar,nm and ranlib by default?
- References: <20120914165355.GA282@x4>
On 2012.09.14 at 18:53 +0200, Markus Trippelsdorf wrote:
> Wouldn't it make sense to add a configure option that enables the plugin
> by default for ar,nm and ranlib? The path to the plugin could be
> specified at configure time. That would allow one to eventually get rid
> of the various wrappers (gcc-ar, etc.) that are currently in use.
IOW, would something like the following be acceptable?
(Of course it still needs to be connected to autoconf)
diff --git a/binutils/ar.c b/binutils/ar.c
index aceb9d1..6a189d5 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -44,6 +44,8 @@
#define EXT_NAME_LEN 6 /* Ditto for *NIX. */
#endif
+#define BFD_DEFAULT_PLUGIN 1
+
/* Static declarations. */
static void mri_emul (void);
@@ -61,7 +63,11 @@ static void write_archive (bfd *);
static int ranlib_only (const char *archname);
static int ranlib_touch (const char *archname);
static void usage (int);
-
+
+#if BFD_DEFAULT_PLUGIN
+static const char *const plugin_path = "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/liblto_plugin.so";
+#endif
+
/** Globals and flags. */
static int mri_mode;
@@ -453,6 +459,11 @@ decode_options (int argc, char **argv)
argv = new_argv;
}
+#if BFD_DEFAULT_PLUGIN
+ plugin_target = "plugin";
+ bfd_plugin_set_plugin (plugin_path);
+#endif
+
while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTDU",
long_options, NULL)) != EOF)
{
@@ -591,6 +602,11 @@ ranlib_main (int argc, char **argv)
bfd_boolean touch = FALSE;
int c;
+#if BFD_DEFAULT_PLUGIN
+ plugin_target = "plugin";
+ bfd_plugin_set_plugin (plugin_path);
+#endif
+
while ((c = getopt_long (argc, argv, "DhHUvVt", long_options, NULL)) != EOF)
{
switch (c)
diff --git a/binutils/nm.c b/binutils/nm.c
index ad38e27..67b32a2 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -20,6 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#define BFD_DEFAULT_PLUGIN 1
+
#include "sysdep.h"
#include "bfd.h"
#include "progress.h"
@@ -135,6 +137,11 @@ static struct output_fns formats[] =
/* The output format to use. */
static struct output_fns *format = &formats[FORMAT_DEFAULT];
+/* Setup the default plugin path. */
+#if BFD_DEFAULT_PLUGIN
+static const char *const plugin_path = "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/liblto_plugin.so";
+#endif
+
/* Command options. */
static int do_demangle = 0; /* Pretty print C++ symbol names. */
@@ -1537,6 +1544,10 @@ main (int argc, char **argv)
#if BFD_SUPPORTS_PLUGINS
bfd_plugin_set_program_name (program_name);
#endif
+#if BFD_DEFAULT_PLUGIN
+ plugin_target = "plugin";
+ bfd_plugin_set_plugin (plugin_path);
+#endif
START_PROGRESS (program_name, 0);
--
Markus