c-rx.texi 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. @c Copyright (C) 2008-2015 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @ifset GENERIC
  5. @page
  6. @node RX-Dependent
  7. @chapter RX Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter RX Dependent Features
  12. @end ifclear
  13. @cindex RX support
  14. @menu
  15. * RX-Opts:: RX Assembler Command Line Options
  16. * RX-Modifiers:: Symbolic Operand Modifiers
  17. * RX-Directives:: Assembler Directives
  18. * RX-Float:: Floating Point
  19. * RX-Syntax:: Syntax
  20. @end menu
  21. @node RX-Opts
  22. @section RX Options
  23. @cindex options, RX
  24. @cindex RX options
  25. The Renesas RX port of @code{@value{AS}} has a few target specfic
  26. command line options:
  27. @table @code
  28. @cindex @samp{-m32bit-doubles}
  29. @item -m32bit-doubles
  30. This option controls the ABI and indicates to use a 32-bit float ABI.
  31. It has no effect on the assembled instructions, but it does influence
  32. the behaviour of the @samp{.double} pseudo-op.
  33. This is the default.
  34. @cindex @samp{-m64bit-doubles}
  35. @item -m64bit-doubles
  36. This option controls the ABI and indicates to use a 64-bit float ABI.
  37. It has no effect on the assembled instructions, but it does influence
  38. the behaviour of the @samp{.double} pseudo-op.
  39. @cindex @samp{-mbig-endian}
  40. @item -mbig-endian
  41. This option controls the ABI and indicates to use a big-endian data
  42. ABI. It has no effect on the assembled instructions, but it does
  43. influence the behaviour of the @samp{.short}, @samp{.hword}, @samp{.int},
  44. @samp{.word}, @samp{.long}, @samp{.quad} and @samp{.octa} pseudo-ops.
  45. @cindex @samp{-mlittle-endian}
  46. @item -mlittle-endian
  47. This option controls the ABI and indicates to use a little-endian data
  48. ABI. It has no effect on the assembled instructions, but it does
  49. influence the behaviour of the @samp{.short}, @samp{.hword}, @samp{.int},
  50. @samp{.word}, @samp{.long}, @samp{.quad} and @samp{.octa} pseudo-ops.
  51. This is the default.
  52. @cindex @samp{-muse-conventional-section-names}
  53. @item -muse-conventional-section-names
  54. This option controls the default names given to the code (.text),
  55. initialised data (.data) and uninitialised data sections (.bss).
  56. @cindex @samp{-muse-renesas-section-names}
  57. @item -muse-renesas-section-names
  58. This option controls the default names given to the code (.P),
  59. initialised data (.D_1) and uninitialised data sections (.B_1).
  60. This is the default.
  61. @cindex @samp{-msmall-data-limit}
  62. @item -msmall-data-limit
  63. This option tells the assembler that the small data limit feature of
  64. the RX port of GCC is being used. This results in the assembler
  65. generating an undefined reference to a symbol called @code{__gp} for
  66. use by the relocations that are needed to support the small data limit
  67. feature. This option is not enabled by default as it would otherwise
  68. pollute the symbol table.
  69. @cindex @samp{-mpid}
  70. @item -mpid
  71. This option tells the assembler that the position independent data of the
  72. RX port of GCC is being used. This results in the assembler
  73. generating an undefined reference to a symbol called @code{__pid_base},
  74. and also setting the RX_PID flag bit in the e_flags field of the ELF
  75. header of the object file.
  76. @cindex @samp{-mint-register}
  77. @item -mint-register=@var{num}
  78. This option tells the assembler how many registers have been reserved
  79. for use by interrupt handlers. This is needed in order to compute the
  80. correct values for the @code{%gpreg} and @code{%pidreg} meta registers.
  81. @cindex @samp{-mgcc-abi}
  82. @item -mgcc-abi
  83. This option tells the assembler that the old GCC ABI is being used by
  84. the assembled code. With this version of the ABI function arguments
  85. that are passed on the stack are aligned to a 32-bit boundary.
  86. @cindex @samp{-mrx-abi}
  87. @item -mrx-abi
  88. This option tells the assembler that the official RX ABI is being used
  89. by the assembled code. With this version of the ABI function
  90. arguments that are passed on the stack are aligned to their natural
  91. alignments. This option is the default.
  92. @cindex @samp{-mcpu=}
  93. @item -mcpu=@var{name}
  94. This option tells the assembler the target CPU type. Currently the
  95. @code{rx200}, @code{rx600} and @code{rx610} are recognised as valid
  96. cpu names. Attempting to assemble an instruction not supported by the
  97. indicated cpu type will result in an error message being generated.
  98. @cindex @samp{-mno-allow-string-insns}
  99. @item -mno-allow-string-insns
  100. This option tells the assembler to mark the object file that it is
  101. building as one that does not use the string instructions
  102. @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
  103. @code{SWHILE} or the @code{RMPA} instruction. In addition the mark
  104. tells the linker to complain if an attempt is made to link the binary
  105. with another one that does use any of these instructions.
  106. Note - the inverse of this option, @code{-mallow-string-insns}, is
  107. not needed. The assembler automatically detects the use of the
  108. the instructions in the source code and labels the resulting
  109. object file appropriately. If no string instructions are detected
  110. then the object file is labelled as being one that can be linked with
  111. either string-using or string-banned object files.
  112. @end table
  113. @node RX-Modifiers
  114. @section Symbolic Operand Modifiers
  115. @cindex RX modifiers
  116. @cindex syntax, RX
  117. @cindex %gp
  118. The assembler supports one modifier when using symbol addresses
  119. in RX instruction operands. The general syntax is the following:
  120. @smallexample
  121. %gp(symbol)
  122. @end smallexample
  123. The modifier returns the offset from the @var{__gp} symbol to the
  124. specified symbol as a 16-bit value. The intent is that this offset
  125. should be used in a register+offset move instruction when generating
  126. references to small data. Ie, like this:
  127. @smallexample
  128. mov.W %gp(_foo)[%gpreg], r1
  129. @end smallexample
  130. The assembler also supports two meta register names which can be used
  131. to refer to registers whose values may not be known to the
  132. programmer. These meta register names are:
  133. @table @code
  134. @cindex @samp{%gpreg}
  135. @item %gpreg
  136. The small data address register.
  137. @cindex @samp{%pidreg}
  138. @item %pidreg
  139. The PID base address register.
  140. @end table
  141. Both registers normally have the value r13, but this can change if
  142. some registers have been reserved for use by interrupt handlers or if
  143. both the small data limit and position independent data features are
  144. being used at the same time.
  145. @node RX-Directives
  146. @section Assembler Directives
  147. @cindex assembler directives, RX
  148. @cindex RX assembler directives
  149. The RX version of @code{@value{AS}} has the following specific
  150. assembler directives:
  151. @table @code
  152. @item .3byte
  153. @cindex assembler directive .3byte, RX
  154. @cindex RX assembler directive .3byte
  155. Inserts a 3-byte value into the output file at the current location.
  156. @item .fetchalign
  157. @cindex assembler directive .fetchalign, RX
  158. @cindex RX assembler directive .fetchalign
  159. If the next opcode following this directive spans a fetch line
  160. boundary (8 byte boundary), the opcode is aligned to that boundary.
  161. If the next opcode does not span a fetch line, this directive has no
  162. effect. Note that one or more labels may be between this directive
  163. and the opcode; those labels are aligned as well. Any inserted bytes
  164. due to alignment will form a NOP opcode.
  165. @end table
  166. @node RX-Float
  167. @section Floating Point
  168. @cindex floating point, RX
  169. @cindex RX floating point
  170. The floating point formats generated by directives are these.
  171. @table @code
  172. @cindex @code{float} directive, RX
  173. @item .float
  174. @code{Single} precision (32-bit) floating point constants.
  175. @cindex @code{double} directive, RX
  176. @item .double
  177. If the @option{-m64bit-doubles} command line option has been specified
  178. then then @code{double} directive generates @code{double} precision
  179. (64-bit) floating point constants, otherwise it generates
  180. @code{single} precision (32-bit) floating point constants. To force
  181. the generation of 64-bit floating point constants used the @code{dc.d}
  182. directive instead.
  183. @end table
  184. @node RX-Syntax
  185. @section Syntax for the RX
  186. @menu
  187. * RX-Chars:: Special Characters
  188. @end menu
  189. @node RX-Chars
  190. @subsection Special Characters
  191. @cindex line comment character, RX
  192. @cindex RX line comment character
  193. The presence of a @samp{;} appearing anywhere on a line indicates the
  194. start of a comment that extends to the end of that line.
  195. If a @samp{#} appears as the first character of a line then the whole
  196. line is treated as a comment, but in this case the line can also be a
  197. logical line number directive (@pxref{Comments}) or a preprocessor
  198. control command (@pxref{Preprocessing}).
  199. @cindex line separator, RX
  200. @cindex statement separator, RX
  201. @cindex RX line separator
  202. The @samp{!} character can be used to separate statements on the same
  203. line.