Skip to content

Commit

Permalink
Place read-only data in the text section on AVR Tiny targets.
Browse files Browse the repository at this point in the history
	PR target/20849
        * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
        (.rodata): New section.
        (.data): Remove .rodata*.
  • Loading branch information
sprintersb authored and nickclifton committed Feb 27, 2017
1 parent 47612ae commit fbf25df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ld/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-02-27 Georg-Johann Lay <[email protected]>

PR target/20849
* scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
(.rodata): New section.
(.data): Remove .rodata*.

2017-02-25 Alan Modra <[email protected]>

* testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux.
Expand Down
10 changes: 8 additions & 2 deletions ld/scripttempl/avrtiny.sc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH_
__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 2;
__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 2;
__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 4;
__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x4000;

MEMORY
{
Expand Down Expand Up @@ -188,13 +189,18 @@ SECTIONS
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > text}

.rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} :
{
*(.rodata)
${RELOCATING+ *(.rodata*)}
*(.gnu.linkonce.r*)
} ${RELOCATING+AT> text}

.data ${RELOCATING-0} :
{
${RELOCATING+ PROVIDE (__data_start = .) ; }
*(.data)
${RELOCATING+ *(.data*)}
*(.rodata) /* We need to include .rodata here if gcc is used */
${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
*(.gnu.linkonce.d*)
${RELOCATING+. = ALIGN(2);}
${RELOCATING+ _edata = . ; }
Expand Down

0 comments on commit fbf25df

Please sign in to comment.