This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Creating BFD with single section


Hello,

I am trying to manually create an elf file `tmpfile' with a single section `.debug_comment' with content in buffer `idstring_buf'.

Here's the code:
abfd = bfd_openw(tmpfile, p->target);
sec = bfd_make_section_with_flags(abfd, ".debug_comment",
SEC_READONLY | SEC_HAS_CONTENTS | SEC_DEBUGGING);
if(sec == NULL)
einfo("%P%F: cannot create section `.debug_comment' in temporary bfd\n");


    if(!bfd_set_section_size(abfd, sec, sz))
        einfo("%P%F: cannot set section size\n");
    if(!bfd_set_section_contents(abfd, sec, idstring_buf, 0, sz))
        einfo("%P%F: cannot set section contents\n");


bfd_close(abfd);


None of this fails but the file is never really written to disk. What am I missing here?

Cheers,

--
PMatos


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