Skip to main content
Version: v0.3.7

rgblink(5) — linkerscript file format

The linkerscript is an external file that allows the user to specify the order of sections without the need for doing so before assembling each object file.

The placement of sections specified in the linkerscript is done before the sections whose placement is defined in the source code.

A linkerscript consists on a series of banks followed by a list of sections and, optionally, commands. They can be lowercase or uppercase, it is ignored. Any line can contain a comment starting with ‘;’ that ends at the end of the line:

ROMX $F ; This is a comment
  "Functions to read array"
  "Array aligned to 256 bytes"

  "Some variables"

Numbers can be in decimal or hexadecimal format (the prefix is ‘$’). It is an error if any section name or command are found before setting a bank.

Files can be included by using the INCLUDE keyword followed by a string with the path of the file that has to be included.

The possible bank types are: , ROMX, VRAM, , WRAMX, and . Types ROMX, VRAM, WRAMX and are banked, which means that it is needed to specify a bank after the type.

When a new bank statement is found, sections found after it will be placed right from the beginning of that bank. If the linkerscript switches to a different bank and then it comes back to the previous one it will continue from the last address that was used.

The only two commands are ORG and ALIGN:

  • ORG sets the address in which new sections will be placed. It can not be lower than the current address.
  • ALIGN will increase the address until it is aligned to the specified boundary (it tries to set to 0 the number of bits specified after the command: will align to $100).

Note: The bank, alignment, address and type of sections can be specified both in the source code and in the linkerscript. For a section to be able to be placed with the linkerscript the bank must be left unassigned in the source code or be the same as the one specified in the linkerscript. The address and alignment musn't be set.

rgbasm(1), rgblink(1), rgbfix(1), rgbds(5), rgbds(7)

rgblink was originally written by Carsten Sørensen as part of the ASMotor package, and was later packaged in RGBDS by Justin Lloyd. It is now maintained by a number of contributors at