public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* "Create a bfd at linking time"
@ 2001-06-05 15:35 Xinan Tang
  2001-06-05 15:40 ` DJ Delorie
  0 siblings, 1 reply; 4+ messages in thread
From: Xinan Tang @ 2001-06-05 15:35 UTC (permalink / raw)
  To: binutils

Hi

  I need to create a bfd at linking time and this bfd conatins several
of its own sections (also created on-the-fly). This is what I did:

__________________________________________________________

 bfd * abfd;
 lang_input_statement_type *p;

 // Create my bfd
 abfd = create_my_own_bfd();

 // Insert into input_file_chain
 p = lang_add_input_file("dummy", lang_input_file_is_fake_enum, NULL);
 p -> the_bfd = abfd;

 // Insert into the `output' file_chain
 ldlang_add_file (p);
_________________________________________________________

 In general, is this a correct way to add a bfd into the statement list?

 However, at the final linking step,  _bfd_generic_final_link(),
there is an error message: bfd_error_system_call.

 One potential problem is that I did not set the 'link_order_header' and
'link_order_tail' fields when creating the sections within the bfd.
How to set these two fields when creating a new section?

Thanks

-- 
Dr. Xinan Tang                    Member of Technical Staff
EMail: xinant@cognigine.com  	  Cognigine Corp.
Voice: 510.743.4930               6120 Stevenson Boulevard
Fax:   510.743.4910               Fremont, CA  94538

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

* Re: "Create a bfd at linking time"
  2001-06-05 15:35 "Create a bfd at linking time" Xinan Tang
@ 2001-06-05 15:40 ` DJ Delorie
  2001-06-05 16:10   ` Xinan Tang
  0 siblings, 1 reply; 4+ messages in thread
From: DJ Delorie @ 2001-06-05 15:40 UTC (permalink / raw)
  To: xinant; +Cc: binutils

>   I need to create a bfd at linking time and this bfd conatins several
> of its own sections (also created on-the-fly). This is what I did:

Look in ld/pe-dll.c near the bottom.  I do this for dlls.

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

* Re: "Create a bfd at linking time"
  2001-06-05 15:40 ` DJ Delorie
@ 2001-06-05 16:10   ` Xinan Tang
  2001-06-05 16:34     ` DJ Delorie
  0 siblings, 1 reply; 4+ messages in thread
From: Xinan Tang @ 2001-06-05 16:10 UTC (permalink / raw)
  To: DJ Delorie; +Cc: binutils

Hi

DJ Delorie wrote:

>>   I need to create a bfd at linking time and this bfd conatins several
>> of its own sections (also created on-the-fly). This is what I did:
> 
> 
> Look in ld/pe-dll.c near the bottom.  I do this for dlls.

   Yes, I did exactly the same as outlined in function
	
	build_filler_bfd()

   However, I did not figure out how to set the two `link_order_header'
and 'link_order_tail fields' for a newly created section.

Thanks

--Xinan 


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

* Re: "Create a bfd at linking time"
  2001-06-05 16:10   ` Xinan Tang
@ 2001-06-05 16:34     ` DJ Delorie
  0 siblings, 0 replies; 4+ messages in thread
From: DJ Delorie @ 2001-06-05 16:34 UTC (permalink / raw)
  To: xinant; +Cc: binutils

>    Yes, I did exactly the same as outlined in function
> 	
> 	build_filler_bfd()

No, look for a comment that says "Generate the import library".  That
whole section builds a synthetic .a and adds it to the list of
libraries to link against (or outputs it, depending on the command
line options).  Specifically, pe_process_import_defs(), and
add_bfd_to_link().

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

end of thread, other threads:[~2001-06-05 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-05 15:35 "Create a bfd at linking time" Xinan Tang
2001-06-05 15:40 ` DJ Delorie
2001-06-05 16:10   ` Xinan Tang
2001-06-05 16:34     ` DJ Delorie

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).