Place read-only data in the text section on AVR Tiny targets.
authorGeorg-Johann Lay <gjl@gcc.gnu.org>
Mon, 27 Feb 2017 17:05:53 +0000 (17:05 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 27 Feb 2017 17:05:53 +0000 (17:05 +0000)
PR target/20849
        * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
        (.rodata): New section.
        (.data): Remove .rodata*.

ld/ChangeLog
ld/scripttempl/avrtiny.sc

index 6e844a66c9af0e23b646d741cf947035f13b348f..a4f2406f21a72e312f2f2f3139053191977a8495 100644 (file)
@@ -1,3 +1,10 @@
+2017-02-27   Georg-Johann Lay  <gjl@gcc.gnu.org>
+
+       PR target/20849
+        * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
+        (.rodata): New section.
+        (.data): Remove .rodata*.
+
 2017-02-25  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux.
index 6fd22467efc98581eafabd2fa1572079bb612764..5a6d4aed858c6823b353cbb2ef248bc67cf75712 100644 (file)
@@ -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
 {
@@ -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 = . ; }