9.11 Org directive

The .org directive advances the location counter in the current section to new-location.

Syntax

.org new_location [, fill_value]

Description

new_location

The new_location argument must be one of:

  • An absolute integer expression, in which case it is treated as the number of bytes from the start of the section.
  • An expression which evaluates to a location in the current section. This could use a symbol in the current section, or the current location ('.').
fill_value

This is an optional 1-byte value.

Operation

The .org directive can only move the location counter forward, not backward.

By default, the .org directive inserts zero bytes in any locations that it skips over. This can be overridden using the optional fill_value argument, which sets the 1-byte value that will be repeated in each skipped location.

Examples

    // Macro to create one AArch64 exception vector table entry. Each entry
    // must be 128 bytes in length. If the code is shorter than that, padding
    // will be inserted. If the code is longer than that, the .org directive
    // will report an error, as this would require the location counter to move
    // backwards.
    .macro exc_tab_entry, num
  1:
    mov x0, #\num
    b unhandled_exception
    .org 1b + 0x80
    .endm

    // Each of these macro instantiations emits 128 bytes of code and padding.
    .section vectors, "ax"
    exc_tab_entry 0
    exc_tab_entry 1
    // More table entries...
Non-ConfidentialPDF file icon PDF versionDUI0774J
Copyright © 2014–2017, 2019 Arm Limited or its affiliates. All rights reserved.