github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/targets/riscv.ld (about) 1 SECTIONS 2 { 3 .text : 4 { 5 . = ALIGN(4); 6 KEEP(*(.init)) 7 . = ALIGN(4); 8 *(.text.handleInterruptASM) 9 *(.text) 10 *(.text.*) 11 *(.rodata) 12 *(.rodata.*) 13 . = ALIGN(4); 14 } >FLASH_TEXT 15 16 /* Put the stack at the bottom of RAM, so that the application will 17 * crash on stack overflow instead of silently corrupting memory. 18 * See: http://blog.japaric.io/stack-overflow-protection/ */ 19 .stack (NOLOAD) : 20 { 21 . = ALIGN(16); 22 . += _stack_size; 23 _stack_top = .; 24 } >RAM 25 26 /* Start address (in flash) of .data, used by startup code. */ 27 _sidata = LOADADDR(.data); 28 29 /* Globals with initial value */ 30 .data : 31 { 32 . = ALIGN(4); 33 /* see https://gnu-mcu-eclipse.github.io/arch/riscv/programmer/#the-gp-global-pointer-register */ 34 PROVIDE( __global_pointer$ = . + (4K / 2) ); 35 _sdata = .; /* used by startup code */ 36 *(.sdata) 37 *(.data .data.*) 38 . = ALIGN(4); 39 _edata = .; /* used by startup code */ 40 } >RAM AT>FLASH_TEXT 41 42 /* Zero-initialized globals */ 43 .bss : 44 { 45 . = ALIGN(4); 46 _sbss = .; /* used by startup code */ 47 *(.sbss) 48 *(.bss .bss.*) 49 *(COMMON) 50 . = ALIGN(4); 51 _ebss = .; /* used by startup code */ 52 } >RAM 53 54 /DISCARD/ : 55 { 56 *(.eh_frame) /* causes 'no memory region specified' error in lld */ 57 } 58 } 59 60 /* For the memory allocator. */ 61 _heap_start = ALIGN(_ebss, 16); 62 _heap_end = ORIGIN(RAM) + LENGTH(RAM); 63 _globals_start = _sdata; 64 _globals_end = _ebss;