Bug 13129 - avr-gas lacks documentation of gs() modifier
Summary: avr-gas lacks documentation of gs() modifier
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.21
: P3 enhancement
Target Milestone: ---
Assignee: unassigned
URL: http://sourceware.org/binutils/docs-2...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-24 19:25 UTC by Georg-Johann Lay
Modified: 2011-08-28 14:28 UTC (History)
1 user (show)

See Also:
Host:
Target: avr
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2011-08-24 19:25:12 UTC
In the documentation of "Relocatable Expression Modifiers"

Machine Dependencies -> AVR-Dependent -> AVR Syntax -> AVR-Modifiers

http://sourceware.org/binutils/docs-2.21/as/AVR_002dModifiers.html#AVR_002dModifiers

there is no documentation for gs() modifier (and maybe others).

Moreover, description of, e.g. pm_lo8, is very unprecise; it just states that it is "useful for addressing data or code from Flash/Program memory" but does not specify what it really does.
Comment 1 Bjoern Haase 2011-08-28 14:28:14 UTC
gs() has been used as modifier in order to refer to "generate stubs". For tartgets with more than 128k of flash, jump stubs are placed in the lower 128k memory page. It's use is similar to the pm( ) identifier.

pm() and gs() are to be used for accessing addresses in program memory, e.g. for function pointers by ldi() instructions.

references will be issued to the elf relocations

BFD_RELOC_AVR_LO8_LDI_PM
BFD_RELOC_AVR_HI8_LDI_PM

and

BFD_RELOC_AVR_LO8_LDI_GS
BFD_RELOC_AVR_HI8_LDI_GS

respectively. The GS elf relocations will return the linker stub address instead of the true address within program memory in case that linker stubs are needed, i.e. in case that the function code is placed beyond the memory range that maybe accessed by 16 bit pointers.


Excerpts from src/bfd/elf32-avr.c

/* A low 8 bit absolute relocation of 24 bit program memory address.
     For LDI command.  Will not be changed when linker stubs are needed. */
  HOWTO (R_AVR_LO8_LDI_PM,      /* type */

/* A low 8 bit absolute relocation of 24 bit program memory address.
     For LDI command.  Will not be changed when linker stubs are needed. */
  HOWTO (R_AVR_HI8_LDI_PM,      /* type */

/* A low 8 bit absolute relocation of 24 bit program memory address.
     For LDI command.  Will be changed when linker stubs are needed.  */
  HOWTO (R_AVR_LO8_LDI_GS,      /* type */