You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
10KB

  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>Library Calls (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Library Calls (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Library Calls (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="Addressing-Modes.html#Addressing-Modes" rel="next" title="Addressing Modes">
  31. <link href="Trampolines.html#Trampolines" rel="prev" title="Trampolines">
  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="Library-Calls"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Addressing-Modes.html#Addressing-Modes" accesskey="n" rel="next">Addressing Modes</a>, Previous: <a href="Trampolines.html#Trampolines" accesskey="p" rel="prev">Trampolines</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="Implicit-Calls-to-Library-Routines"></a>
  68. <h3 class="section">18.12 Implicit Calls to Library Routines</h3>
  69. <a name="index-library-subroutine-names"></a>
  70. <a name="index-libgcc_002ea"></a>
  71. <p>Here is an explanation of implicit calls to library routines.
  72. </p>
  73. <dl>
  74. <dt><a name="index-DECLARE_005fLIBRARY_005fRENAMES"></a>Macro: <strong>DECLARE_LIBRARY_RENAMES</strong></dt>
  75. <dd><p>This macro, if defined, should expand to a piece of C code that will get
  76. expanded when compiling functions for libgcc.a. It can be used to
  77. provide alternate names for GCC&rsquo;s internal library functions if there
  78. are ABI-mandated names that the compiler should provide.
  79. </p></dd></dl>
  80. <a name="index-set_005foptab_005flibfunc"></a>
  81. <a name="index-init_005fone_005flibfunc"></a>
  82. <dl>
  83. <dt><a name="index-TARGET_005fINIT_005fLIBFUNCS"></a>Target Hook: <em>void</em> <strong>TARGET_INIT_LIBFUNCS</strong> <em>(void)</em></dt>
  84. <dd><p>This hook should declare additional library routines or rename
  85. existing ones, using the functions <code>set_optab_libfunc</code> and
  86. <code>init_one_libfunc</code> defined in <samp>optabs.c</samp>.
  87. <code>init_optabs</code> calls this macro after initializing all the normal
  88. library routines.
  89. </p>
  90. <p>The default is to do nothing. Most ports don&rsquo;t need to define this hook.
  91. </p></dd></dl>
  92. <dl>
  93. <dt><a name="index-TARGET_005fLIBFUNC_005fGNU_005fPREFIX"></a>Target Hook: <em>bool</em> <strong>TARGET_LIBFUNC_GNU_PREFIX</strong></dt>
  94. <dd><p>If false (the default), internal library routines start with two
  95. underscores. If set to true, these routines start with <code>__gnu_</code>
  96. instead. E.g., <code>__muldi3</code> changes to <code>__gnu_muldi3</code>. This
  97. currently only affects functions defined in <samp>libgcc2.c</samp>. If this
  98. is set to true, the <samp>tm.h</samp> file must also
  99. <code>#define LIBGCC2_GNU_PREFIX</code>.
  100. </p></dd></dl>
  101. <dl>
  102. <dt><a name="index-FLOAT_005fLIB_005fCOMPARE_005fRETURNS_005fBOOL"></a>Macro: <strong>FLOAT_LIB_COMPARE_RETURNS_BOOL</strong> <em>(<var>mode</var>, <var>comparison</var>)</em></dt>
  103. <dd><p>This macro should return <code>true</code> if the library routine that
  104. implements the floating point comparison operator <var>comparison</var> in
  105. mode <var>mode</var> will return a boolean, and <var>false</var> if it will
  106. return a tristate.
  107. </p>
  108. <p>GCC&rsquo;s own floating point libraries return tristates from the
  109. comparison operators, so the default returns false always. Most ports
  110. don&rsquo;t need to define this macro.
  111. </p></dd></dl>
  112. <dl>
  113. <dt><a name="index-TARGET_005fLIB_005fINT_005fCMP_005fBIASED"></a>Macro: <strong>TARGET_LIB_INT_CMP_BIASED</strong></dt>
  114. <dd><p>This macro should evaluate to <code>true</code> if the integer comparison
  115. functions (like <code>__cmpdi2</code>) return 0 to indicate that the first
  116. operand is smaller than the second, 1 to indicate that they are equal,
  117. and 2 to indicate that the first operand is greater than the second.
  118. If this macro evaluates to <code>false</code> the comparison functions return
  119. -1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines
  120. in <samp>libgcc.a</samp>, you do not need to define this macro.
  121. </p></dd></dl>
  122. <dl>
  123. <dt><a name="index-TARGET_005fHAS_005fNO_005fHW_005fDIVIDE"></a>Macro: <strong>TARGET_HAS_NO_HW_DIVIDE</strong></dt>
  124. <dd><p>This macro should be defined if the target has no hardware divide
  125. instructions. If this macro is defined, GCC will use an algorithm which
  126. make use of simple logical and arithmetic operations for 64-bit
  127. division. If the macro is not defined, GCC will use an algorithm which
  128. make use of a 64-bit by 32-bit divide primitive.
  129. </p></dd></dl>
  130. <a name="index-EDOM_002c-implicit-usage"></a>
  131. <a name="index-matherr"></a>
  132. <dl>
  133. <dt><a name="index-TARGET_005fEDOM"></a>Macro: <strong>TARGET_EDOM</strong></dt>
  134. <dd><p>The value of <code>EDOM</code> on the target machine, as a C integer constant
  135. expression. If you don&rsquo;t define this macro, GCC does not attempt to
  136. deposit the value of <code>EDOM</code> into <code>errno</code> directly. Look in
  137. <samp>/usr/include/errno.h</samp> to find the value of <code>EDOM</code> on your
  138. system.
  139. </p>
  140. <p>If you do not define <code>TARGET_EDOM</code>, then compiled code reports
  141. domain errors by calling the library function and letting it report the
  142. error. If mathematical functions on your system use <code>matherr</code> when
  143. there is an error, then you should leave <code>TARGET_EDOM</code> undefined so
  144. that <code>matherr</code> is used normally.
  145. </p></dd></dl>
  146. <a name="index-errno_002c-implicit-usage"></a>
  147. <dl>
  148. <dt><a name="index-GEN_005fERRNO_005fRTX"></a>Macro: <strong>GEN_ERRNO_RTX</strong></dt>
  149. <dd><p>Define this macro as a C expression to create an rtl expression that
  150. refers to the global &ldquo;variable&rdquo; <code>errno</code>. (On certain systems,
  151. <code>errno</code> may not actually be a variable.) If you don&rsquo;t define this
  152. macro, a reasonable default is used.
  153. </p></dd></dl>
  154. <dl>
  155. <dt><a name="index-TARGET_005fLIBC_005fHAS_005fFUNCTION"></a>Target Hook: <em>bool</em> <strong>TARGET_LIBC_HAS_FUNCTION</strong> <em>(enum function_class <var>fn_class</var>)</em></dt>
  156. <dd><p>This hook determines whether a function from a class of functions
  157. <var>fn_class</var> is present in the target C library.
  158. </p></dd></dl>
  159. <dl>
  160. <dt><a name="index-TARGET_005fLIBC_005fHAS_005fFAST_005fFUNCTION"></a>Target Hook: <em>bool</em> <strong>TARGET_LIBC_HAS_FAST_FUNCTION</strong> <em>(int <var>fcode</var>)</em></dt>
  161. <dd><p>This hook determines whether a function from a class of functions
  162. <code>(enum function_class)</code><var>fcode</var> has a fast implementation.
  163. </p></dd></dl>
  164. <dl>
  165. <dt><a name="index-NEXT_005fOBJC_005fRUNTIME"></a>Macro: <strong>NEXT_OBJC_RUNTIME</strong></dt>
  166. <dd><p>Set this macro to 1 to use the &quot;NeXT&quot; Objective-C message sending conventions
  167. by default. This calling convention involves passing the object, the selector
  168. and the method arguments all at once to the method-lookup library function.
  169. This is the usual setting when targeting Darwin/Mac OS X systems, which have
  170. the NeXT runtime installed.
  171. </p>
  172. <p>If the macro is set to 0, the &quot;GNU&quot; Objective-C message sending convention
  173. will be used by default. This convention passes just the object and the
  174. selector to the method-lookup function, which returns a pointer to the method.
  175. </p>
  176. <p>In either case, it remains possible to select code-generation for the alternate
  177. scheme, by means of compiler command line switches.
  178. </p></dd></dl>
  179. <hr>
  180. <div class="header">
  181. <p>
  182. Next: <a href="Addressing-Modes.html#Addressing-Modes" accesskey="n" rel="next">Addressing Modes</a>, Previous: <a href="Trampolines.html#Trampolines" accesskey="p" rel="prev">Trampolines</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>
  183. </div>
  184. </body>
  185. </html>