as: RISC-V-Directives

1 
1 9.37.2 RISC-V Directives
1 ------------------------
1 
1 The following table lists all available RISC-V specific directives.
1 
1 '.align SIZE-LOG-2'
1      Align to the given boundary, with the size given as log2 the number
1      of bytes to align to.
1 
1 '.half VALUE'
1 '.word VALUE'
1 '.dword VALUE'
1      Emits a half-word, word, or double-word value at the current
1      position.
1 
1 '.dtprelword VALUE'
1 '.dtpreldword VALUE'
1      Emits a DTP-relative word (or double-word) at the current position.
1      This is meant to be used by the compiler in shared libraries for
1      DWARF debug info for thread local variables.
1 
1 '.bss'
1      Sets the current section to the BSS section.
1 
1 '.uleb128 VALUE'
1 '.sleb128 VALUE'
1      Emits a signed or unsigned LEB128 value at the current position.
1      This only accepts constant expressions, because symbol addresses
1      can change with relaxation, and we don't support relocations to
1      modify LEB128 values at link time.
1 
1 '.option ARGUMENT'
1      Modifies RISC-V specific assembler options inline with the assembly
1      code.  This is used when particular instruction sequences must be
1      assembled with a specific set of options.  For example, since we
1      relax addressing sequences to shorter GP-relative sequences when
1      possible the initial load of GP must not be relaxed and should be
1      emitted as something like
1 
1           	.option push
1           	.option norelax
1           	la gp, __global_pointer$
1           	.option pop
1 
1      in order to produce after linker relaxation the expected
1 
1           	auipc gp, %pcrel_hi(__global_pointer$)
1           	addi gp, gp, %pcrel_lo(__global_pointer$)
1 
1      instead of just
1 
1           	addi gp, gp, 0
1 
1      It's not expected that options are changed in this manner during
1      regular use, but there are a handful of esoteric cases like the one
1      above where users need to disable particular features of the
1      assembler for particular code sequences.  The complete list of
1      option arguments is shown below:
1 
1      'push'
1      'pop'
1           Pushes or pops the current option stack.  These should be used
1           whenever changing an option in line with assembly code in
1           order to ensure the user's command-line options are respected
1           for the bulk of the file being assembled.
1 
1      'rvc'
1      'norvc'
1           Enables or disables the generation of compressed instructions.
1           Instructions are opportunistically compressed by the RISC-V
1           assembler when possible, but sometimes this behavior is not
1           desirable.
1 
1      'pic'
1      'nopic'
1           Enables or disables position-independent code generation.
1           Unless you really know what you're doing, this should only be
1           at the top of a file.
1 
1      'relax'
1      'norelax'
1           Enables or disables relaxation.  The RISC-V assembler and
1           linker opportunistically relax some code sequences, but
1           sometimes this behavior is not desirable.
1