This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: "Create a symbol table"


Hi DJ,

DJ Delorie wrote:


> 
> 
> It's complicated by the use of bfd_make_writable(), which switches the
> bfd from file-based to memory-based.  The only thing you really should
> do with such a bfd is later call bfd_make_readable and hand it back to
> the program as if it were reading a file off disk.
> 
> PE uses this technique to create archives corresponding to DLLs you
> attempt to "link" against.
> 

  I found out that the correct order to create a bfd is as follows:

     1: abfd = bfd_openw();
     2: bfd_set_symtab();
     3: bfd_set_section_contents();

   However, I cannot make bfd_make_writable() work. If I replace
bfd_openw() with

	1_1: abfd = bfd_create();
         1_2: bfd_make_writable(abfd);
           2: bfd_set_symtab();
           3: bfd_set_section_contents();

    The last call will generate the segmentation fault error.
I tried to emulate what make_one() in pe-dll.c does. But not successfull.

    One question, what is difference between using 
bfd_set_section_contents() and using a series of bfd_put_XX()?
I noticed that in pe-dll.c, both are used.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]