From 351e2b5aa7a71258e6b682ac1a3228964de8d22c Mon Sep 17 00:00:00 2001 From: Dave Anglin Date: Wed, 28 Apr 2004 18:02:49 +0000 Subject: * som.c (struct som_misc_symbol_info): Add is_comdat, is_common and dup_common fields. (setup_sections): Use som_subspace_dictionary_record struct instead subspace_dictionary_record. Set SEC_LINK_ONCE if subspace is is_comdat, is_common or dup_common. (som_prep_headers): Use som_subspace_dictionary_record struct. Set is_comdat, is_common and dup_common in section subspace_dict from copy_data. (som_begin_writing): Use som_subspace_dictionary_record struct. (som_finish_writing): Likewise. (som_bfd_derive_misc_symbol_info): Add support to set is_comdat, is_common and dup_common flags in info for symbol. Add comment regarding linker support for these fields. Slightly reorganize function. (som_build_and_write_symbol_table): Set is_comdat, is_common and dup_common fields in symbol table from symbol info. (bfd_som_set_subsection_attributes): Add comdat, common and dup_common arguments. Set corresponding fields in copy_data. Change all callers. (som_bfd_ar_write_symbol_stuff): Set dup_common flag in library symbol table. (som_vec): Add SEC_LINK_ONCE to applicable section flags. * som.h (som_subspace_dictionary_record): Define. (som_copyable_section_data_struct): Add is_comdat, is_common and dup_common fields. (som_section_data_struct): Use som_subspace_dictionary_record struct instead of subspace_dictionary_record. (bfd_boolean bfd_som_set_subsection_attributes): Adjust prototype. * config/obj-som.c (obj_som_init_stab_section): Add new arguments in call to obj_set_subsection_attributes. (obj_som_init_stab_section): Likewise. * config/tc-hppa.c (default_subspace_dict): Add comdat field. (pa_def_subspaces): Provide comdat default. (pa_subspace): Handle new "comdat" parameter. Set SEC_LINK_ONCE and not SEC_IS_COMMON if section is comdat, common or dup_common. Update calls to create_new_subspace and update_subspace to pass comdat flag. (create_new_subspace, update_subspace): Add new comdat argument. Use it in calls to obj_set_subsection_attributes. * doc/c-hppa.texi (.subspa, .nsubspa): Document new comdat parameter and use of comdat, common and dup_comm parameters. --- gas/doc/c-hppa.texi | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'gas/doc/c-hppa.texi') diff --git a/gas/doc/c-hppa.texi b/gas/doc/c-hppa.texi index 7e9ea30..9970188 100644 --- a/gas/doc/c-hppa.texi +++ b/gas/doc/c-hppa.texi @@ -245,14 +245,51 @@ identified by keywords. The keywords recognized are @samp{quad=@var{expr}} beginning of this subsection; a power of two), @samp{access=@var{expr}} (value for ``access rights'' field), @samp{sort=@var{expr}} (sorting order for this subspace in link), @samp{code_only} (subsection contains only code), -@samp{unloadable} (subsection cannot be loaded into memory), @samp{common} -(subsection is common block), @samp{dup_comm} (initialized data may have -duplicate names), or @samp{zero} (subsection is all zeros, do not write in -object file). +@samp{unloadable} (subsection cannot be loaded into memory), @samp{comdat} +(subsection is comdat), @samp{common} (subsection is common block), +@samp{dup_comm} (subsection may have duplicate names), or @samp{zero} +(subsection is all zeros, do not write in object file). @code{.nsubspa} always creates a new subspace with the given name, even if one with the same name already exists. +@samp{comdat}, @samp{common} and @samp{dup_comm} can be used to implement +various flavors of one-only support when using the SOM linker. The SOM +linker only supports specific combinations of these flags. The details +are not documented. A brief description is provided here. + +@samp{comdat} provides a form of linkonce support. It is useful for +both code and data subspaces. A @samp{comdat} subspace has a key symbol +marked by the @samp{is_comdat} flag or @samp{ST_COMDAT}. Only the first +subspace for any given key is selected. The key symbol becomes universal +in shared links. This is similar to the behavior of @samp{secondary_def} +symbols. + +@samp{common} provides Fortran named common support. It is only useful +for data subspaces. Symbols with the flag @samp{is_common} retain this +flag in shared links. Referencing a @samp{is_common} symbol in a shared +library from outside the library doesn't work. Thus, @samp{is_common} +symbols must be output whenever they are needed. + +@samp{common} and @samp{dup_comm} together provide Cobol common support. +The subspaces in this case must all be the same length. Otherwise, this +support is similar to the Fortran common support. + +@samp{dup_comm} by itself provides a type of one-only support for code. +Only the first @samp{dup_comm} subspace is selected. There is a rather +complex algorithm to compare subspaces. Code symbols marked with the +@samp{dup_common} flag are hidden. This support was intended for "C++ +duplicate inlines". + +A simplified technique is used to mark the flags of symbols based on +the flags of their subspace. A symbol with the scope SS_UNIVERSAL and +type ST_ENTRY, ST_CODE or ST_DATA is marked with the corresponding +settings of @samp{comdat}, @samp{common} and @samp{dup_comm} from the +subspace, respectively. This avoids having to introduce additional +directives to mark these symbols. The HP assembler sets @samp{is_common} +from @samp{common}. However, it doesn't set the @samp{dup_common} from +@samp{dup_comm}. It doesn't have @samp{comdat} support. + @item .version "@var{str}" Write @var{str} as version identifier in object code. @end table -- cgit v1.1