[PATCH] gold: make the kept comdat structure have a direct link to sections map

Ian Lance Taylor iant@google.com
Sun Mar 1 22:23:00 GMT 2009

Mikolaj Zalewski <mikolajz@google.com> writes:

>   Currently, if a comdat is already declared in a previous object and
> we need to access its sections, Layout needs to map the comdat name to
> original object/section index and the obejct must map section the
> index to comdat information. With this patch, the Layout's
> Kept_section structure has already all the information about the
> comdat. The patch also changes the way comdat information is accessed
> - it only does one insert, instead of an insert and if insert failed
> then a find for the entry. This decreased linking CPU time on a sample
> test by 2-2,5%. It produces the same binary as the previous version
> and make check passed.
> 2009-02-27  Mikolaj Zalewski  <mikolajz@google.com>
> 	* layout.cc (find_or_add_comdat): a more generic version of add_comdat
> 	(add_comdat): removed
> 	* layout.h (Kept_section): move out of Layout
> 	(Kept_section::group_sections_): new field
> 	(Layout::Kep_section): remove
> 	(find_or_add_comdat): a more generic version of add_comdat
> 	(add_comdat): removed
> 	* object.cc (include_section_group): use find_or_add_comdat and
> Kept_section::group_sections_
> 	(include_linkonce_section): use find_or_add_comdat and
> Kept_section::group_sections_
> 	* object.cc (Comdat_group): removed
> 	(Comdat_group_table): removed
> 	(find_comdat_grouop): removed
> 	(add_comdat_group): removed
> 	(comdat_groups_): removed
> 	* plugin.cc (include_comdat_group): use the new Layout::find_or_add_comdat


I took the opportunity to clean up some style issues--field in a struct
should not use a trailing underscore, and I changed some indentation.
This is what I committed.


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

	* layout.cc (Layout::find_or_add_kept_section): New function.
	(Layout::add_comdat): Removed.
	* layout.h (struct Kept_section): Move out of class Layout.
	Remove trailing underscores from field names.  Add group_sections
	field.  Rename group_ field to is_group.  Change all uses.
	(class Layout): Declare find_or_add_kept_section, not add_comdat.
	* object.cc (Sized_relobj::Sized_relobj): Don't initialize
	comdat_groups_ field.
	(Sized_relobj::include_section_group): Use
	find_or_add_kept_section and Kept_section::group_sections.
	(Sized_relobj::include_linkonce_section): Likewise.
	* object.cc (class Sized_relobj): Don't define Comdat_group or
	Comdat_group_table.  Remove find_comdat_group and
	add_comdat_group.  Remove comdat_groups_ field.
	* plugin.cc (include_comdat_group): Use

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 16438 bytes
Desc: Link kept comdat to sections map
URL: <https://sourceware.org/pipermail/binutils/attachments/20090301/a608a18a/attachment.bin>

More information about the Binutils mailing list