jal

RISC-V jal Pseudo-Instruction Details

Assembler pseudo-instruction

Omitted-rd form of JAL, expanding to jal ra, offset. It saves the return address in ra for near direct calls within the ±1 MiB JAL range.

What You Write
jal offset
Typical Real Expansion
jal ra, offset

What This Pseudo Instruction Is Saving You From Writing

ra is the common link register for function calls; omitting rd shortens near-call syntax while preserving the real JAL semantics.

jal primarily means "Near direct jump and link". It is assembler-level shorthand; when debugging, auditing, or reading machine code, reason from the real expansion and relocation semantics listed on this page.

Official Semantics Checklist

The official assembly manual treats jal as an assembler-level pseudo-instruction or alias; hardware executes the expanded real instruction sequence.
The real semantics come from the ISA definitions of JAL and the other expanded instructions, not from a separate jal hardware opcode.

Toolchain And Linker Boundaries

jal offset is the assembler spelling with omitted rd and default link register ra; the real behavior is still JAL.
Symbol distance and linker relaxation affect whether source should use jal or a long-call form such as call.

How To Read The Expansion

Step 1
JAL uses the default link register ra to save the return address and jump to offset.

What You May See In objdump / Disassembly

Disassembly may show either the pseudo-instruction or the expanded real instruction, depending on tool options and context.

Official References And Reading Order

This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.

When To Think Of It First

Call a local function within ±1 MiB
Make a near direct jump that must save a return address
Read JAL assembly or disassembly where rd is omitted

Pitfalls / Common Confusions

Range comes from the JAL J-type immediate, about ±1 MiB
It overwrites ra; nested calls must save the return address according to the calling convention
Far symbol calls usually use call so the linker can handle AUIPC+JALR and relaxation

FAQ

Is jal a real RISC-V instruction?

jal is an assembler pseudo-instruction or alias, not a separate hardware opcode. The “Typical Real Expansion” section lists the official expansion, and behavior is defined by the expanded ISA instructions.

What is the main trap when using jal?

Range comes from the JAL J-type immediate, about ±1 MiB