This is the mail archive of the
mailing list for the binutils project.
Creating BFD with single section
- From: "Paulo J. Matos" <paulo at matos-sorge dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 06 Dec 2011 14:15:36 +0000
- Subject: Creating BFD with single section
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 |
if(sec == NULL)
einfo("%P%F: cannot create section `.debug_comment' in
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");
None of this fails but the file is never really written to disk. What am
I missing here?