Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Sections (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Sections (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Sections (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Target-Macros.html#Target-Macros" rel="up" title="Target Macros">
  30. <link href="PIC.html#PIC" rel="next" title="PIC">
  31. <link href="Scheduling.html#Scheduling" rel="prev" title="Scheduling">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Sections"></a>
  62. <div class="header">
  63. <p>
  64. 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> &nbsp; [<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>
  65. </div>
  66. <hr>
  67. <a name="Dividing-the-Output-into-Sections-_0028Texts_002c-Data_002c-_2026_0029"></a>
  68. <h3 class="section">18.18 Dividing the Output into Sections (Texts, Data, &hellip;)</h3>
  69. <p>An object file is divided into sections containing different types of
  70. data. In the most common case, there are three sections: the <em>text
  71. section</em>, which holds instructions and read-only data; the <em>data
  72. section</em>, which holds initialized writable data; and the <em>bss
  73. section</em>, which holds uninitialized data. Some systems have other kinds
  74. of sections.
  75. </p>
  76. <p><samp>varasm.c</samp> provides several well-known sections, such as
  77. <code>text_section</code>, <code>data_section</code> and <code>bss_section</code>.
  78. The normal way of controlling a <code><var>foo</var>_section</code> variable
  79. is to define the associated <code><var>FOO</var>_SECTION_ASM_OP</code> macro,
  80. as described below. The macros are only read once, when <samp>varasm.c</samp>
  81. initializes itself, so their values must be run-time constants.
  82. They may however depend on command-line flags.
  83. </p>
  84. <p><em>Note:</em> Some run-time files, such <samp>crtstuff.c</samp>, also make
  85. use of the <code><var>FOO</var>_SECTION_ASM_OP</code> macros, and expect them
  86. to be string literals.
  87. </p>
  88. <p>Some assemblers require a different string to be written every time a
  89. section is selected. If your assembler falls into this category, you
  90. should define the <code>TARGET_ASM_INIT_SECTIONS</code> hook and use
  91. <code>get_unnamed_section</code> to set up the sections.
  92. </p>
  93. <p>You must always create a <code>text_section</code>, either by defining
  94. <code>TEXT_SECTION_ASM_OP</code> or by initializing <code>text_section</code>
  95. in <code>TARGET_ASM_INIT_SECTIONS</code>. The same is true of
  96. <code>data_section</code> and <code>DATA_SECTION_ASM_OP</code>. If you do not
  97. create a distinct <code>readonly_data_section</code>, the default is to
  98. reuse <code>text_section</code>.
  99. </p>
  100. <p>All the other <samp>varasm.c</samp> sections are optional, and are null
  101. if the target does not provide them.
  102. </p>
  103. <dl>
  104. <dt><a name="index-TEXT_005fSECTION_005fASM_005fOP"></a>Macro: <strong>TEXT_SECTION_ASM_OP</strong></dt>
  105. <dd><p>A C expression whose value is a string, including spacing, containing the
  106. assembler operation that should precede instructions and read-only data.
  107. Normally <code>&quot;\t.text&quot;</code> is right.
  108. </p></dd></dl>
  109. <dl>
  110. <dt><a name="index-HOT_005fTEXT_005fSECTION_005fNAME"></a>Macro: <strong>HOT_TEXT_SECTION_NAME</strong></dt>
  111. <dd><p>If defined, a C string constant for the name of the section containing most
  112. frequently executed functions of the program. If not defined, GCC will provide
  113. a default definition if the target supports named sections.
  114. </p></dd></dl>
  115. <dl>
  116. <dt><a name="index-UNLIKELY_005fEXECUTED_005fTEXT_005fSECTION_005fNAME"></a>Macro: <strong>UNLIKELY_EXECUTED_TEXT_SECTION_NAME</strong></dt>
  117. <dd><p>If defined, a C string constant for the name of the section containing unlikely
  118. executed functions in the program.
  119. </p></dd></dl>
  120. <dl>
  121. <dt><a name="index-DATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>DATA_SECTION_ASM_OP</strong></dt>
  122. <dd><p>A C expression whose value is a string, including spacing, containing the
  123. assembler operation to identify the following data as writable initialized
  124. data. Normally <code>&quot;\t.data&quot;</code> is right.
  125. </p></dd></dl>
  126. <dl>
  127. <dt><a name="index-SDATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>SDATA_SECTION_ASM_OP</strong></dt>
  128. <dd><p>If defined, a C expression whose value is a string, including spacing,
  129. containing the assembler operation to identify the following data as
  130. initialized, writable small data.
  131. </p></dd></dl>
  132. <dl>
  133. <dt><a name="index-READONLY_005fDATA_005fSECTION_005fASM_005fOP"></a>Macro: <strong>READONLY_DATA_SECTION_ASM_OP</strong></dt>
  134. <dd><p>A C expression whose value is a string, including spacing, containing the
  135. assembler operation to identify the following data as read-only initialized
  136. data.
  137. </p></dd></dl>
  138. <dl>
  139. <dt><a name="index-BSS_005fSECTION_005fASM_005fOP"></a>Macro: <strong>BSS_SECTION_ASM_OP</strong></dt>
  140. <dd><p>If defined, a C expression whose value is a string, including spacing,
  141. containing the assembler operation to identify the following data as
  142. uninitialized global data. If not defined, and
  143. <code>ASM_OUTPUT_ALIGNED_BSS</code> not defined,
  144. uninitialized global data will be output in the data section if
  145. <samp>-fno-common</samp> is passed, otherwise <code>ASM_OUTPUT_COMMON</code> will be
  146. used.
  147. </p></dd></dl>
  148. <dl>
  149. <dt><a name="index-SBSS_005fSECTION_005fASM_005fOP"></a>Macro: <strong>SBSS_SECTION_ASM_OP</strong></dt>
  150. <dd><p>If defined, a C expression whose value is a string, including spacing,
  151. containing the assembler operation to identify the following data as
  152. uninitialized, writable small data.
  153. </p></dd></dl>
  154. <dl>
  155. <dt><a name="index-TLS_005fCOMMON_005fASM_005fOP"></a>Macro: <strong>TLS_COMMON_ASM_OP</strong></dt>
  156. <dd><p>If defined, a C expression whose value is a string containing the
  157. assembler operation to identify the following data as thread-local
  158. common data. The default is <code>&quot;.tls_common&quot;</code>.
  159. </p></dd></dl>
  160. <dl>
  161. <dt><a name="index-TLS_005fSECTION_005fASM_005fFLAG"></a>Macro: <strong>TLS_SECTION_ASM_FLAG</strong></dt>
  162. <dd><p>If defined, a C expression whose value is a character constant
  163. containing the flag used to mark a section as a TLS section. The
  164. default is <code>'T'</code>.
  165. </p></dd></dl>
  166. <dl>
  167. <dt><a name="index-INIT_005fSECTION_005fASM_005fOP"></a>Macro: <strong>INIT_SECTION_ASM_OP</strong></dt>
  168. <dd><p>If defined, a C expression whose value is a string, including spacing,
  169. containing the assembler operation to identify the following data as
  170. initialization code. If not defined, GCC will assume such a section does
  171. not exist. This section has no corresponding <code>init_section</code>
  172. variable; it is used entirely in runtime code.
  173. </p></dd></dl>
  174. <dl>
  175. <dt><a name="index-FINI_005fSECTION_005fASM_005fOP"></a>Macro: <strong>FINI_SECTION_ASM_OP</strong></dt>
  176. <dd><p>If defined, a C expression whose value is a string, including spacing,
  177. containing the assembler operation to identify the following data as
  178. finalization code. If not defined, GCC will assume such a section does
  179. not exist. This section has no corresponding <code>fini_section</code>
  180. variable; it is used entirely in runtime code.
  181. </p></dd></dl>
  182. <dl>
  183. <dt><a name="index-INIT_005fARRAY_005fSECTION_005fASM_005fOP"></a>Macro: <strong>INIT_ARRAY_SECTION_ASM_OP</strong></dt>
  184. <dd><p>If defined, a C expression whose value is a string, including spacing,
  185. containing the assembler operation to identify the following data as
  186. part of the <code>.init_array</code> (or equivalent) section. If not
  187. defined, GCC will assume such a section does not exist. Do not define
  188. both this macro and <code>INIT_SECTION_ASM_OP</code>.
  189. </p></dd></dl>
  190. <dl>
  191. <dt><a name="index-FINI_005fARRAY_005fSECTION_005fASM_005fOP"></a>Macro: <strong>FINI_ARRAY_SECTION_ASM_OP</strong></dt>
  192. <dd><p>If defined, a C expression whose value is a string, including spacing,
  193. containing the assembler operation to identify the following data as
  194. part of the <code>.fini_array</code> (or equivalent) section. If not
  195. defined, GCC will assume such a section does not exist. Do not define
  196. both this macro and <code>FINI_SECTION_ASM_OP</code>.
  197. </p></dd></dl>
  198. <dl>
  199. <dt><a name="index-MACH_005fDEP_005fSECTION_005fASM_005fFLAG"></a>Macro: <strong>MACH_DEP_SECTION_ASM_FLAG</strong></dt>
  200. <dd><p>If defined, a C expression whose value is a character constant
  201. containing the flag used to mark a machine-dependent section. This
  202. corresponds to the <code>SECTION_MACH_DEP</code> section flag.
  203. </p></dd></dl>
  204. <dl>
  205. <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>
  206. <dd><p>If defined, an ASM statement that switches to a different section
  207. via <var>section_op</var>, calls <var>function</var>, and switches back to
  208. the text section. This is used in <samp>crtstuff.c</samp> if
  209. <code>INIT_SECTION_ASM_OP</code> or <code>FINI_SECTION_ASM_OP</code> to calls
  210. to initialization and finalization functions from the init and fini
  211. sections. By default, this macro uses a simple function call. Some
  212. ports need hand-crafted assembly code to avoid dependencies on
  213. registers initialized in the function prologue or to ensure that
  214. constant pools don&rsquo;t end up too far way in the text section.
  215. </p></dd></dl>
  216. <dl>
  217. <dt><a name="index-TARGET_005fLIBGCC_005fSDATA_005fSECTION"></a>Macro: <strong>TARGET_LIBGCC_SDATA_SECTION</strong></dt>
  218. <dd><p>If defined, a string which names the section into which small
  219. variables defined in crtstuff and libgcc should go. This is useful
  220. when the target has options for optimizing access to small data, and
  221. you want the crtstuff and libgcc routines to be conservative in what
  222. they expect of your application yet liberal in what your application
  223. expects. For example, for targets with a <code>.sdata</code> section (like
  224. MIPS), you could compile crtstuff with <code>-G 0</code> so that it doesn&rsquo;t
  225. require small data support from your application, but use this macro
  226. to put small data into <code>.sdata</code> so that your application can
  227. access these variables whether it uses small data or not.
  228. </p></dd></dl>
  229. <dl>
  230. <dt><a name="index-FORCE_005fCODE_005fSECTION_005fALIGN"></a>Macro: <strong>FORCE_CODE_SECTION_ALIGN</strong></dt>
  231. <dd><p>If defined, an ASM statement that aligns a code section to some
  232. arbitrary boundary. This is used to force all fragments of the
  233. <code>.init</code> and <code>.fini</code> sections to have to same alignment
  234. and thus prevent the linker from having to add any padding.
  235. </p></dd></dl>
  236. <dl>
  237. <dt><a name="index-JUMP_005fTABLES_005fIN_005fTEXT_005fSECTION"></a>Macro: <strong>JUMP_TABLES_IN_TEXT_SECTION</strong></dt>
  238. <dd><p>Define this macro to be an expression with a nonzero value if jump
  239. tables (for <code>tablejump</code> insns) should be output in the text
  240. section, along with the assembler instructions. Otherwise, the
  241. readonly data section is used.
  242. </p>
  243. <p>This macro is irrelevant if there is no separate readonly data section.
  244. </p></dd></dl>
  245. <dl>
  246. <dt><a name="index-TARGET_005fASM_005fINIT_005fSECTIONS"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_INIT_SECTIONS</strong> <em>(void)</em></dt>
  247. <dd><p>Define this hook if you need to do something special to set up the
  248. <samp>varasm.c</samp> sections, or if your target has some special sections
  249. of its own that you need to create.
  250. </p>
  251. <p>GCC calls this hook after processing the command line, but before writing
  252. any assembly code, and before calling any of the section-returning hooks
  253. described below.
  254. </p></dd></dl>
  255. <dl>
  256. <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>
  257. <dd><p>Return a mask describing how relocations should be treated when
  258. selecting sections. Bit 1 should be set if global relocations
  259. should be placed in a read-write section; bit 0 should be set if
  260. local relocations should be placed in a read-write section.
  261. </p>
  262. <p>The default version of this function returns 3 when <samp>-fpic</samp>
  263. is in effect, and 0 otherwise. The hook is typically redefined
  264. when the target cannot support (some kinds of) dynamic relocations
  265. in read-only sections even in executables.
  266. </p></dd></dl>
  267. <dl>
  268. <dt><a name="index-TARGET_005fASM_005fGENERATE_005fPIC_005fADDR_005fDIFF_005fVEC"></a>Target Hook: <em>bool</em> <strong>TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC</strong> <em>(void)</em></dt>
  269. <dd><p>Return true to generate ADDR_DIF_VEC table
  270. or false to generate ADDR_VEC table for jumps in case of -fPIC.
  271. </p>
  272. <p>The default version of this function returns true if flag_pic
  273. equals true and false otherwise
  274. </p></dd></dl>
  275. <dl>
  276. <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>
  277. <dd><p>Return the section into which <var>exp</var> should be placed. You can
  278. assume that <var>exp</var> is either a <code>VAR_DECL</code> node or a constant of
  279. some sort. <var>reloc</var> indicates whether the initial value of <var>exp</var>
  280. requires link-time relocations. Bit 0 is set when variable contains
  281. local relocations only, while bit 1 is set for global relocations.
  282. <var>align</var> is the constant alignment in bits.
  283. </p>
  284. <p>The default version of this function takes care of putting read-only
  285. variables in <code>readonly_data_section</code>.
  286. </p>
  287. <p>See also <var>USE_SELECT_SECTION_FOR_FUNCTIONS</var>.
  288. </p></dd></dl>
  289. <dl>
  290. <dt><a name="index-USE_005fSELECT_005fSECTION_005fFOR_005fFUNCTIONS"></a>Macro: <strong>USE_SELECT_SECTION_FOR_FUNCTIONS</strong></dt>
  291. <dd><p>Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called
  292. for <code>FUNCTION_DECL</code>s as well as for variables and constants.
  293. </p>
  294. <p>In the case of a <code>FUNCTION_DECL</code>, <var>reloc</var> will be zero if the
  295. function has been determined to be likely to be called, and nonzero if
  296. it is unlikely to be called.
  297. </p></dd></dl>
  298. <dl>
  299. <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>
  300. <dd><p>Build up a unique section name, expressed as a <code>STRING_CST</code> node,
  301. and assign it to &lsquo;<samp>DECL_SECTION_NAME (<var>decl</var>)</samp>&rsquo;.
  302. As with <code>TARGET_ASM_SELECT_SECTION</code>, <var>reloc</var> indicates whether
  303. the initial value of <var>exp</var> requires link-time relocations.
  304. </p>
  305. <p>The default version of this function appends the symbol name to the
  306. ELF section name that would normally be used for the symbol. For
  307. example, the function <code>foo</code> would be placed in <code>.text.foo</code>.
  308. Whatever the actual target object format, this is often good enough.
  309. </p></dd></dl>
  310. <dl>
  311. <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>
  312. <dd><p>Return the readonly data section associated with
  313. &lsquo;<samp>DECL_SECTION_NAME (<var>decl</var>)</samp>&rsquo;.
  314. The default version of this function selects <code>.gnu.linkonce.r.name</code> if
  315. the function&rsquo;s section is <code>.gnu.linkonce.t.name</code>, <code>.rodata.name</code>
  316. if function is in <code>.text.name</code>, and the normal readonly-data section
  317. otherwise.
  318. </p></dd></dl>
  319. <dl>
  320. <dt><a name="index-TARGET_005fASM_005fMERGEABLE_005fRODATA_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_MERGEABLE_RODATA_PREFIX</strong></dt>
  321. <dd><p>Usually, the compiler uses the prefix <code>&quot;.rodata&quot;</code> to construct
  322. section names for mergeable constant data. Define this macro to override
  323. the string if a different section name should be used.
  324. </p></dd></dl>
  325. <dl>
  326. <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>
  327. <dd><p>Return the section that should be used for transactional memory clone tables.
  328. </p></dd></dl>
  329. <dl>
  330. <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>
  331. <dd><p>Return the section into which a constant <var>x</var>, of mode <var>mode</var>,
  332. should be placed. You can assume that <var>x</var> is some kind of
  333. constant in RTL. The argument <var>mode</var> is redundant except in the
  334. case of a <code>const_int</code> rtx. <var>align</var> is the constant alignment
  335. in bits.
  336. </p>
  337. <p>The default version of this function takes care of putting symbolic
  338. constants in <code>flag_pic</code> mode in <code>data_section</code> and everything
  339. else in <code>readonly_data_section</code>.
  340. </p></dd></dl>
  341. <dl>
  342. <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>
  343. <dd><p>Define this hook if you need to postprocess the assembler name generated
  344. by target-independent code. The <var>id</var> provided to this hook will be
  345. the computed name (e.g., the macro <code>DECL_NAME</code> of the <var>decl</var> in C,
  346. or the mangled name of the <var>decl</var> in C++). The return value of the
  347. hook is an <code>IDENTIFIER_NODE</code> for the appropriate mangled name on
  348. your target system. The default implementation of this hook just
  349. returns the <var>id</var> provided.
  350. </p></dd></dl>
  351. <dl>
  352. <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>
  353. <dd><p>Define this hook if references to a symbol or a constant must be
  354. treated differently depending on something about the variable or
  355. function named by the symbol (such as what section it is in).
  356. </p>
  357. <p>The hook is executed immediately after rtl has been created for
  358. <var>decl</var>, which may be a variable or function declaration or
  359. an entry in the constant pool. In either case, <var>rtl</var> is the
  360. rtl in question. Do <em>not</em> use <code>DECL_RTL (<var>decl</var>)</code>
  361. in this hook; that field may not have been initialized yet.
  362. </p>
  363. <p>In the case of a constant, it is safe to assume that the rtl is
  364. a <code>mem</code> whose address is a <code>symbol_ref</code>. Most decls
  365. will also have this form, but that is not guaranteed. Global
  366. register variables, for instance, will have a <code>reg</code> for their
  367. rtl. (Normally the right thing to do with such unusual rtl is
  368. leave it alone.)
  369. </p>
  370. <p>The <var>new_decl_p</var> argument will be true if this is the first time
  371. that <code>TARGET_ENCODE_SECTION_INFO</code> has been invoked on this decl. It will
  372. be false for subsequent invocations, which will happen for duplicate
  373. declarations. Whether or not anything must be done for the duplicate
  374. declaration depends on whether the hook examines <code>DECL_ATTRIBUTES</code>.
  375. <var>new_decl_p</var> is always true when the hook is called for a constant.
  376. </p>
  377. <a name="index-SYMBOL_005fREF_005fFLAG_002c-in-TARGET_005fENCODE_005fSECTION_005fINFO"></a>
  378. <p>The usual thing for this hook to do is to record flags in the
  379. <code>symbol_ref</code>, using <code>SYMBOL_REF_FLAG</code> or <code>SYMBOL_REF_FLAGS</code>.
  380. Historically, the name string was modified if it was necessary to
  381. encode more than one bit of information, but this practice is now
  382. discouraged; use <code>SYMBOL_REF_FLAGS</code>.
  383. </p>
  384. <p>The default definition of this hook, <code>default_encode_section_info</code>
  385. in <samp>varasm.c</samp>, sets a number of commonly-useful bits in
  386. <code>SYMBOL_REF_FLAGS</code>. Check whether the default does what you need
  387. before overriding it.
  388. </p></dd></dl>
  389. <dl>
  390. <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>
  391. <dd><p>Decode <var>name</var> and return the real name part, sans
  392. the characters that <code>TARGET_ENCODE_SECTION_INFO</code>
  393. may have added.
  394. </p></dd></dl>
  395. <dl>
  396. <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>
  397. <dd><p>Returns true if <var>exp</var> should be placed into a &ldquo;small data&rdquo; section.
  398. The default version of this hook always returns false.
  399. </p></dd></dl>
  400. <dl>
  401. <dt><a name="index-TARGET_005fHAVE_005fSRODATA_005fSECTION"></a>Target Hook: <em>bool</em> <strong>TARGET_HAVE_SRODATA_SECTION</strong></dt>
  402. <dd><p>Contains the value true if the target places read-only
  403. &ldquo;small data&rdquo; into a separate section. The default value is false.
  404. </p></dd></dl>
  405. <dl>
  406. <dt><a name="index-TARGET_005fPROFILE_005fBEFORE_005fPROLOGUE"></a>Target Hook: <em>bool</em> <strong>TARGET_PROFILE_BEFORE_PROLOGUE</strong> <em>(void)</em></dt>
  407. <dd><p>It returns true if target wants profile code emitted before prologue.
  408. </p>
  409. <p>The default version of this hook use the target macro
  410. <code>PROFILE_BEFORE_PROLOGUE</code>.
  411. </p></dd></dl>
  412. <dl>
  413. <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>
  414. <dd><p>Returns true if <var>exp</var> names an object for which name resolution
  415. rules must resolve to the current &ldquo;module&rdquo; (dynamic shared library
  416. or executable image).
  417. </p>
  418. <p>The default version of this hook implements the name resolution rules
  419. for ELF, which has a looser model of global name binding than other
  420. currently supported object file formats.
  421. </p></dd></dl>
  422. <dl>
  423. <dt><a name="index-TARGET_005fHAVE_005fTLS"></a>Target Hook: <em>bool</em> <strong>TARGET_HAVE_TLS</strong></dt>
  424. <dd><p>Contains the value true if the target supports thread-local storage.
  425. The default value is false.
  426. </p></dd></dl>
  427. <hr>
  428. <div class="header">
  429. <p>
  430. 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> &nbsp; [<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>
  431. </div>
  432. </body>
  433. </html>