Skip to content
STIMSMITH

linker script

Concept WIKI v1 · 6/1/2026

In the OTBN random-instruction-generation flow, a linker script is a `.ld` file produced by `otbn-rig asm` when `--output` is specified. The generated linker script accompanies the assembly listing and is then passed to `otbn_ld.py` with `-T` during linking.

linker script

In the OTBN random instruction generator flow, a linker script is an output artifact generated by otbn-rig asm alongside an assembly listing.[1]

Role in the OTBN RIG flow

After otbn-rig gen produces a random program in JSON form, the asm subcommand performs a deterministic translation from that JSON input to both assembly and linker-script output.[2]

For example, running:

hw/ip/otbn/dv/rig/otbn-rig asm --output foo foo.json

produces:

  • foo.s: an assembly listing
  • foo.ld: a linker script[1]

The generated linker script is then supplied to the OTBN linker step with -T:

hw/ip/otbn/util/otbn_as.py -o foo.o foo.s
hw/ip/otbn/util/otbn_ld.py -o foo.elf -T foo.ld foo.o

This means the linker script is part of the standard path from generated OTBN assembly to a linked ELF binary.[3]

Generation behavior

otbn-rig asm only generates the linker script when an output prefix is provided with --output. If --output is omitted, the command writes only the assembly listing to stdout and does not generate a linker script.[4]

Scope of available evidence

The available evidence establishes the linker script's place in the OTBN RIG tool flow: it is generated as a .ld file by otbn-rig asm and consumed by otbn_ld.py during linking. The evidence here does not describe the internal contents or syntax of the linker script itself.

[2]: See citation "otbn-rig asm deterministically translates JSON input to assembly and linker script output". [1]: See citation "otbn-rig asm --output foo generates foo.s and foo.ld". [3]: See citation "The generated linker script is passed to otbn_ld.py with -T foo.ld during linking". [4]: See citation "Without --output, otbn-rig asm does not generate a linker script".

LINKED ENTITIES

1 links

CITATIONS

4 sources
4 citations
[1] `otbn-rig asm` deterministically translates JSON input to assembly and linker script output OTBN Random Instruction Generator - OpenTitan
[2] `otbn-rig asm --output foo` generates `foo.s` and `foo.ld` OTBN Random Instruction Generator - OpenTitan
[3] The generated linker script is passed to `otbn_ld.py` with `-T foo.ld` during linking OTBN Random Instruction Generator - OpenTitan
[4] Without `--output`, `otbn-rig asm` does not generate a linker script OTBN Random Instruction Generator - OpenTitan