You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
476 lines
24 KiB
HTML
476 lines
24 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Copyright (C) 1988-2018 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being "Funding Free Software", the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
"GNU Free Documentation License".
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development. -->
|
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>Sections (GNU Compiler Collection (GCC) Internals)</title>
|
|
|
|
<meta name="description" content="Sections (GNU Compiler Collection (GCC) Internals)">
|
|
<meta name="keywords" content="Sections (GNU Compiler Collection (GCC) Internals)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Target-Macros.html#Target-Macros" rel="up" title="Target Macros">
|
|
<link href="PIC.html#PIC" rel="next" title="PIC">
|
|
<link href="Scheduling.html#Scheduling" rel="prev" title="Scheduling">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style: oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<a name="Sections"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="PIC.html#PIC" accesskey="n" rel="next">PIC</a>, Previous: <a href="Scheduling.html#Scheduling" accesskey="p" rel="prev">Scheduling</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="Dividing-the-Output-into-Sections-_0028Texts_002c-Data_002c-_2026_0029"></a>
|
|
<h3 class="section">18.18 Dividing the Output into Sections (Texts, Data, …)</h3>
|
|
|
|
<p>An object file is divided into sections containing different types of
|
|
data. In the most common case, there are three sections: the <em>text
|
|
section</em>, which holds instructions and read-only data; the <em>data
|
|
section</em>, which holds initialized writable data; and the <em>bss
|
|
section</em>, which holds uninitialized data. Some systems have other kinds
|
|
of sections.
|
|
</p>
|
|
<p><samp>varasm.c</samp> provides several well-known sections, such as
|
|
<code>text_section</code>, <code>data_section</code> and <code>bss_section</code>.
|
|
The normal way of controlling a <code><var>foo</var>_section</code> variable
|
|
is to define the associated <code><var>FOO</var>_SECTION_ASM_OP</code> macro,
|
|
as described below. The macros are only read once, when <samp>varasm.c</samp>
|
|
initializes itself, so their values must be run-time constants.
|
|
They may however depend on command-line flags.
|
|
</p>
|
|
<p><em>Note:</em> Some run-time files, such <samp>crtstuff.c</samp>, also make
|
|
use of the <code><var>FOO</var>_SECTION_ASM_OP</code> macros, and expect them
|
|
to be string literals.
|
|
</p>
|
|
<p>Some assemblers require a different string to be written every time a
|
|
section is selected. If your assembler falls into this category, you
|
|
should define the <code>TARGET_ASM_INIT_SECTIONS</code> hook and use
|
|
<code>get_unnamed_section</code> to set up the sections.
|
|
</p>
|
|
<p>You must always create a <code>text_section</code>, either by defining
|
|
<code>TEXT_SECTION_ASM_OP</code> or by initializing <code>text_section</code>
|
|
in <code>TARGET_ASM_INIT_SECTIONS</code>. The same is true of
|
|
<code>data_section</code> and <code>DATA_SECTION_ASM_OP</code>. If you do not
|
|
create a distinct <code>readonly_data_section</code>, the default is to
|
|
reuse <code>text_section</code>.
|
|
</p>
|
|
<p>All the other <samp>varasm.c</samp> sections are optional, and are null
|
|
if the target does not provide them.
|
|
</p>
|
|
<dl>
|
|
<dt><a name="index-TEXT_005fSECTION_005fASM_005fOP"></a>Macro: <strong>TEXT_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>A C expression whose value is a string, including spacing, containing the
|
|
assembler operation that should precede instructions and read-only data.
|
|
Normally <code>"\t.text"</code> is right.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-HOT_005fTEXT_005fSECTION_005fNAME"></a>Macro: <strong>HOT_TEXT_SECTION_NAME</strong></dt>
|
|
<dd><p>If defined, a C string constant for the name of the section containing most
|
|
frequently executed functions of the program. If not defined, GCC will provide
|
|
a default definition if the target supports named sections.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-UNLIKELY_005fEXECUTED_005fTEXT_005fSECTION_005fNAME"></a>Macro: <strong>UNLIKELY_EXECUTED_TEXT_SECTION_NAME</strong></dt>
|
|
<dd><p>If defined, a C string constant for the name of the section containing unlikely
|
|
executed functions in the program.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-DATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>DATA_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>A C expression whose value is a string, including spacing, containing the
|
|
assembler operation to identify the following data as writable initialized
|
|
data. Normally <code>"\t.data"</code> is right.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-SDATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>SDATA_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
initialized, writable small data.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-READONLY_005fDATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>READONLY_DATA_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>A C expression whose value is a string, including spacing, containing the
|
|
assembler operation to identify the following data as read-only initialized
|
|
data.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-BSS_005fSECTION_005fASM_005fOP"></a>Macro: <strong>BSS_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
uninitialized global data. If not defined, and
|
|
<code>ASM_OUTPUT_ALIGNED_BSS</code> not defined,
|
|
uninitialized global data will be output in the data section if
|
|
<samp>-fno-common</samp> is passed, otherwise <code>ASM_OUTPUT_COMMON</code> will be
|
|
used.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-SBSS_005fSECTION_005fASM_005fOP"></a>Macro: <strong>SBSS_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
uninitialized, writable small data.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TLS_005fCOMMON_005fASM_005fOP"></a>Macro: <strong>TLS_COMMON_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string containing the
|
|
assembler operation to identify the following data as thread-local
|
|
common data. The default is <code>".tls_common"</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TLS_005fSECTION_005fASM_005fFLAG"></a>Macro: <strong>TLS_SECTION_ASM_FLAG</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a character constant
|
|
containing the flag used to mark a section as a TLS section. The
|
|
default is <code>'T'</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-INIT_005fSECTION_005fASM_005fOP"></a>Macro: <strong>INIT_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
initialization code. If not defined, GCC will assume such a section does
|
|
not exist. This section has no corresponding <code>init_section</code>
|
|
variable; it is used entirely in runtime code.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-FINI_005fSECTION_005fASM_005fOP"></a>Macro: <strong>FINI_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
finalization code. If not defined, GCC will assume such a section does
|
|
not exist. This section has no corresponding <code>fini_section</code>
|
|
variable; it is used entirely in runtime code.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-INIT_005fARRAY_005fSECTION_005fASM_005fOP"></a>Macro: <strong>INIT_ARRAY_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
part of the <code>.init_array</code> (or equivalent) section. If not
|
|
defined, GCC will assume such a section does not exist. Do not define
|
|
both this macro and <code>INIT_SECTION_ASM_OP</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-FINI_005fARRAY_005fSECTION_005fASM_005fOP"></a>Macro: <strong>FINI_ARRAY_SECTION_ASM_OP</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a string, including spacing,
|
|
containing the assembler operation to identify the following data as
|
|
part of the <code>.fini_array</code> (or equivalent) section. If not
|
|
defined, GCC will assume such a section does not exist. Do not define
|
|
both this macro and <code>FINI_SECTION_ASM_OP</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-MACH_005fDEP_005fSECTION_005fASM_005fFLAG"></a>Macro: <strong>MACH_DEP_SECTION_ASM_FLAG</strong></dt>
|
|
<dd><p>If defined, a C expression whose value is a character constant
|
|
containing the flag used to mark a machine-dependent section. This
|
|
corresponds to the <code>SECTION_MACH_DEP</code> section flag.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-CRT_005fCALL_005fSTATIC_005fFUNCTION"></a>Macro: <strong>CRT_CALL_STATIC_FUNCTION</strong> <em>(<var>section_op</var>, <var>function</var>)</em></dt>
|
|
<dd><p>If defined, an ASM statement that switches to a different section
|
|
via <var>section_op</var>, calls <var>function</var>, and switches back to
|
|
the text section. This is used in <samp>crtstuff.c</samp> if
|
|
<code>INIT_SECTION_ASM_OP</code> or <code>FINI_SECTION_ASM_OP</code> to calls
|
|
to initialization and finalization functions from the init and fini
|
|
sections. By default, this macro uses a simple function call. Some
|
|
ports need hand-crafted assembly code to avoid dependencies on
|
|
registers initialized in the function prologue or to ensure that
|
|
constant pools don’t end up too far way in the text section.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fLIBGCC_005fSDATA_005fSECTION"></a>Macro: <strong>TARGET_LIBGCC_SDATA_SECTION</strong></dt>
|
|
<dd><p>If defined, a string which names the section into which small
|
|
variables defined in crtstuff and libgcc should go. This is useful
|
|
when the target has options for optimizing access to small data, and
|
|
you want the crtstuff and libgcc routines to be conservative in what
|
|
they expect of your application yet liberal in what your application
|
|
expects. For example, for targets with a <code>.sdata</code> section (like
|
|
MIPS), you could compile crtstuff with <code>-G 0</code> so that it doesn’t
|
|
require small data support from your application, but use this macro
|
|
to put small data into <code>.sdata</code> so that your application can
|
|
access these variables whether it uses small data or not.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-FORCE_005fCODE_005fSECTION_005fALIGN"></a>Macro: <strong>FORCE_CODE_SECTION_ALIGN</strong></dt>
|
|
<dd><p>If defined, an ASM statement that aligns a code section to some
|
|
arbitrary boundary. This is used to force all fragments of the
|
|
<code>.init</code> and <code>.fini</code> sections to have to same alignment
|
|
and thus prevent the linker from having to add any padding.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-JUMP_005fTABLES_005fIN_005fTEXT_005fSECTION"></a>Macro: <strong>JUMP_TABLES_IN_TEXT_SECTION</strong></dt>
|
|
<dd><p>Define this macro to be an expression with a nonzero value if jump
|
|
tables (for <code>tablejump</code> insns) should be output in the text
|
|
section, along with the assembler instructions. Otherwise, the
|
|
readonly data section is used.
|
|
</p>
|
|
<p>This macro is irrelevant if there is no separate readonly data section.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fINIT_005fSECTIONS"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_INIT_SECTIONS</strong> <em>(void)</em></dt>
|
|
<dd><p>Define this hook if you need to do something special to set up the
|
|
<samp>varasm.c</samp> sections, or if your target has some special sections
|
|
of its own that you need to create.
|
|
</p>
|
|
<p>GCC calls this hook after processing the command line, but before writing
|
|
any assembly code, and before calling any of the section-returning hooks
|
|
described below.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fRELOC_005fRW_005fMASK"></a>Target Hook: <em>int</em> <strong>TARGET_ASM_RELOC_RW_MASK</strong> <em>(void)</em></dt>
|
|
<dd><p>Return a mask describing how relocations should be treated when
|
|
selecting sections. Bit 1 should be set if global relocations
|
|
should be placed in a read-write section; bit 0 should be set if
|
|
local relocations should be placed in a read-write section.
|
|
</p>
|
|
<p>The default version of this function returns 3 when <samp>-fpic</samp>
|
|
is in effect, and 0 otherwise. The hook is typically redefined
|
|
when the target cannot support (some kinds of) dynamic relocations
|
|
in read-only sections even in executables.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fSELECT_005fSECTION"></a>Target Hook: <em>section *</em> <strong>TARGET_ASM_SELECT_SECTION</strong> <em>(tree <var>exp</var>, int <var>reloc</var>, unsigned HOST_WIDE_INT <var>align</var>)</em></dt>
|
|
<dd><p>Return the section into which <var>exp</var> should be placed. You can
|
|
assume that <var>exp</var> is either a <code>VAR_DECL</code> node or a constant of
|
|
some sort. <var>reloc</var> indicates whether the initial value of <var>exp</var>
|
|
requires link-time relocations. Bit 0 is set when variable contains
|
|
local relocations only, while bit 1 is set for global relocations.
|
|
<var>align</var> is the constant alignment in bits.
|
|
</p>
|
|
<p>The default version of this function takes care of putting read-only
|
|
variables in <code>readonly_data_section</code>.
|
|
</p>
|
|
<p>See also <var>USE_SELECT_SECTION_FOR_FUNCTIONS</var>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-USE_005fSELECT_005fSECTION_005fFOR_005fFUNCTIONS"></a>Macro: <strong>USE_SELECT_SECTION_FOR_FUNCTIONS</strong></dt>
|
|
<dd><p>Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called
|
|
for <code>FUNCTION_DECL</code>s as well as for variables and constants.
|
|
</p>
|
|
<p>In the case of a <code>FUNCTION_DECL</code>, <var>reloc</var> will be zero if the
|
|
function has been determined to be likely to be called, and nonzero if
|
|
it is unlikely to be called.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fUNIQUE_005fSECTION"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_UNIQUE_SECTION</strong> <em>(tree <var>decl</var>, int <var>reloc</var>)</em></dt>
|
|
<dd><p>Build up a unique section name, expressed as a <code>STRING_CST</code> node,
|
|
and assign it to ‘<samp>DECL_SECTION_NAME (<var>decl</var>)</samp>’.
|
|
As with <code>TARGET_ASM_SELECT_SECTION</code>, <var>reloc</var> indicates whether
|
|
the initial value of <var>exp</var> requires link-time relocations.
|
|
</p>
|
|
<p>The default version of this function appends the symbol name to the
|
|
ELF section name that would normally be used for the symbol. For
|
|
example, the function <code>foo</code> would be placed in <code>.text.foo</code>.
|
|
Whatever the actual target object format, this is often good enough.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fFUNCTION_005fRODATA_005fSECTION"></a>Target Hook: <em>section *</em> <strong>TARGET_ASM_FUNCTION_RODATA_SECTION</strong> <em>(tree <var>decl</var>)</em></dt>
|
|
<dd><p>Return the readonly data section associated with
|
|
‘<samp>DECL_SECTION_NAME (<var>decl</var>)</samp>’.
|
|
The default version of this function selects <code>.gnu.linkonce.r.name</code> if
|
|
the function’s section is <code>.gnu.linkonce.t.name</code>, <code>.rodata.name</code>
|
|
if function is in <code>.text.name</code>, and the normal readonly-data section
|
|
otherwise.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fMERGEABLE_005fRODATA_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_MERGEABLE_RODATA_PREFIX</strong></dt>
|
|
<dd><p>Usually, the compiler uses the prefix <code>".rodata"</code> to construct
|
|
section names for mergeable constant data. Define this macro to override
|
|
the string if a different section name should be used.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fTM_005fCLONE_005fTABLE_005fSECTION"></a>Target Hook: <em>section *</em> <strong>TARGET_ASM_TM_CLONE_TABLE_SECTION</strong> <em>(void)</em></dt>
|
|
<dd><p>Return the section that should be used for transactional memory clone tables.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fASM_005fSELECT_005fRTX_005fSECTION"></a>Target Hook: <em>section *</em> <strong>TARGET_ASM_SELECT_RTX_SECTION</strong> <em>(machine_mode <var>mode</var>, rtx <var>x</var>, unsigned HOST_WIDE_INT <var>align</var>)</em></dt>
|
|
<dd><p>Return the section into which a constant <var>x</var>, of mode <var>mode</var>,
|
|
should be placed. You can assume that <var>x</var> is some kind of
|
|
constant in RTL. The argument <var>mode</var> is redundant except in the
|
|
case of a <code>const_int</code> rtx. <var>align</var> is the constant alignment
|
|
in bits.
|
|
</p>
|
|
<p>The default version of this function takes care of putting symbolic
|
|
constants in <code>flag_pic</code> mode in <code>data_section</code> and everything
|
|
else in <code>readonly_data_section</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fMANGLE_005fDECL_005fASSEMBLER_005fNAME"></a>Target Hook: <em>tree</em> <strong>TARGET_MANGLE_DECL_ASSEMBLER_NAME</strong> <em>(tree <var>decl</var>, tree <var>id</var>)</em></dt>
|
|
<dd><p>Define this hook if you need to postprocess the assembler name generated
|
|
by target-independent code. The <var>id</var> provided to this hook will be
|
|
the computed name (e.g., the macro <code>DECL_NAME</code> of the <var>decl</var> in C,
|
|
or the mangled name of the <var>decl</var> in C++). The return value of the
|
|
hook is an <code>IDENTIFIER_NODE</code> for the appropriate mangled name on
|
|
your target system. The default implementation of this hook just
|
|
returns the <var>id</var> provided.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fENCODE_005fSECTION_005fINFO"></a>Target Hook: <em>void</em> <strong>TARGET_ENCODE_SECTION_INFO</strong> <em>(tree <var>decl</var>, rtx <var>rtl</var>, int <var>new_decl_p</var>)</em></dt>
|
|
<dd><p>Define this hook if references to a symbol or a constant must be
|
|
treated differently depending on something about the variable or
|
|
function named by the symbol (such as what section it is in).
|
|
</p>
|
|
<p>The hook is executed immediately after rtl has been created for
|
|
<var>decl</var>, which may be a variable or function declaration or
|
|
an entry in the constant pool. In either case, <var>rtl</var> is the
|
|
rtl in question. Do <em>not</em> use <code>DECL_RTL (<var>decl</var>)</code>
|
|
in this hook; that field may not have been initialized yet.
|
|
</p>
|
|
<p>In the case of a constant, it is safe to assume that the rtl is
|
|
a <code>mem</code> whose address is a <code>symbol_ref</code>. Most decls
|
|
will also have this form, but that is not guaranteed. Global
|
|
register variables, for instance, will have a <code>reg</code> for their
|
|
rtl. (Normally the right thing to do with such unusual rtl is
|
|
leave it alone.)
|
|
</p>
|
|
<p>The <var>new_decl_p</var> argument will be true if this is the first time
|
|
that <code>TARGET_ENCODE_SECTION_INFO</code> has been invoked on this decl. It will
|
|
be false for subsequent invocations, which will happen for duplicate
|
|
declarations. Whether or not anything must be done for the duplicate
|
|
declaration depends on whether the hook examines <code>DECL_ATTRIBUTES</code>.
|
|
<var>new_decl_p</var> is always true when the hook is called for a constant.
|
|
</p>
|
|
<a name="index-SYMBOL_005fREF_005fFLAG_002c-in-TARGET_005fENCODE_005fSECTION_005fINFO"></a>
|
|
<p>The usual thing for this hook to do is to record flags in the
|
|
<code>symbol_ref</code>, using <code>SYMBOL_REF_FLAG</code> or <code>SYMBOL_REF_FLAGS</code>.
|
|
Historically, the name string was modified if it was necessary to
|
|
encode more than one bit of information, but this practice is now
|
|
discouraged; use <code>SYMBOL_REF_FLAGS</code>.
|
|
</p>
|
|
<p>The default definition of this hook, <code>default_encode_section_info</code>
|
|
in <samp>varasm.c</samp>, sets a number of commonly-useful bits in
|
|
<code>SYMBOL_REF_FLAGS</code>. Check whether the default does what you need
|
|
before overriding it.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fSTRIP_005fNAME_005fENCODING"></a>Target Hook: <em>const char *</em> <strong>TARGET_STRIP_NAME_ENCODING</strong> <em>(const char *<var>name</var>)</em></dt>
|
|
<dd><p>Decode <var>name</var> and return the real name part, sans
|
|
the characters that <code>TARGET_ENCODE_SECTION_INFO</code>
|
|
may have added.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fIN_005fSMALL_005fDATA_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_IN_SMALL_DATA_P</strong> <em>(const_tree <var>exp</var>)</em></dt>
|
|
<dd><p>Returns true if <var>exp</var> should be placed into a “small data” section.
|
|
The default version of this hook always returns false.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fHAVE_005fSRODATA_005fSECTION"></a>Target Hook: <em>bool</em> <strong>TARGET_HAVE_SRODATA_SECTION</strong></dt>
|
|
<dd><p>Contains the value true if the target places read-only
|
|
“small data” into a separate section. The default value is false.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fPROFILE_005fBEFORE_005fPROLOGUE"></a>Target Hook: <em>bool</em> <strong>TARGET_PROFILE_BEFORE_PROLOGUE</strong> <em>(void)</em></dt>
|
|
<dd><p>It returns true if target wants profile code emitted before prologue.
|
|
</p>
|
|
<p>The default version of this hook use the target macro
|
|
<code>PROFILE_BEFORE_PROLOGUE</code>.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fBINDS_005fLOCAL_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_BINDS_LOCAL_P</strong> <em>(const_tree <var>exp</var>)</em></dt>
|
|
<dd><p>Returns true if <var>exp</var> names an object for which name resolution
|
|
rules must resolve to the current “module” (dynamic shared library
|
|
or executable image).
|
|
</p>
|
|
<p>The default version of this hook implements the name resolution rules
|
|
for ELF, which has a looser model of global name binding than other
|
|
currently supported object file formats.
|
|
</p></dd></dl>
|
|
|
|
<dl>
|
|
<dt><a name="index-TARGET_005fHAVE_005fTLS"></a>Target Hook: <em>bool</em> <strong>TARGET_HAVE_TLS</strong></dt>
|
|
<dd><p>Contains the value true if the target supports thread-local storage.
|
|
The default value is false.
|
|
</p></dd></dl>
|
|
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="PIC.html#PIC" accesskey="n" rel="next">PIC</a>, Previous: <a href="Scheduling.html#Scheduling" accesskey="p" rel="prev">Scheduling</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|