RISC-V Assembly Programmer’s Manual
Copyright and License Information
The RISC-V Assembly Programmer’s Manual is
© 2017 Palmer Dabbelt palmer@dabbelt.com
© 2017 Michael Clark michaeljclark@mac.com
© 2017 Alex Bradbury asb@lowrisc.org
It is licensed under the Creative Commons Attribution 4.0 International License (CC-BY 4.0). The full license text is available at https://creativecommons.org/licenses/by/4.0/.
Command-Line Arguments
I think it’s probably better to beef up the binutils documentation rather than duplicating it here.
Registers
ISA and ABI register names for X, F, and CSRs.
Addressing
Addressing formats like %pcrel_lo(). We can just link to the RISC-V PS ABI document to describe what the relocations actually do.
Instruction Set
Links to the various RISC-V ISA manuals that are supported.
Instructions
Here we can just link to the RISC-V ISA manual.
Instruction Aliases
ALIAS line from opcodes/riscv-opc.c
Pseudo Ops
Both the RISC-V-specific and GNU .-prefixed options.
The following table lists assembler directives:
Directive
Arguments
Description
.align
integer
align to power of 2 (alias for .p2align)
.file
“filename”
emit filename FILE LOCAL symbol table
.globl
symbol_name
emit symbol_name to symbol table (scope GLOBAL)
.local
symbol_name
emit symbol_name to symbol table (scope LOCAL)
.comm
symbol_name,size,align
emit common object to .bss section
.common
symbol_name,size,align
emit common object to .bss section
.ident
“string”
accepted for source compatibility
.section
[{.text,.data,.rodata,.bss}]
emit section (if not present, default .text) and make current
.size
symbol, symbol
accepted for source compatibility
.text
emit