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]
Other format: [Raw text]

[RFC] Split I/O routines into two new files, bfdio.c and bfdwin.c


The next batch of patches I hope to submit are some extensions to be core I/O layer of BFD.

They basically offer three improvements over the current core:

* Support for mutliply-nested layers of archives (for example, an 'ar'-format library that contains other 'ar'-format libraries, or Mach-O fat binaries).

* Support for "user-defined" I/O routines for BFDs --- the user passes in a struct containing a set of function pointers to implement read/write/seek/close/flush/stat, and have that be used as the basis of a BFD. We use this in our GDB support to allow treating sections of memory in the inferior as a BFD, by dispatching the BFD I/O calls through the GDB target read/write calls.

* Improved support for "in-memory" BFDs, allowing clients to create BFDs out of memory regions and/or mmap, and access them via get_section_in_window.

I've got a bit of work to do to clean them up and split them into manageable patches; I'll post more on each as I submit them. One issue that arises though:

When I did the work, I found that it was much easier for me to manage the I/O code and mmap code if I split it out into separate files (particularly the I/O code, as I could iterate through it to make sure I'd handle all the clients of a given interface when making a modification).

So for example, our bfdio.c contains the following functions: bfd_bread, bfd_bwrite, bfd_flush, bfd_tell, bfd_stat, bfd_seek, _bfd_io_close, bfd_get_mtime, bfd_get_size (we've removed some of the functions from the original implementation, like real_read).

Unfortunately for us, it's not very practical to make diffs between source trees where functions have been moved from one file to another. So we either need to convince you to make the equivalent split of source files, or re-merge our sources into one big file again.

What would your opinion be on a patch to split the existing I/O and window code from libbfd.c, opncls.c, and bfd.c into two new files, bfdio.c and bfdwin.c? It would be a purely mechanical patch, just moving functions and headers wholesale to the appropriate files.


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