2018-01-03 13:17:27 +08:00
|
|
|
@c Copyright (C) 2016-2018 Free Software Foundation, Inc.
|
2016-11-02 00:45:57 +08:00
|
|
|
@c This is part of the GAS anual.
|
|
|
|
@c For copying conditions, see the file as.texinfo
|
|
|
|
@c man end
|
|
|
|
|
|
|
|
@ifset GENERIC
|
|
|
|
@page
|
|
|
|
@node RISC-V-Dependent
|
|
|
|
@chapter RISC-V Dependent Features
|
|
|
|
@end ifset
|
|
|
|
@ifclear GENERIC
|
|
|
|
@node Machine Dependencies
|
|
|
|
@chapter RISC-V Dependent Features
|
|
|
|
@end ifclear
|
|
|
|
|
|
|
|
@cindex RISC-V support
|
|
|
|
@menu
|
2017-12-02 07:34:42 +08:00
|
|
|
* RISC-V-Options:: RISC-V Options
|
|
|
|
* RISC-V-Directives:: RISC-V Directives
|
2016-11-02 00:45:57 +08:00
|
|
|
@end menu
|
|
|
|
|
2017-12-02 07:34:42 +08:00
|
|
|
@node RISC-V-Options
|
|
|
|
@section RISC-V Options
|
2016-11-02 00:45:57 +08:00
|
|
|
|
2017-12-02 07:34:42 +08:00
|
|
|
The following table lists all available RISC-V specific options.
|
2016-11-02 00:45:57 +08:00
|
|
|
|
|
|
|
@c man begin OPTIONS
|
|
|
|
@table @gcctabopt
|
|
|
|
|
2017-03-21 23:36:44 +08:00
|
|
|
@cindex @samp{-fpic} option, RISC-V
|
|
|
|
@item -fpic
|
2017-12-02 07:34:42 +08:00
|
|
|
@itemx -fPIC
|
2017-03-21 23:36:44 +08:00
|
|
|
Generate position-independent code
|
|
|
|
|
|
|
|
@cindex @samp{-fno-pic} option, RISC-V
|
|
|
|
@item -fno-pic
|
|
|
|
Don't generate position-independent code (default)
|
|
|
|
|
2016-11-04 22:18:06 +08:00
|
|
|
@cindex @samp{-march=ISA} option, RISC-V
|
|
|
|
@item -march=ISA
|
Re-work RISC-V gas flags: now we just support -mabi and -march
We've decided to standardize on two flags for RISC-V: "-march" sets the
target architecture (which determines which instructions can be
generated), and "-mabi" sets the target ABI. We needed to rework this
because the old flag set didn't support soft-float or single-float ABIs,
and didn't support an x32-style ABI on RISC-V.
Additionally, we've changed the behavior of the -march flag: it's now a
lot stricter and only parses things we can actually understand.
Additionally, it's now lowercase-only: the rationale is that while the
RISC-V ISA manual specifies that ISA strings are case-insensitive, in
Linux-land things are usually case-sensitive. Since this flag can be
used to determine library paths, we didn't want to bake some
case-insensitivity in there that would case trouble later.
This patch implements these two new flags and removes the old flags that
could conflict with these. There wasn't a RISC-V release before, so we
want to just support a clean flag set.
include/
* elf/riscv.h (EF_RISCV_SOFT_FLOAT): Don't define.
(EF_RISCV_FLOAT_ABI, EF_RISCV_FLOAT_ABI_SOFT): Define.
(EF_RISCV_FLOAT_ABI_SINGLE, EF_RISCV_FLOAT_ABI_DOUBLE): Define.
(EF_RISCV_FLOAT_ABI_QUAD): Define.
bfd/
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Use
EF_RISCV_FLOAT_ABI_SOFT instead of EF_RISCV_SOFT_FLOAT.
binutils/
* readelf.c (get_machine_flags): Use
EF_RISCV_FLOAT_ABI_{SOFT,SINGLE,DOBULE,QUAD) instead of
EF_RISCV_{SOFT,HARD}_FLOAT.
gas/
* config/tc-riscv.h (xlen): Delete.
* config/tc-riscv.c (xlen): Make static.
(abi_xlen): New variable.
(options): Replace OPTION_{M32,M64,MSOFT_FLOAT,MHARD_FLOAT,MRVC}
with OPTION_MABI.
(md_longopts): Likewise.
(md_parse_option): Likewise.
(riscv_elf_final_processing): Likewise.
* doc/as.texinfo (Target RISC-V options): Likewise.
* doc/c-riscv.texi (OPTIONS): Likewise.
* config/tc-riscv.c (float_mode): Removed.
(float_abi): New type, specifies the floating-point ABI.
(riscv_set_abi): New function.
(riscv_add_subset): Only allow lower-case ISA names and require
them to start with "rv".
(riscv_after_parse_args): Likewise.
opcodes/
* riscv-dis.c (riscv_disassemble_insn): Default to the ELF's
XLEN when none is provided.
2016-12-19 14:53:50 +08:00
|
|
|
Select the base isa, as specified by ISA. For example -march=rv32ima.
|
|
|
|
|
|
|
|
@cindex @samp{-mabi=ABI} option, RISC-V
|
|
|
|
@item -mabi=ABI
|
|
|
|
Selects the ABI, which is either "ilp32" or "lp64", optionally followed
|
|
|
|
by "f", "d", or "q" to indicate single-precision, double-precision, or
|
|
|
|
quad-precision floating-point calling convention, or none to indicate
|
|
|
|
the soft-float calling convention.
|
2016-11-02 00:45:57 +08:00
|
|
|
|
|
|
|
@end table
|
|
|
|
@c man end
|
2017-12-02 07:34:42 +08:00
|
|
|
|
|
|
|
@node RISC-V-Directives
|
2017-12-04 07:11:07 +08:00
|
|
|
@section RISC-V Directives
|
2017-12-02 07:34:42 +08:00
|
|
|
@cindex machine directives, RISC-V
|
|
|
|
@cindex RISC-V machine directives
|
|
|
|
|
|
|
|
The following table lists all available RISC-V specific directives.
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
@cindex @code{align} directive
|
|
|
|
@item .align @var{size-log-2}
|
|
|
|
Align to the given boundary, with the size given as log2 the number of bytes to
|
|
|
|
align to.
|
|
|
|
|
|
|
|
@cindex Data directives
|
|
|
|
@item .half @var{value}
|
|
|
|
@itemx .word @var{value}
|
|
|
|
@itemx .dword @var{value}
|
|
|
|
Emits a half-word, word, or double-word value at the current position.
|
|
|
|
|
|
|
|
@cindex DTP-relative data directives
|
|
|
|
@item .dtprelword @var{value}
|
|
|
|
@itemx .dtpreldword @var{value}
|
|
|
|
Emits a DTP-relative word (or double-word) at the current position. This is
|
|
|
|
meant to be used by the compiler in shared libraries for DWARF debug info for
|
|
|
|
thread local variables.
|
|
|
|
|
|
|
|
@cindex BSS directive
|
|
|
|
@item .bss
|
|
|
|
Sets the current section to the BSS section.
|
|
|
|
|
|
|
|
@cindex LEB128 directives
|
|
|
|
@item .uleb128 @var{value}
|
|
|
|
@itemx .sleb128 @var{value}
|
|
|
|
Emits a signed or unsigned LEB128 value at the current position. This only
|
|
|
|
accepts constant expressions, because symbol addresses can change with
|
|
|
|
relaxation, and we don't support relocations to modify LEB128 values at link
|
|
|
|
time.
|
|
|
|
|
|
|
|
@cindex Option directive
|
|
|
|
@cindex @code{option} directive
|
|
|
|
@item .option @var{argument}
|
|
|
|
Modifies RISC-V specific assembler options inline with the assembly code.
|
|
|
|
This is used when particular instruction sequences must be assembled with a
|
|
|
|
specific set of options. For example, since we relax addressing sequences to
|
|
|
|
shorter GP-relative sequences when possible the initial load of GP must not be
|
|
|
|
relaxed and should be emitted as something like
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
.option push
|
|
|
|
.option norelax
|
|
|
|
la gp, __global_pointer$
|
|
|
|
.option pop
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
in order to produce after linker relaxation the expected
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
auipc gp, %pcrel_hi(__global_pointer$)
|
|
|
|
addi gp, gp, %pcrel_lo(__global_pointer$)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
instead of just
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
addi gp, gp, 0
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
It's not expected that options are changed in this manner during regular use,
|
|
|
|
but there are a handful of esoteric cases like the one above where users need
|
|
|
|
to disable particular features of the assembler for particular code sequences.
|
|
|
|
The complete list of option arguments is shown below:
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
@item push
|
|
|
|
@itemx pop
|
|
|
|
Pushes or pops the current option stack. These should be used whenever
|
|
|
|
changing an option in line with assembly code in order to ensure the user's
|
|
|
|
command-line options are respected for the bulk of the file being assembled.
|
|
|
|
|
|
|
|
@item rvc
|
|
|
|
@itemx norvc
|
|
|
|
Enables or disables the generation of compressed instructions. Instructions
|
|
|
|
are opportunistically compressed by the RISC-V assembler when possible, but
|
|
|
|
sometimes this behavior is not desirable.
|
|
|
|
|
|
|
|
@item pic
|
|
|
|
@itemx nopic
|
|
|
|
Enables or disables position-independent code generation. Unless you really
|
|
|
|
know what you're doing, this should only be at the top of a file.
|
|
|
|
|
|
|
|
@item relax
|
|
|
|
@itemx norelax
|
|
|
|
Enables or disables relaxation. The RISC-V assembler and linker
|
|
|
|
opportunistically relax some code sequences, but sometimes this behavior is not
|
|
|
|
desirable.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@end table
|