diff options
author | Ayke van Laethem <[email protected]> | 2020-10-31 20:40:20 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-10-31 21:06:26 +0100 |
commit | 171f793c1e2d93ba0b78fc4b2b0625715f03e115 (patch) | |
tree | 2bf7c34673a61eda9687ae2ecf4dc6e7aaf15ee2 /targets/avr.ld | |
parent | 3364da6f25b130229dda740fffeed1e03a0edff3 (diff) | |
download | tinygo-171f793c1e2d93ba0b78fc4b2b0625715f03e115.tar.gz tinygo-171f793c1e2d93ba0b78fc4b2b0625715f03e115.zip |
avr: properly support the .rodata section
Unfortunately, the .rodata section can't be stored in flash. Instead, an
explicit .progmem section should be used, which is supported in LLVM as
address space 1 but not exposed to normal programs.
Eventually a pass should be written that converts trivial const globals
of which all loads are visible to be in addrspace 1, to get the benefits
of storing those globals directly in ROM.
Diffstat (limited to 'targets/avr.ld')
-rw-r--r-- | targets/avr.ld | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/targets/avr.ld b/targets/avr.ld index a7c2d90cf..720465ca4 100644 --- a/targets/avr.ld +++ b/targets/avr.ld @@ -13,8 +13,8 @@ SECTIONS KEEP(*(.text.__vector_RESET)) KEEP(*(.text.main)) /* main must follow the reset handler */ *(.text.*) - *(.rodata) - *(.rodata.*) + *(.progmem) + *(.progmem.*) } .stack (NOLOAD) : @@ -28,6 +28,8 @@ SECTIONS .data : { _sdata = .; /* used by startup code */ + *(.rodata) + *(.rodata.*) *(.data) *(.data*) _edata = .; /* used by startup code */ |