aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-06-06 11:28:08 +0930
committerAlan Modra <amodra@gmail.com>2020-06-06 11:28:08 +0930
commit070558eb0deed3fc798c41ec75db75f99660a4e1 (patch)
tree6df538d3d8258fe7d178ede7962f9c6ae8461d57
parent62b5b3d836853730d40c5cc89015f831baf3131c (diff)
downloadgdb-070558eb0deed3fc798c41ec75db75f99660a4e1.zip
gdb-070558eb0deed3fc798c41ec75db75f99660a4e1.tar.gz
gdb-070558eb0deed3fc798c41ec75db75f99660a4e1.tar.bz2
ld -plugin options when plugins are disabled
This patch makes ld accept and ignore -plugin options when configured with --disable-plugins. The idea is to allow using a linker built without plugin support with a gcc built with plugin support. Quite obviously such a combination won't work if using LTO, but gcc has a habit of passing a bunch of -plugin and -plugin-opt arguments to ld even when not generating or linking LTO objects. Why do I want to do this? Well, it lets me and other binutils developers answer the question as to whether plugin support breaks binutils in some areas. Which it does for some targets. * lexsup.c (ld_options): Accept -plugin and -plugin-opt when !ENABLE_PLUGINS. * testsuite/lib/ld-lib.exp (check_plugin_api_available): Adjust.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/lexsup.c5
-rw-r--r--ld/testsuite/lib/ld-lib.exp3
3 files changed, 13 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index b40d36b..c3b213f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-06-06 Alan Modra <amodra@gmail.com>
+
+ * lexsup.c (ld_options): Accept -plugin and -plugin-opt when
+ !ENABLE_PLUGINS.
+ * testsuite/lib/ld-lib.exp (check_plugin_api_available): Adjust.
+
2020-06-05 Nelson Chu <nelson.chu@sifive.com>
* testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Rename to
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 4808f74..d84b334 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -185,6 +185,11 @@ static const struct ld_option ld_options[] =
{ {"flto-partition=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC LTO option compatibility"),
ONE_DASH },
+#else
+ { {"plugin", required_argument, NULL, OPTION_IGNORE},
+ '\0', N_("PLUGIN"), N_("Load named plugin (ignored)"), ONE_DASH },
+ { {"plugin-opt", required_argument, NULL, OPTION_IGNORE},
+ '\0', N_("ARG"), N_("Send arg to last-loaded plugin (ignored)"), ONE_DASH },
#endif /* ENABLE_PLUGINS */
{ {"fuse-ld=", required_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for GCC linker option compatibility"),
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 015eda6..6535881 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1135,7 +1135,8 @@ proc check_plugin_api_available { } {
if {![info exists plugin_api_available_saved]} {
# Check if the ld used by gcc supports --plugin.
set ld_output [remote_exec host $ld "--help"]
- if { [ string first "-plugin PLUGIN" $ld_output ] >= 0 } {
+ if { [regexp -- "-plugin PLUGIN \[^\n\r\]*" $ld_output line]
+ && ![regexp "ignored" $line] } {
set plugin_api_available_saved 1
} else {
set plugin_api_available_saved 0