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]

Re: Appending to BFD


On 15/11/11 22:49, Dave Korn wrote:
On 15/11/2011 14:18, Paulo J. Matos wrote:

Is this even possible?

I don't know, but this code ....


bfd *
bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
{
[ ... snip ... ]
   /* Figure out whether the user is opening the file for reading,
      writing, or both, by looking at the MODE argument.  */
   if ((mode[0] == 'r' || mode[0] == 'w' || mode[0] == 'a')
       &&  mode[1] == '+')
     nbfd->direction = both_direction;


... suggests that it ought to be possible.  However you may need to insert
calls to bfd_make_readable/bfd_make_writable at appropriate points, and treat
it as if it was only either readable or writable but not both at any given time.

     cheers,
       DaveK



Unfortunately this seems impossible indeed. Opening file bfd with "w" resets the bfd and I can't find any sections. Opening with "r" and using bfd_make_writable fails because this procedure requited abfd->direction == no_direction. :-/

I am open to suggestions.

--
PMatos


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