aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/avr.sc2
-rw-r--r--ld/scripttempl/elf.sc28
-rw-r--r--ld/scripttempl/elf32msp430.sc12
-rw-r--r--ld/scripttempl/elfarcv2.sc2
-rw-r--r--ld/scripttempl/pru.sc2
5 files changed, 41 insertions, 5 deletions
diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index b85748b..77238d6 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -271,7 +271,7 @@ cat <<EOF
.noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))}
{
${RELOCATING+ PROVIDE (__noinit_start = .) ; }
- *(.noinit*)
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
${RELOCATING+ PROVIDE (__noinit_end = .) ; }
${RELOCATING+ _end = . ; }
${RELOCATING+ PROVIDE (__heap_start = .) ; }
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index eb74743..d9e63e7 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -8,6 +8,8 @@
# NOP - four byte opcode for no-op (defaults to none)
# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
# empty.
+# HAVE_NOINIT - Include a .noinit output section in the script.
+# HAVE_PERSISTENT - Include a .persistent output section in the script.
# SMALL_DATA_CTOR - .ctors contains small data.
# SMALL_DATA_DTOR - .dtors contains small data.
# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
@@ -103,6 +105,8 @@
# .lrodata .gnu.linkonce.lr.foo
# .ldata .gnu.linkonce.l.foo
# .lbss .gnu.linkonce.lb.foo
+# .noinit .gnu.linkonce.n.foo
+# .persistent .gnu.linkonce.p.foo
#
# Each of these can also have corresponding .rel.* and .rela.* sections.
@@ -322,6 +326,28 @@ STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
*(.stack)
${RELOCATING+${STACK_SENTINEL}}
}"
+test "${HAVE_NOINIT}" = "yes" && NOINIT="
+ /* This section contains data that is not initialized during load,
+ or during the application's initialization sequence. */
+ .noinit (NOLOAD) :
+ {
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__noinit_start = .);}
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__noinit_end = .);}
+ }"
+test "${HAVE_PERSISTENT}" = "yes" && PERSISTENT="
+ /* This section contains data that is initialized during load,
+ but not during the application's initialization sequence. */
+ .persistent :
+ {
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__persistent_start = .);}
+ *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*})
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__persistent_end = .);}
+ }"
TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})"
@@ -645,6 +671,7 @@ cat <<EOF
${DATA_SDATA-${SDATA}}
${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_edata = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
+ ${PERSISTENT}
${RELOCATING+. = .;}
${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
${RELOCATING+${OTHER_BSS_SYMBOLS}}
@@ -665,6 +692,7 @@ cat <<EOF
${OTHER_BSS_SECTIONS}
${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${NOINIT}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
EOF
diff --git a/ld/scripttempl/elf32msp430.sc b/ld/scripttempl/elf32msp430.sc
index 4206d79..fafd775 100644
--- a/ld/scripttempl/elf32msp430.sc
+++ b/ld/scripttempl/elf32msp430.sc
@@ -302,17 +302,25 @@ SECTIONS
} ${RELOCATING+ > data}
${RELOCATING+ PROVIDE (__bsssize = SIZEOF(.bss)); }
+ /* This section contains data that is not initialized during load,
+ or during the application's initialization sequence. */
.noinit ${RELOCATING-0}${RELOCATING+SIZEOF(.bss) + ADDR(.bss)} :
{
+ ${RELOCATING+. = ALIGN(2);}
${RELOCATING+ PROVIDE (__noinit_start = .) ; }
- *(.noinit)
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
+ ${RELOCATING+. = ALIGN(2);}
${RELOCATING+ PROVIDE (__noinit_end = .) ; }
} ${RELOCATING+ > data}
+ /* This section contains data that is initialized during load,
+ but not during the application's initialization sequence. */
.persistent ${RELOCATING-0}${RELOCATING+SIZEOF(.noinit) + ADDR(.noinit)} :
{
+ ${RELOCATING+. = ALIGN(2);}
${RELOCATING+ PROVIDE (__persistent_start = .) ; }
- *(.persistent)
+ *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*})
+ ${RELOCATING+. = ALIGN(2);}
${RELOCATING+ PROVIDE (__persistent_end = .) ; }
} ${RELOCATING+ > data}
diff --git a/ld/scripttempl/elfarcv2.sc b/ld/scripttempl/elfarcv2.sc
index b6cab6c..a0c4f7e 100644
--- a/ld/scripttempl/elfarcv2.sc
+++ b/ld/scripttempl/elfarcv2.sc
@@ -283,7 +283,7 @@ SECTIONS
/* Global data not cleared after reset. */
.noinit ${RELOCATING-0}:
{
- *(.noinit*)
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+ PROVIDE (__start_heap = .) ; }
} ${RELOCATING+ > ${DATA_MEMORY}}
diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc
index 9ef7980..08aceaa 100644
--- a/ld/scripttempl/pru.sc
+++ b/ld/scripttempl/pru.sc
@@ -167,7 +167,7 @@ SECTIONS
.noinit ${RELOCATING-0} :
{
${RELOCATING+ PROVIDE (_noinit_start = .) ; }
- *(.noinit)
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
${RELOCATING+ PROVIDE (_noinit_end = .) ; }
${RELOCATING+ PROVIDE (_heap_start = .) ; }
${RELOCATING+ . += __HEAP_SIZE ; }