Library-Calls.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Library Calls</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Library Calls">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Library Calls">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Library-Calls"></a>
  63. <div class="header">
  64. <p>
  65. 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>
  66. </div>
  67. <hr>
  68. <a name="Implicit-Calls-to-Library-Routines"></a>
  69. <h3 class="section">17.12 Implicit Calls to Library Routines</h3>
  70. <a name="index-library-subroutine-names"></a>
  71. <a name="index-libgcc_002ea"></a>
  72. <p>Here is an explanation of implicit calls to library routines.
  73. </p>
  74. <dl>
  75. <dt><a name="index-DECLARE_005fLIBRARY_005fRENAMES"></a>Macro: <strong>DECLARE_LIBRARY_RENAMES</strong></dt>
  76. <dd><p>This macro, if defined, should expand to a piece of C code that will get
  77. expanded when compiling functions for libgcc.a. It can be used to
  78. provide alternate names for GCC&rsquo;s internal library functions if there
  79. are ABI-mandated names that the compiler should provide.
  80. </p></dd></dl>
  81. <a name="index-set_005foptab_005flibfunc"></a>
  82. <a name="index-init_005fone_005flibfunc"></a>
  83. <dl>
  84. <dt><a name="index-TARGET_005fINIT_005fLIBFUNCS"></a>Target Hook: <em>void</em> <strong>TARGET_INIT_LIBFUNCS</strong> <em>(void)</em></dt>
  85. <dd><p>This hook should declare additional library routines or rename
  86. existing ones, using the functions <code>set_optab_libfunc</code> and
  87. <code>init_one_libfunc</code> defined in <samp>optabs.c</samp>.
  88. <code>init_optabs</code> calls this macro after initializing all the normal
  89. library routines.
  90. </p>
  91. <p>The default is to do nothing. Most ports don&rsquo;t need to define this hook.
  92. </p></dd></dl>
  93. <dl>
  94. <dt><a name="index-TARGET_005fLIBFUNC_005fGNU_005fPREFIX"></a>Target Hook: <em>bool</em> <strong>TARGET_LIBFUNC_GNU_PREFIX</strong></dt>
  95. <dd><p>If false (the default), internal library routines start with two
  96. underscores. If set to true, these routines start with <code>__gnu_</code>
  97. instead. E.g., <code>__muldi3</code> changes to <code>__gnu_muldi3</code>. This
  98. currently only affects functions defined in <samp>libgcc2.c</samp>. If this
  99. is set to true, the <samp>tm.h</samp> file must also
  100. <code>#define LIBGCC2_GNU_PREFIX</code>.
  101. </p></dd></dl>
  102. <dl>
  103. <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>
  104. <dd><p>This macro should return <code>true</code> if the library routine that
  105. implements the floating point comparison operator <var>comparison</var> in
  106. mode <var>mode</var> will return a boolean, and <var>false</var> if it will
  107. return a tristate.
  108. </p>
  109. <p>GCC&rsquo;s own floating point libraries return tristates from the
  110. comparison operators, so the default returns false always. Most ports
  111. don&rsquo;t need to define this macro.
  112. </p></dd></dl>
  113. <dl>
  114. <dt><a name="index-TARGET_005fLIB_005fINT_005fCMP_005fBIASED"></a>Macro: <strong>TARGET_LIB_INT_CMP_BIASED</strong></dt>
  115. <dd><p>This macro should evaluate to <code>true</code> if the integer comparison
  116. functions (like <code>__cmpdi2</code>) return 0 to indicate that the first
  117. operand is smaller than the second, 1 to indicate that they are equal,
  118. and 2 to indicate that the first operand is greater than the second.
  119. If this macro evaluates to <code>false</code> the comparison functions return
  120. -1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines
  121. in <samp>libgcc.a</samp>, you do not need to define this macro.
  122. </p></dd></dl>
  123. <dl>
  124. <dt><a name="index-TARGET_005fHAS_005fNO_005fHW_005fDIVIDE"></a>Macro: <strong>TARGET_HAS_NO_HW_DIVIDE</strong></dt>
  125. <dd><p>This macro should be defined if the target has no hardware divide
  126. instructions. If this macro is defined, GCC will use an algorithm which
  127. make use of simple logical and arithmetic operations for 64-bit
  128. division. If the macro is not defined, GCC will use an algorithm which
  129. make use of a 64-bit by 32-bit divide primitive.
  130. </p></dd></dl>
  131. <a name="index-EDOM_002c-implicit-usage"></a>
  132. <a name="index-matherr"></a>
  133. <dl>
  134. <dt><a name="index-TARGET_005fEDOM"></a>Macro: <strong>TARGET_EDOM</strong></dt>
  135. <dd><p>The value of <code>EDOM</code> on the target machine, as a C integer constant
  136. expression. If you don&rsquo;t define this macro, GCC does not attempt to
  137. deposit the value of <code>EDOM</code> into <code>errno</code> directly. Look in
  138. <samp>/usr/include/errno.h</samp> to find the value of <code>EDOM</code> on your
  139. system.
  140. </p>
  141. <p>If you do not define <code>TARGET_EDOM</code>, then compiled code reports
  142. domain errors by calling the library function and letting it report the
  143. error. If mathematical functions on your system use <code>matherr</code> when
  144. there is an error, then you should leave <code>TARGET_EDOM</code> undefined so
  145. that <code>matherr</code> is used normally.
  146. </p></dd></dl>
  147. <a name="index-errno_002c-implicit-usage"></a>
  148. <dl>
  149. <dt><a name="index-GEN_005fERRNO_005fRTX"></a>Macro: <strong>GEN_ERRNO_RTX</strong></dt>
  150. <dd><p>Define this macro as a C expression to create an rtl expression that
  151. refers to the global &ldquo;variable&rdquo; <code>errno</code>. (On certain systems,
  152. <code>errno</code> may not actually be a variable.) If you don&rsquo;t define this
  153. macro, a reasonable default is used.
  154. </p></dd></dl>
  155. <dl>
  156. <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>
  157. <dd><p>This hook determines whether a function from a class of functions
  158. <var>fn_class</var> is present at the runtime.
  159. </p></dd></dl>
  160. <dl>
  161. <dt><a name="index-NEXT_005fOBJC_005fRUNTIME"></a>Macro: <strong>NEXT_OBJC_RUNTIME</strong></dt>
  162. <dd><p>Set this macro to 1 to use the &quot;NeXT&quot; Objective-C message sending conventions
  163. by default. This calling convention involves passing the object, the selector
  164. and the method arguments all at once to the method-lookup library function.
  165. This is the usual setting when targeting Darwin/Mac OS X systems, which have
  166. the NeXT runtime installed.
  167. </p>
  168. <p>If the macro is set to 0, the &quot;GNU&quot; Objective-C message sending convention
  169. will be used by default. This convention passes just the object and the
  170. selector to the method-lookup function, which returns a pointer to the method.
  171. </p>
  172. <p>In either case, it remains possible to select code-generation for the alternate
  173. scheme, by means of compiler command line switches.
  174. </p></dd></dl>
  175. <hr>
  176. <div class="header">
  177. <p>
  178. 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>
  179. </div>
  180. </body>
  181. </html>