bfd: read/write header characteristics of Win32/PE executable
Dave Korn
dave.korn.cygwin@gmail.com
Fri Jul 23 15:25:00 GMT 2010
More information about the Binutils mailing list
Fri Jul 23 15:25:00 GMT 2010
- Previous message (by thread): read/write header characteristics of Win32/PE executable
- Next message (by thread): RFC: Support linker --compress-debug-sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 21/07/2010 09:03, Sean McNamara wrote:
> I have been using the bfd source code and documentation to try to
> understand how to do this, but most of the COFF/PE stuff is documented
> in the source, not in the binutils docs. The only user of BFD that
> appears to do what I want is in GNU ld, in the file pe.em:
>
> case OPTION_LARGE_ADDRESS_AWARE:
> real_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
>
> This seems to be the place where GNU ld parses the option
> "--large-address-aware" and translates that into a flag set by BFD. I
> started researching BFD from this, and inferred that eventually I need
> to do something like this in my app:
>
> abfd->tdata.pe_obj_data->real_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
>
> I managed to drag in the required headers from include/ and bfd/ to
> get this to build, but when I call bfd_close(), no changes are made to
> the resulting executable.
>
> Currently I am opening the executable with bfd_fopen in "rw" mode,
> hoping that I could just make this one change and write it back out,
> without having to open the file for reading, create a new BFD for
> writing, and somehow (?) copy the contents of the one into the other.
Hmm, I dunno if bfd actually allows that or not. I think the best solution
to this would be to duplicate the various flag-setting options from ld into
objcopy.
cheers,
DaveK
- Previous message (by thread): read/write header characteristics of Win32/PE executable
- Next message (by thread): RFC: Support linker --compress-debug-sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list