Skip to content

Latest commit

 

History

History
128 lines (86 loc) · 3.07 KB

gp_info.md

File metadata and controls

128 lines (86 loc) · 3.07 KB

Gp info

Hold the information to emit a _gp (global pointer) symbol for the given segment.

The _gp symbol is used on MIPS builds that want to use the "small data" sections. This allows to refences small objects using a single MIPS instruction instead of two.

The _gp symbol is usually defined as an offset into the start of the first small section. It is defined this way to maximize the addressable range of this technique. Both the section and the offset are configurable.

Every attribute listed is optional unless explicitly stated.

Table of contents

section

The _gp symbol will be emitted just before this section.

Example

segments:
  - name: main
    gp_info:
      section: .sdata

Valid values

Non-empty string.

Default value

.sdata

offset

An offset into the the section, allowing the _gp value to not point to the start of the section, maximizing the available accessable range using the $gp register.

Example

segments:
  - name: main
    gp_info:
      offset: 0x8000

Valid values

Integers.

Default value

0x7FF0

provide

If provide is enabled then the _gp symbol will only be set if it is referenced by any linked code but is not defined in any object included in the link.

See GNU LD documentation for PROVIDE.

This option can be combined with hidden. For more info see the GNU LD documentation for PROVIDE_HIDDEN.

Valid values

Bool.

Default value

False

hidden

Allows defining the _gp symbol to be hidden and won't be exported.

On a more technical sense, the binding of the generated symbol on the elf will be marked as LOCAL instead of GLOBAL.

See GNU LD documentation for HIDDEN.

This option can be combined with provide. For more info see the GNU LD documentation for PROVIDE_HIDDEN.

Valid values

Bool.

Default value

False

include_if_any, include_if_all, exclude_if_any and exclude_if_all

These fields allow to conditionally include or exclude a given segment depending on the current custom options.

Their syntax is the same as their file counterparts.