[PATCH 1/2] gold: extend Output_file to support read/write access to existing files.

Ian Lance Taylor iant@google.com
Tue Sep 1 17:33:00 GMT 2009


Mikolaj Zalewski <mikolajz@google.com> writes:

> Added options to open file without removing its contents and made
> map_anonymous behave similarly to other *map* methods, e.g. to modify
> this->base_ on success.
>
> 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
>
> 	* output.cc (Output_file::Output_file): Initialize
> map_include_original_content_ .
> 	(Output_file::open_for_modification): New method.
> 	(Output_file::try_map_anonymous): Renamed from
> Output_file::map_anonymous, changed behavior to similar to other
> *map*.
> 	(Output_file::map): Don't try anonymous mapping it
> this->map_include_original_content_.
> 	(Output_file::try_map_no_anonymous): New method (most code from
> Output_file::map).
> 	* output.h (Output_file::open_for_modification): New method.
> 	(Output_file::open): Update comment.
> 	(Output_file::resize): Update comment.
> 	(Output_file::close): Update comment.
> 	(Output_file::map): Update comment.
> 	(Output_file::try_map_anonymous): Renamed from Output_file::map_anonymous.
> 	(Output_file::try_map_no_anonymous): New method.
> 	(Output_file::map_include_original_content_): New field.

Thanks.  I made a bunch of minor changes to this patch.

1) I didn't like the names "try_map_anonymous" and
   "try_map_no_anonymous".  The functions don't try to do maps: they
   actually do maps.

2) I didn't see any reason to include the map_include_original_content_
   field.

3) GNU formatting puts the open brace on a line by itself.

I included the other patch mostly as is.

This is the patch I committed.

Thanks.

Ian


2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>

	* gold.cc: Include "incremental.h".
	(queue_initial_tasks): Call Incremental_checker methods.
	* incremental.cc: Include "output.h".
	(Incremental_checker::can_incrementally_link_output_file): New
	method.
	* incremental.h (Incremental_checker): New class.

	* output.cc (Output_file::open_for_modification): New method.
	(Output_file::map_anonymous): Changed return type to bool.  Record
	map in base_ field.
	(Output_file::map_no_anonymous): New method, broken out of map.
	(Output_file::map): Use map_no_anonymous and map_anonymous.
	* output.h (class Output_file): Update declarations.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 11938 bytes
Desc: Incremental changes
URL: <https://sourceware.org/pipermail/binutils/attachments/20090901/337a765d/attachment.bin>


More information about the Binutils mailing list