github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/targets/arm.ld (about)

     1  
     2  /* Unused, but here to silence a linker warning. */
     3  ENTRY(Reset_Handler)
     4  
     5  /* define output sections */
     6  SECTIONS
     7  {
     8      /* Program code and read-only data goes to FLASH_TEXT. */
     9      .text :
    10      {
    11          KEEP(*(.isr_vector))
    12          *(.text)
    13          *(.text.*)
    14          *(.rodata)
    15          *(.rodata.*)
    16          . = ALIGN(4);
    17      } >FLASH_TEXT
    18  
    19      .tinygo_stacksizes :
    20      {
    21          *(.tinygo_stacksizes)
    22      } > FLASH_TEXT
    23  
    24      /* Put the stack at the bottom of RAM, so that the application will
    25       * crash on stack overflow instead of silently corrupting memory.
    26       * See: http://blog.japaric.io/stack-overflow-protection/ */
    27      .stack (NOLOAD) :
    28      {
    29          . = ALIGN(4);
    30          . += _stack_size;
    31          _stack_top = .;
    32      } >RAM
    33  
    34      /* Start address (in flash) of .data, used by startup code. */
    35      _sidata = LOADADDR(.data);
    36  
    37      /* Globals with initial value */
    38      .data :
    39      {
    40          . = ALIGN(4);
    41          _sdata = .;        /* used by startup code */
    42          *(.data)
    43          *(.data.*)
    44          . = ALIGN(4);
    45          *(.ramfuncs*)      /* Functions that must execute from RAM */
    46          . = ALIGN(4);
    47          _edata = .;        /* used by startup code */
    48      } >RAM AT>FLASH_TEXT
    49  
    50      /* Zero-initialized globals  */
    51      .bss :
    52      {
    53          . = ALIGN(4);
    54          _sbss = .;         /* used by startup code */
    55          *(.bss)
    56          *(.bss.*)
    57          *(COMMON)
    58          . = ALIGN(4);
    59          _ebss = .;         /* used by startup code */
    60      } >RAM
    61  
    62      /DISCARD/ :
    63      {
    64          *(.ARM.exidx)      /* causes 'no memory region specified' error in lld */
    65          *(.ARM.exidx.*)    /* causes spurious 'undefined reference' errors */
    66      }
    67  }
    68  
    69  /* For the memory allocator. */
    70  _heap_start = _ebss;
    71  _heap_end = ORIGIN(RAM) + LENGTH(RAM);
    72  _globals_start = _sdata;
    73  _globals_end = _ebss;
    74  
    75  /* For the flash API */
    76  __flash_data_start = LOADADDR(.data) + SIZEOF(.data);
    77  __flash_data_end = ORIGIN(FLASH_TEXT) + LENGTH(FLASH_TEXT);