Remove mem_region_vector typedef
[deliverable/binutils-gdb.git] / gas / doc / c-riscv.texi
CommitLineData
2571583a 1@c Copyright (C) 2016-2017 Free Software Foundation, Inc.
e23eba97
NC
2@c This is part of the GAS anual.
3@c For copying conditions, see the file as.texinfo
4@c man end
5
6@ifset GENERIC
7@page
8@node RISC-V-Dependent
9@chapter RISC-V Dependent Features
10@end ifset
11@ifclear GENERIC
12@node Machine Dependencies
13@chapter RISC-V Dependent Features
14@end ifclear
15
16@cindex RISC-V support
17@menu
b57e49f7
JW
18* RISC-V-Options:: RISC-V Options
19* RISC-V-Directives:: RISC-V Directives
e23eba97
NC
20@end menu
21
b57e49f7
JW
22@node RISC-V-Options
23@section RISC-V Options
e23eba97 24
b57e49f7 25The following table lists all available RISC-V specific options.
e23eba97
NC
26
27@c man begin OPTIONS
28@table @gcctabopt
e23eba97 29
19683c04
PD
30@cindex @samp{-fpic} option, RISC-V
31@item -fpic
b57e49f7 32@itemx -fPIC
19683c04
PD
33Generate position-independent code
34
35@cindex @samp{-fno-pic} option, RISC-V
36@item -fno-pic
37Don't generate position-independent code (default)
38
4f7eddc4
PD
39@cindex @samp{-march=ISA} option, RISC-V
40@item -march=ISA
2922d21d
AW
41Select the base isa, as specified by ISA. For example -march=rv32ima.
42
43@cindex @samp{-mabi=ABI} option, RISC-V
44@item -mabi=ABI
45Selects the ABI, which is either "ilp32" or "lp64", optionally followed
46by "f", "d", or "q" to indicate single-precision, double-precision, or
47quad-precision floating-point calling convention, or none to indicate
48the soft-float calling convention.
e23eba97
NC
49
50@end table
51@c man end
b57e49f7
JW
52
53@node RISC-V-Directives
54@cindex machine directives, RISC-V
55@cindex RISC-V machine directives
56
57@section RISC-V Directives
58
59The following table lists all available RISC-V specific directives.
60
61@table @code
62
63@cindex @code{align} directive
64@item .align @var{size-log-2}
65Align to the given boundary, with the size given as log2 the number of bytes to
66align to.
67
68@cindex Data directives
69@item .half @var{value}
70@itemx .word @var{value}
71@itemx .dword @var{value}
72Emits a half-word, word, or double-word value at the current position.
73
74@cindex DTP-relative data directives
75@item .dtprelword @var{value}
76@itemx .dtpreldword @var{value}
77Emits a DTP-relative word (or double-word) at the current position. This is
78meant to be used by the compiler in shared libraries for DWARF debug info for
79thread local variables.
80
81@cindex BSS directive
82@item .bss
83Sets the current section to the BSS section.
84
85@cindex LEB128 directives
86@item .uleb128 @var{value}
87@itemx .sleb128 @var{value}
88Emits a signed or unsigned LEB128 value at the current position. This only
89accepts constant expressions, because symbol addresses can change with
90relaxation, and we don't support relocations to modify LEB128 values at link
91time.
92
93@cindex Option directive
94@cindex @code{option} directive
95@item .option @var{argument}
96Modifies RISC-V specific assembler options inline with the assembly code.
97This is used when particular instruction sequences must be assembled with a
98specific set of options. For example, since we relax addressing sequences to
99shorter GP-relative sequences when possible the initial load of GP must not be
100relaxed and should be emitted as something like
101
102@smallexample
103 .option push
104 .option norelax
105 la gp, __global_pointer$
106 .option pop
107@end smallexample
108
109in order to produce after linker relaxation the expected
110
111@smallexample
112 auipc gp, %pcrel_hi(__global_pointer$)
113 addi gp, gp, %pcrel_lo(__global_pointer$)
114@end smallexample
115
116instead of just
117
118@smallexample
119 addi gp, gp, 0
120@end smallexample
121
122It's not expected that options are changed in this manner during regular use,
123but there are a handful of esoteric cases like the one above where users need
124to disable particular features of the assembler for particular code sequences.
125The complete list of option arguments is shown below:
126
127@table @code
128@item push
129@itemx pop
130Pushes or pops the current option stack. These should be used whenever
131changing an option in line with assembly code in order to ensure the user's
132command-line options are respected for the bulk of the file being assembled.
133
134@item rvc
135@itemx norvc
136Enables or disables the generation of compressed instructions. Instructions
137are opportunistically compressed by the RISC-V assembler when possible, but
138sometimes this behavior is not desirable.
139
140@item pic
141@itemx nopic
142Enables or disables position-independent code generation. Unless you really
143know what you're doing, this should only be at the top of a file.
144
145@item relax
146@itemx norelax
147Enables or disables relaxation. The RISC-V assembler and linker
148opportunistically relax some code sequences, but sometimes this behavior is not
149desirable.
150@end table
151
152@end table
This page took 0.108453 seconds and 4 git commands to generate.