This is the mail archive of the 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]

Deleting sections with libbfd

Hi all,

I have been working on an extension for GCC that allows me to perform
static analysis of C++ exceptions. This extension generates data while
objects are being compiled and embeds that data into the .o files in a
section named ".edoc".

In post processing the resulting exes I wish to ensure that the number
of .edoc sections contained in an exe is exactly 1. This seems to always
be the case on my machine however I read in the libbfd manual that it is
possible for an exe to contain more than 1 section with the same name.

My plan was to search the output exe for any sections named ".edoc" and
delete them, and then create a new single section ".edoc" and set its
contents as i require.

I could not find any mention of "Deleting Sections" in the libbfd manual
or in the archives. Is this at all possible?

If not would it suffice for me to set the size of all ".edoc" sections
in the binary except the one i wish to use to 0?

Also is it possible to open a bfd for reading and writing? I need to
write, but if i use bfd_openw then it does not read in the existing
contents of the binary file. I really need to modify the bfd so read it
in, modify the appropriate sections and save the changed file.


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