Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

244 lines
11KB

  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>RISC-V Options (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="RISC-V Options (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="RISC-V Options (Using the GNU Compiler Collection (GCC))">
  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="Submodel-Options.html#Submodel-Options" rel="up" title="Submodel Options">
  30. <link href="RL78-Options.html#RL78-Options" rel="next" title="RL78 Options">
  31. <link href="PRU-Options.html#PRU-Options" rel="prev" title="PRU Options">
  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="RISC_002dV-Options"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="RL78-Options.html#RL78-Options" accesskey="n" rel="next">RL78 Options</a>, Previous: <a href="PRU-Options.html#PRU-Options" accesskey="p" rel="prev">PRU Options</a>, Up: <a href="Submodel-Options.html#Submodel-Options" accesskey="u" rel="up">Submodel Options</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="RISC_002dV-Options-1"></a>
  68. <h4 class="subsection">3.19.42 RISC-V Options</h4>
  69. <a name="index-RISC_002dV-Options"></a>
  70. <p>These command-line options are defined for RISC-V targets:
  71. </p>
  72. <dl compact="compact">
  73. <dt><code>-mbranch-cost=<var>n</var></code></dt>
  74. <dd><a name="index-mbranch_002dcost-3"></a>
  75. <p>Set the cost of branches to roughly <var>n</var> instructions.
  76. </p>
  77. </dd>
  78. <dt><code>-mplt</code></dt>
  79. <dt><code>-mno-plt</code></dt>
  80. <dd><a name="index-plt"></a>
  81. <p>When generating PIC code, do or don&rsquo;t allow the use of PLTs. Ignored for
  82. non-PIC. The default is <samp>-mplt</samp>.
  83. </p>
  84. </dd>
  85. <dt><code>-mabi=<var>ABI-string</var></code></dt>
  86. <dd><a name="index-mabi-3"></a>
  87. <p>Specify integer and floating-point calling convention. <var>ABI-string</var>
  88. contains two parts: the size of integer types and the registers used for
  89. floating-point types. For example &lsquo;<samp>-march=rv64ifd -mabi=lp64d</samp>&rsquo; means that
  90. &lsquo;<samp>long</samp>&rsquo; and pointers are 64-bit (implicitly defining &lsquo;<samp>int</samp>&rsquo; to be
  91. 32-bit), and that floating-point values up to 64 bits wide are passed in F
  92. registers. Contrast this with &lsquo;<samp>-march=rv64ifd -mabi=lp64f</samp>&rsquo;, which still
  93. allows the compiler to generate code that uses the F and D extensions but only
  94. allows floating-point values up to 32 bits long to be passed in registers; or
  95. &lsquo;<samp>-march=rv64ifd -mabi=lp64</samp>&rsquo;, in which no floating-point arguments will be
  96. passed in registers.
  97. </p>
  98. <p>The default for this argument is system dependent, users who want a specific
  99. calling convention should specify one explicitly. The valid calling
  100. conventions are: &lsquo;<samp>ilp32</samp>&rsquo;, &lsquo;<samp>ilp32f</samp>&rsquo;, &lsquo;<samp>ilp32d</samp>&rsquo;, &lsquo;<samp>lp64</samp>&rsquo;,
  101. &lsquo;<samp>lp64f</samp>&rsquo;, and &lsquo;<samp>lp64d</samp>&rsquo;. Some calling conventions are impossible to
  102. implement on some ISAs: for example, &lsquo;<samp>-march=rv32if -mabi=ilp32d</samp>&rsquo; is
  103. invalid because the ABI requires 64-bit values be passed in F registers, but F
  104. registers are only 32 bits wide. There is also the &lsquo;<samp>ilp32e</samp>&rsquo; ABI that can
  105. only be used with the &lsquo;<samp>rv32e</samp>&rsquo; architecture. This ABI is not well
  106. specified at present, and is subject to change.
  107. </p>
  108. </dd>
  109. <dt><code>-mfdiv</code></dt>
  110. <dt><code>-mno-fdiv</code></dt>
  111. <dd><a name="index-mfdiv"></a>
  112. <p>Do or don&rsquo;t use hardware floating-point divide and square root instructions.
  113. This requires the F or D extensions for floating-point registers. The default
  114. is to use them if the specified architecture has these instructions.
  115. </p>
  116. </dd>
  117. <dt><code>-mdiv</code></dt>
  118. <dt><code>-mno-div</code></dt>
  119. <dd><a name="index-mdiv-4"></a>
  120. <p>Do or don&rsquo;t use hardware instructions for integer division. This requires the
  121. M extension. The default is to use them if the specified architecture has
  122. these instructions.
  123. </p>
  124. </dd>
  125. <dt><code>-march=<var>ISA-string</var></code></dt>
  126. <dd><a name="index-march-12"></a>
  127. <p>Generate code for given RISC-V ISA (e.g. &lsquo;<samp>rv64im</samp>&rsquo;). ISA strings must be
  128. lower-case. Examples include &lsquo;<samp>rv64i</samp>&rsquo;, &lsquo;<samp>rv32g</samp>&rsquo;, &lsquo;<samp>rv32e</samp>&rsquo;, and
  129. &lsquo;<samp>rv32imaf</samp>&rsquo;.
  130. </p>
  131. </dd>
  132. <dt><code>-mtune=<var>processor-string</var></code></dt>
  133. <dd><a name="index-mtune-11"></a>
  134. <p>Optimize the output for the given processor, specified by microarchitecture
  135. name. Permissible values for this option are: &lsquo;<samp>rocket</samp>&rsquo;,
  136. &lsquo;<samp>sifive-3-series</samp>&rsquo;, &lsquo;<samp>sifive-5-series</samp>&rsquo;, &lsquo;<samp>sifive-7-series</samp>&rsquo;,
  137. and &lsquo;<samp>size</samp>&rsquo;.
  138. </p>
  139. <p>When <samp>-mtune=</samp> is not specified, the default is &lsquo;<samp>rocket</samp>&rsquo;.
  140. </p>
  141. <p>The &lsquo;<samp>size</samp>&rsquo; choice is not intended for use by end-users. This is used
  142. when <samp>-Os</samp> is specified. It overrides the instruction cost info
  143. provided by <samp>-mtune=</samp>, but does not override the pipeline info. This
  144. helps reduce code size while still giving good performance.
  145. </p>
  146. </dd>
  147. <dt><code>-mpreferred-stack-boundary=<var>num</var></code></dt>
  148. <dd><a name="index-mpreferred_002dstack_002dboundary"></a>
  149. <p>Attempt to keep the stack boundary aligned to a 2 raised to <var>num</var>
  150. byte boundary. If <samp>-mpreferred-stack-boundary</samp> is not specified,
  151. the default is 4 (16 bytes or 128-bits).
  152. </p>
  153. <p><strong>Warning:</strong> If you use this switch, then you must build all modules with
  154. the same value, including any libraries. This includes the system libraries
  155. and startup modules.
  156. </p>
  157. </dd>
  158. <dt><code>-msmall-data-limit=<var>n</var></code></dt>
  159. <dd><a name="index-msmall_002ddata_002dlimit"></a>
  160. <p>Put global and static data smaller than <var>n</var> bytes into a special section
  161. (on some targets).
  162. </p>
  163. </dd>
  164. <dt><code>-msave-restore</code></dt>
  165. <dt><code>-mno-save-restore</code></dt>
  166. <dd><a name="index-msave_002drestore"></a>
  167. <p>Do or don&rsquo;t use smaller but slower prologue and epilogue code that uses
  168. library function calls. The default is to use fast inline prologues and
  169. epilogues.
  170. </p>
  171. </dd>
  172. <dt><code>-mstrict-align</code></dt>
  173. <dt><code>-mno-strict-align</code></dt>
  174. <dd><a name="index-mstrict_002dalign-2"></a>
  175. <p>Do not or do generate unaligned memory accesses. The default is set depending
  176. on whether the processor we are optimizing for supports fast unaligned access
  177. or not.
  178. </p>
  179. </dd>
  180. <dt><code>-mcmodel=medlow</code></dt>
  181. <dd><a name="index-mcmodel_003dmedlow"></a>
  182. <p>Generate code for the medium-low code model. The program and its statically
  183. defined symbols must lie within a single 2 GiB address range and must lie
  184. between absolute addresses -2 GiB and +2 GiB. Programs can be
  185. statically or dynamically linked. This is the default code model.
  186. </p>
  187. </dd>
  188. <dt><code>-mcmodel=medany</code></dt>
  189. <dd><a name="index-mcmodel_003dmedany"></a>
  190. <p>Generate code for the medium-any code model. The program and its statically
  191. defined symbols must be within any single 2 GiB address range. Programs can be
  192. statically or dynamically linked.
  193. </p>
  194. </dd>
  195. <dt><code>-mexplicit-relocs</code></dt>
  196. <dt><code>-mno-exlicit-relocs</code></dt>
  197. <dd><p>Use or do not use assembler relocation operators when dealing with symbolic
  198. addresses. The alternative is to use assembler macros instead, which may
  199. limit optimization.
  200. </p>
  201. </dd>
  202. <dt><code>-mrelax</code></dt>
  203. <dt><code>-mno-relax</code></dt>
  204. <dd><p>Take advantage of linker relaxations to reduce the number of instructions
  205. required to materialize symbol addresses. The default is to take advantage of
  206. linker relaxations.
  207. </p>
  208. </dd>
  209. <dt><code>-memit-attribute</code></dt>
  210. <dt><code>-mno-emit-attribute</code></dt>
  211. <dd><p>Emit (do not emit) RISC-V attribute to record extra information into ELF
  212. objects. This feature requires at least binutils 2.32.
  213. </p>
  214. </dd>
  215. <dt><code>-malign-data=<var>type</var></code></dt>
  216. <dd><a name="index-malign_002ddata"></a>
  217. <p>Control how GCC aligns variables and constants of array, structure, or union
  218. types. Supported values for <var>type</var> are &lsquo;<samp>xlen</samp>&rsquo; which uses x register
  219. width as the alignment value, and &lsquo;<samp>natural</samp>&rsquo; which uses natural alignment.
  220. &lsquo;<samp>xlen</samp>&rsquo; is the default.
  221. </p></dd>
  222. </dl>
  223. <hr>
  224. <div class="header">
  225. <p>
  226. Next: <a href="RL78-Options.html#RL78-Options" accesskey="n" rel="next">RL78 Options</a>, Previous: <a href="PRU-Options.html#PRU-Options" accesskey="p" rel="prev">PRU Options</a>, Up: <a href="Submodel-Options.html#Submodel-Options" accesskey="u" rel="up">Submodel Options</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>
  227. </div>
  228. </body>
  229. </html>