RFC: Add output_bfd to bfd_link_info

H. J. Lu hjl@lucon.org
Thu Apr 22 20:39:00 GMT 2004


I find a need to access output_bfd via bfd_link_info. I was wondering
why it wasn't there to begin with. Any comments?


H.J.
---
include/

2004-04-22  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Add output_bfd.

ld/

2004-04-22  H.J. Lu  <hongjiu.lu@intel.com>

	* ldlang.c (ldlang_open_output): Set link_info.output_bfd.

	* ldmain.c (main): Initialize link_info.output_bfd.

--- binutils/include/bfdlink.h.output	2004-03-23 08:42:32.000000000 -0800
+++ binutils/include/bfdlink.h	2004-04-22 12:12:15.000000000 -0700
@@ -351,6 +351,9 @@ struct bfd_link_info
      together via the link_next field.  */
   bfd *input_bfds;
 
+  /* The output BFD.  */
+  bfd *output_bfd;
+
   /* If a symbol should be created for each input BFD, this is section
      where those symbols should be placed.  It must be a section in
      the output BFD.  It may be NULL, in which case no such symbols
--- binutils/ld/ldlang.c.output	2004-04-22 08:22:21.000000000 -0700
+++ binutils/ld/ldlang.c	2004-04-22 12:15:16.000000000 -0700
@@ -1777,6 +1777,7 @@ ldlang_open_output (lang_statement_union
     case lang_output_statement_enum:
       ASSERT (output_bfd == NULL);
       output_bfd = open_output (statement->output_statement.name);
+      link_info.output_bfd = output_bfd;
       ldemul_set_output_arch ();
       if (config.magic_demand_paged && !link_info.relocatable)
 	output_bfd->flags |= D_PAGED;
--- binutils/ld/ldmain.c.output	2004-03-18 10:11:56.000000000 -0800
+++ binutils/ld/ldmain.c	2004-04-22 12:13:39.000000000 -0700
@@ -313,6 +313,7 @@ main (int argc, char **argv)
   link_info.notice_hash = NULL;
   link_info.wrap_hash = NULL;
   link_info.input_bfds = NULL;
+  link_info.output_bfd = NULL;
   link_info.create_object_symbols_section = NULL;
   link_info.gc_sym_list = NULL;
   link_info.base_file = NULL;



More information about the Binutils mailing list