add COMDAT group support for Xtensa

Bob Wilson bwilson@tensilica.com
Fri Aug 25 01:35:00 GMT 2006


I've committed this patch to add support for COMDAT groups on Xtensa targets. 
There is an associated patch for GCC that I will add soon.  I've tested this by 
running the binutils testsuite for an xtensa-elf target and also by running the 
GCC testsuite using binutils with this patch.

The patch deals with both the Xtensa-specific property sections and the Xtensa 
literal sections.  The property section for a group needs to be made a member of 
that group, and there are a few places that needed updating the handle the 
property section names with the group suffixes.  The literal sections are 
harder.  The Xtensa "literal_prefix" directive that was used to control literal 
section names does not allow specifying a section in a group, and rather than 
extend it to be even more complicated, the patch changes the default behavior to 
"do the right thing".  The literal_prefix directive still works as before, but 
if it is not specified, the assembler determines which literal section to use 
based on the section where a literal is defined.  The details are in the updated 
documentation.

2006-08-24  Bob Wilson  <bob.wilson@acm.org>

bfd/
	* elf32-xtensa.c (xtensa_get_property_section_name): Delete.
	(xtensa_get_property_section): New.
	(xtensa_read_table_entries): Use xtensa_get_property_section.
	(relax_property_section, xtensa_get_property_predef_flags): Handle
	group name suffixes in property section names.
	(match_section_group): New.

gas/
	* config/tc-xtensa.c (FINI_LITERAL_SECTION_NAME): Delete.
	(INIT_LITERAL_SECTION_NAME): Delete.
	(lit_state struct): Remove segment names, init_lit_seg, and
	fini_lit_seg.  Add lit_prefix and current_text_seg.
	(init_literal_head_h, init_literal_head): Delete.
	(fini_literal_head_h, fini_literal_head): Delete.
	(xtensa_begin_directive): Move argument parsing to
	xtensa_literal_prefix function.
	(xtensa_end_directive): Deallocate lit_prefix field of lit_state.
	(xtensa_literal_prefix): Parse the directive argument here and
	record it in the lit_prefix field.  Remove code to derive literal
	section names.
	(linkonce_len): New.
	(get_is_linkonce_section): Use linkonce_len.  Check for any
	".gnu.linkonce.*" section, not just text sections.
	(md_begin): Remove initialization of deleted lit_state fields.
	(xtensa_reorder_segments, xtensa_post_relax_hook): Remove references
	to init_literal_head and fini_literal_head.
	(xtensa_move_literals): Likewise.  Skip literals for .init and .fini
	when traversing literal_head list.
	(match_section_group): New.
	(cache_literal_section): Rewrite to determine the literal section
	name on the fly, create the section and return it.
	(xtensa_switch_to_literal_fragment): Adjust for cache_literal_section.
	(xtensa_switch_to_non_abs_literal_fragment): Likewise.
	(xtensa_create_property_segments, xtensa_create_xproperty_segments):
	Use xtensa_get_property_section from bfd.
	(retrieve_xtensa_section): Delete.
	* doc/c-xtensa.texi (Xtensa Options): Fix --text-section-literals
	description to refer to plural literal sections and add xref to
	the Literal Directive section.
	(Literal Directive): Describe new rules for deriving literal section
	names.  Add footnote for special case of .init/.fini with
	--text-section-literals.
	(Literal Prefix Directive): Replace old naming rules with xref to the
	Literal Directive section.

ld/
	* emulparams/elf32xtensa.sh (.xt.prop): Add .xt.prop.*.
	* scripttempl/elfxtensa.sc (.text): Add .literal.*.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-comdat.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20060825/1e2de1ab/attachment.ksh>


More information about the Binutils mailing list