bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/15300] AR/NM/GNU LD and Gold should issue a warning when u


From: markus at trippelsdorf dot de
Subject: [Bug binutils/15300] AR/NM/GNU LD and Gold should issue a warning when used on objects with GCC/LLVM LTO data in it and no other symbols
Date: Sun, 24 Mar 2013 16:31:41 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=15300

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> 
2013-03-24 16:31:41 UTC ---
Or better still have the utilities load the plugin automatically.

I'm using the following patch successfully on my machine:

 diff --git a/binutils/ar.c b/binutils/ar.c
index c424038..4b14dc5 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -138,7 +138,11 @@ static int show_version = 0;

 static int show_help = 0;

+#if BFD_SUPPORTS_PLUGINS
+static const char *plugin_target = "plugin";
+#else
 static const char *plugin_target = NULL;
+#endif

 static const char *target = NULL;

@@ -553,7 +557,6 @@ decode_options (int argc, char **argv)
           break;
     case OPTION_PLUGIN:
 #if BFD_SUPPORTS_PLUGINS
-      plugin_target = "plugin";
       bfd_plugin_set_plugin (optarg);
 #else
       fprintf (stderr, _("sorry - this program has been built without plugin
support\n"));
@@ -614,7 +617,6 @@ ranlib_main (int argc, char **argv)
       /* PR binutils/13493: Support plugins.  */
     case OPTION_PLUGIN:
 #if BFD_SUPPORTS_PLUGINS
-      plugin_target = "plugin";
       bfd_plugin_set_plugin (optarg);
 #else
       fprintf (stderr, _("sorry - this program has been built without plugin
support\n"));
diff --git a/binutils/nm.c b/binutils/nm.c
index ad38e27..84627bc 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -177,7 +177,11 @@ static char other_format[] = "%02x";
 static char desc_format[] = "%04x";

 static char *target = NULL;
-static char *plugin_target = NULL;
+#if BFD_SUPPORTS_PLUGINS
+static const char *plugin_target = "plugin";
+#else
+static const char *plugin_target = NULL;
+#endif

 /* Used to cache the line numbers for a BFD.  */
 static bfd *lineno_cache_bfd;
@@ -1647,7 +1651,6 @@ main (int argc, char **argv)

     case OPTION_PLUGIN:    /* --plugin */
 #if BFD_SUPPORTS_PLUGINS
-      plugin_target = "plugin";
       bfd_plugin_set_plugin (optarg);
 #else
       fatal (_("sorry - this program has been built without plugin
support\n"));

Two small scripts allow me to switch from clang's lto-plugin to gcc's:

 % cat plugin_clang
sudo rm /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/*
sudo ln -s /usr/lib64/llvm/LLVMgold.so
/usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins

 % cat plugin_gcc
sudo rm /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/*
sudo ln -s /usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/liblto_plugin.so.0.0.0
/usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]