public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold][patch] Pass the output filename to the plugin
@ 2010-06-01  5:12 Rafael Espindola
  2010-06-01 17:56 ` Cary Coutant
  2010-06-01 19:48 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael Espindola @ 2010-06-01  5:12 UTC (permalink / raw)
  To: Binutils; +Cc: Cary Coutant

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

With the attached patch gold will pass the name of the output file to
the plugin. The use case is that sometimes the plugin wants to output
additional information to another file.

For example, in the llvm plugin we have a also-emit-llvm option. Right
now that option requires an argument. I would like to make the
argument optional and default to appending .bc to the regular output
name.

gold/
2010-06-01  Rafael Espindola  <espindola@google.com>

        * plugin.cc (Plugin::load): Pass the output name to the plugin.

include/
2010-06-01  Rafael Espindola  <espindola@google.com>

        * plugin-api.h (ld_plugin_tag): Add LDPT_OUTPUT_NAME.

Cheers,
-- 
Rafael Ávila de Espíndola

[-- Attachment #2: output.patch --]
[-- Type: application/octet-stream, Size: 1038 bytes --]

diff --git a/gold/plugin.cc b/gold/plugin.cc
index 2ee1301..62141ac 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -127,7 +127,7 @@ Plugin::load()
   sscanf(ver, "%d.%d", &major, &minor);
 
   // Allocate and populate a transfer vector.
-  const int tv_fixed_size = 14;
+  const int tv_fixed_size = 15;
   int tv_size = this->args_.size() + tv_fixed_size;
   ld_plugin_tv *tv = new ld_plugin_tv[tv_size];
 
@@ -154,6 +154,10 @@ Plugin::load()
   else
     tv[i].tv_u.tv_val = LDPO_EXEC;
 
+  ++i;
+  tv[i].tv_tag = LDPT_OUTPUT_NAME;
+  tv[i].tv_u.tv_string = parameters->options().output();
+
   for (unsigned int j = 0; j < this->args_.size(); ++j)
     {
       ++i;
diff --git a/include/plugin-api.h b/include/plugin-api.h
index 572621f..5821785 100644
--- a/include/plugin-api.h
+++ b/include/plugin-api.h
@@ -260,7 +260,8 @@ enum ld_plugin_tag
   LDPT_MESSAGE,
   LDPT_GET_INPUT_FILE,
   LDPT_RELEASE_INPUT_FILE,
-  LDPT_ADD_INPUT_LIBRARY
+  LDPT_ADD_INPUT_LIBRARY,
+  LDPT_OUTPUT_NAME
 };
 
 /* The plugin transfer vector.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold][patch] Pass the output filename to the plugin
  2010-06-01  5:12 [gold][patch] Pass the output filename to the plugin Rafael Espindola
@ 2010-06-01 17:56 ` Cary Coutant
  2010-06-01 19:48 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Cary Coutant @ 2010-06-01 17:56 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: Binutils

> gold/
> 2010-06-01  Rafael Espindola  <espindola@google.com>
>
>        * plugin.cc (Plugin::load): Pass the output name to the plugin.
>
> include/
> 2010-06-01  Rafael Espindola  <espindola@google.com>
>
>        * plugin-api.h (ld_plugin_tag): Add LDPT_OUTPUT_NAME.

Looks good to me.

-cary

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold][patch] Pass the output filename to the plugin
  2010-06-01  5:12 [gold][patch] Pass the output filename to the plugin Rafael Espindola
  2010-06-01 17:56 ` Cary Coutant
@ 2010-06-01 19:48 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2010-06-01 19:48 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: Binutils, Cary Coutant

Rafael Espindola <espindola@google.com> writes:

> gold/
> 2010-06-01  Rafael Espindola  <espindola@google.com>
>
>         * plugin.cc (Plugin::load): Pass the output name to the plugin.
>
> include/
> 2010-06-01  Rafael Espindola  <espindola@google.com>
>
>         * plugin-api.h (ld_plugin_tag): Add LDPT_OUTPUT_NAME.

This is OK.

Please update http://gcc.gnu.org/wiki/whopr/driver .

Thanks.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-01 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-01  5:12 [gold][patch] Pass the output filename to the plugin Rafael Espindola
2010-06-01 17:56 ` Cary Coutant
2010-06-01 19:48 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).