diff options
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/c-xtensa.texi | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/gas/doc/c-xtensa.texi b/gas/doc/c-xtensa.texi index 2a1fb54..1a683fc 100644 --- a/gas/doc/c-xtensa.texi +++ b/gas/doc/c-xtensa.texi @@ -37,8 +37,8 @@ special options: @kindex --text-section-literals @kindex --no-text-section-literals Control the treatment of literal pools. The default is -@samp{--no-@-text-@-section-@-literals}, which places literals in a -separate section in the output file. This allows the literal pool to be +@samp{--no-@-text-@-section-@-literals}, which places literals in +separate sections in the output file. This allows the literal pool to be placed in a data RAM/ROM. With @samp{--text-@-section-@-literals}, the literals are interspersed in the text section in order to keep them as close as possible to their references. This may be necessary for large @@ -46,6 +46,7 @@ assembly files, where the literals would otherwise be out of range of the @code{L32R} instructions in the text section. These options only affect literals referenced via PC-relative @code{L32R} instructions; literals for absolute mode @code{L32R} instructions are handled separately. +@xref{Literal Directive, ,literal}. @item --absolute-literals | --no-absolute-literals @kindex --absolute-literals @@ -617,13 +618,14 @@ can be used to load a pointer to the symbol @code{sym} into register @code{ENTRY} and @code{L32R} instructions; instead, the assembler puts the data in a literal pool. -Literal pools for absolute mode @code{L32R} instructions -(@pxref{Absolute Literals Directive}) are placed in a separate -@code{.lit4} section. By default literal pools for PC-relative mode -@code{L32R} instructions are placed in a separate @code{.literal} -section; however, when using the @samp{--text-@-section-@-literals} +Literal pools are placed by default in separate literal sections; +however, when using the @samp{--text-@-section-@-literals} option (@pxref{Xtensa Options, ,Command Line Options}), the literal -pools are placed in the current section. These text section literal +pools for PC-relative mode @code{L32R} instructions +are placed in the current section.@footnote{Literals for the +@code{.init} and @code{.fini} sections are always placed in separate +sections, even when @samp{--text-@-section-@-literals} is enabled.} +These text section literal pools are created automatically before @code{ENTRY} instructions and manually after @samp{.literal_position} directives (@pxref{Literal Position Directive, ,literal_position}). If there are no preceding @@ -631,6 +633,46 @@ Position Directive, ,literal_position}). If there are no preceding must be used to place the text section literal pools; otherwise, @command{@value{AS}} will report an error. +When literals are placed in separate sections, the literal section names +are derived from the names of the sections where the literals are +defined. The base literal section names are @code{.literal} for +PC-relative mode @code{L32R} instructions and @code{.lit4} for absolute +mode @code{L32R} instructions (@pxref{Absolute Literals Directive, +,absolute-literals}). These base names are used for literals defined in +the default @code{.text} section. For literals defined in other +sections or within the scope of a @code{literal_prefix} directive +(@pxref{Literal Prefix Directive, ,literal_prefix}), the following rules +determine the literal section name: + +@enumerate +@item +If the current section is a member of a section group, the literal +section name includes the group name as a suffix to the base +@code{.literal} or @code{.lit4} name, with a period to separate the base +name and group name. The literal section is also made a member of the +group. + +@item +If the current section name (or @code{literal_prefix} value) begins with +``@code{.gnu.linkonce.@var{kind}.}'', the literal section name is formed +by replacing ``@code{.@var{kind}}'' with the base @code{.literal} or +@code{.lit4} name. For example, for literals defined in a section named +@code{.gnu.linkonce.t.func}, the literal section will be +@code{.gnu.linkonce.literal.func} or @code{.gnu.linkonce.lit4.func}. + +@item +If the current section name (or @code{literal_prefix} value) ends with +@code{.text}, the literal section name is formed by replacing that +suffix with the base @code{.literal} or @code{.lit4} name. For example, +for literals defined in a section named @code{.iram0.text}, the literal +section will be @code{.iram0.literal} or @code{.iram0.lit4}. + +@item +If none of the preceding conditions apply, the literal section name is +formed by adding the base @code{.literal} or @code{.lit4} name as a +suffix to the current section name (or @code{literal_prefix} value). +@end enumerate + @node Literal Position Directive @subsection literal_position @cindex @code{literal_position} directive @@ -679,45 +721,24 @@ continue: @subsection literal_prefix @cindex @code{literal_prefix} directive -The @code{literal_prefix} directive allows you to specify different -sections to hold literals from different portions of an assembly file. -With this directive, a single assembly file can be used to generate code -into multiple sections, including literals generated by the assembler. +The @code{literal_prefix} directive allows you to override the default +literal section names, which are derived from the names of the sections +where the literals are defined. @smallexample .begin literal_prefix [@var{name}] .end literal_prefix @end smallexample -By default the assembler places literal pools in sections separate from -the instructions, using the default literal section names of -@code{.literal} for PC-relative mode @code{L32R} instructions and -@code{.lit4} for absolute mode @code{L32R} instructions (@pxref{Absolute -Literals Directive}). The @code{literal_prefix} directive causes -different literal sections to be used for the code inside the delimited -region. The new literal sections are determined by including @var{name} -as a prefix to the default literal section names. If the @var{name} +For literals defined within the delimited region, the literal section +names are derived from the @var{name} argument instead of the name of +the current section. The rules used to derive the literal section names +do not change. @xref{Literal Directive, ,literal}. If the @var{name} argument is omitted, the literal sections revert to the defaults. This directive has no effect when using the @samp{--text-@-section-@-literals} option (@pxref{Xtensa Options, ,Command Line Options}). -Except for two special cases, the assembler determines the new literal -sections by simply prepending @var{name} to the default section names, -resulting in @code{@var{name}.literal} and @code{@var{name}.lit4} -sections. The @code{literal_prefix} directive is often used with the -name of the current text section as the prefix argument. To facilitate -this usage, the assembler uses special case rules when it recognizes -@var{name} as a text section name. First, if @var{name} ends with -@code{.text}, that suffix is not included in the literal section name. -For example, if @var{name} is @code{.iram0.text}, then the literal -sections will be @code{.iram0.literal} and @code{.iram0.lit4}. Second, -if @var{name} begins with @code{.gnu.linkonce.t.}, then the literal -section names are formed by replacing the @code{.t} substring with -@code{.literal} and @code{.lit4}. For example, if @var{name} is -@code{.gnu.linkonce.t.func}, the literal sections will be -@code{.gnu.linkonce.literal.func} and @code{.gnu.linkonce.lit4.func}. - @node Absolute Literals Directive @subsection absolute-literals @cindex @code{absolute-literals} directive |