aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-02-20 13:25:13 +1030
committerAlan Modra <amodra@gmail.com>2017-02-20 19:33:28 +1030
commit74dc9032e79b7950095ee5f94f5517209ef4747e (patch)
tree4cd2fe2d3c2216cb646a0c02d591f7461d62efd4 /ld/scripttempl
parentece5dcc1c00a48ecf63eae71983d04270cef4280 (diff)
downloadgdb-74dc9032e79b7950095ee5f94f5517209ef4747e.zip
gdb-74dc9032e79b7950095ee5f94f5517209ef4747e.tar.gz
gdb-74dc9032e79b7950095ee5f94f5517209ef4747e.tar.bz2
Move .stack before debug sections
PR 20199 * emulparams/elf32m32c.sh: Define STACK_ADDR and STACK_SENTINEL rather than using OTHER_SECTIONS. * emulparams/elf32mt.sh: Likewise. * emulparams/elf32rx.sh: Likewise. * emulparams/elf32rl78.sh: Likewise. Use OTHER_SYMBOLS to define __rl78_abs__. * emulparams/shelf.sh: Define STACK_ADDR and STACK_SENTINEL rather than using OTHER_SECTIONS. * emulparams/shelf32.sh: Likewise. Use OTHER_SECTIONS for .cranges. * emulparams/shelf64.sh: Unset OTHER_SECTIONS. * emulparams/shelf_nbsd.sh: Unset STACK_ADDR not OTHER_SECTIONS. * emulparams/shelf_uclinux.sh: Likewise. * emulparams/shlsymbian.sh: Unset STACK_ADDR. Use OTHER_SYMBOLS to define _stack, not OTHER_SECTIONS. * scripttempl/elf.sc: Move STACK, TINY_DATA_SECTION, and TINY_BSS_SECTION before debug sections. Add STACK_SENTINEL. * scripttempl/arclinux.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/armbpabi.sc: Move STACK before debug sections. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Delete STACK. * scripttempl/epiphany_4x4.sc: Delete STACK. Move TINY_DATA_SECTION, TINY_BSS_SECTION, and .stack before debug sections.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/arclinux.sc11
-rw-r--r--ld/scripttempl/armbpabi.sc2
-rw-r--r--ld/scripttempl/elf.sc13
-rw-r--r--ld/scripttempl/elf64hppa.sc12
-rw-r--r--ld/scripttempl/elf_chaos.sc2
-rw-r--r--ld/scripttempl/elfarc.sc1
-rw-r--r--ld/scripttempl/elfxtensa.sc12
-rw-r--r--ld/scripttempl/epiphany_4x4.sc29
-rw-r--r--ld/scripttempl/nds32elf.sc11
9 files changed, 36 insertions, 57 deletions
diff --git a/ld/scripttempl/arclinux.sc b/ld/scripttempl/arclinux.sc
index f3668d2..e692f13 100644
--- a/ld/scripttempl/arclinux.sc
+++ b/ld/scripttempl/arclinux.sc
@@ -303,10 +303,11 @@ DTOR=".dtors ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
}"
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
*(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
}"
TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
@@ -649,6 +650,9 @@ SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_A
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
EOF
test -z "${NON_ALLOC_DYN}" || emit_dyn
@@ -669,11 +673,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
-
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc
index 0657aa9..dee1028 100644
--- a/ld/scripttempl/armbpabi.sc
+++ b/ld/scripttempl/armbpabi.sc
@@ -317,6 +317,7 @@ cat <<EOF
${RELOCATING+_end = .;}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${STACK_ADDR+${STACK}}
/* These sections are not mapped under the BPABI. */
.dynamic 0 : { *(.dynamic) }
@@ -342,7 +343,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${STACK_ADDR+${STACK}}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
${RELOCATING+${DISCARDED}}
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index e65f9a3..d9138bc 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -305,10 +305,11 @@ DTOR=".dtors ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
}"
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
*(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
}"
TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
@@ -641,7 +642,7 @@ EOF
LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});"
SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});"
- cat <<EOF
+cat <<EOF
${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
${RELOCATING+${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}}
${RELOCATING+${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}}
@@ -651,6 +652,9 @@ SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_A
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
EOF
test -z "${NON_ALLOC_DYN}" || emit_dyn
@@ -671,11 +675,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
-
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/elf64hppa.sc b/ld/scripttempl/elf64hppa.sc
index b741f88..dec42b5 100644
--- a/ld/scripttempl/elf64hppa.sc
+++ b/ld/scripttempl/elf64hppa.sc
@@ -255,10 +255,11 @@ DTOR=".dtors ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
}"
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
- ${RELOCATING+_stack = .;}
+ ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
*(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
}"
TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
@@ -513,6 +514,9 @@ cat <<EOF
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
EOF
if test -n "${NON_ALLOC_DYN}"; then
@@ -545,10 +549,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/elf_chaos.sc b/ld/scripttempl/elf_chaos.sc
index b6d5956..8fe15b4 100644
--- a/ld/scripttempl/elf_chaos.sc
+++ b/ld/scripttempl/elf_chaos.sc
@@ -317,6 +317,7 @@ cat <<EOF
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+_end = .;}
${RELOCATING+PROVIDE (end = .);}
+ ${STACK_ADDR+${STACK}}
/* Stabs debugging sections. */
. = ALIGN(0x1000);
@@ -335,7 +336,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/elfarc.sc b/ld/scripttempl/elfarc.sc
index 9d1e139..6754c02 100644
--- a/ld/scripttempl/elfarc.sc
+++ b/ld/scripttempl/elfarc.sc
@@ -433,7 +433,6 @@ cat <<EOF
/* ARC Extension Sections */
.arcextmap 0 : { *(.gnu.linkonce.arcextmap.*) }
- ${STACK_ADDR+${STACK}}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${STACKNOTE}}
diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
index 6eb9d33..769168e 100644
--- a/ld/scripttempl/elfxtensa.sc
+++ b/ld/scripttempl/elfxtensa.sc
@@ -272,10 +272,11 @@ DTOR=".dtors ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
}"
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
- ${RELOCATING+_stack = .;}
+ ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
*(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
}"
# If this is for an embedded system, don't add SIZEOF_HEADERS.
@@ -523,6 +524,9 @@ cat <<EOF
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
EOF
if test -n "${NON_ALLOC_DYN}"; then
@@ -555,10 +559,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/epiphany_4x4.sc b/ld/scripttempl/epiphany_4x4.sc
index 10d3d23..b661fc2 100644
--- a/ld/scripttempl/epiphany_4x4.sc
+++ b/ld/scripttempl/epiphany_4x4.sc
@@ -54,7 +54,6 @@
# combination of .init sections.
# FINI_START, FINI_END - statements just before and just after
# combination of .fini sections.
-# STACK_ADDR - start of a .stack section.
# OTHER_SYMBOLS - symbols to place right at the end of the script.
# ETEXT_NAME - name of a symbol for the end of the text section,
# normally etext.
@@ -242,11 +241,6 @@ DTOR=".dtors ADDR(.ctors) + SIZEOF(.ctors) ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
} /*> INTERNAL_RAM*/ "
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
- {
- ${RELOCATING+___stack = .;}
- *(.stack)
- }"
# If this is for an embedded system, don't add SIZEOF_HEADERS.
if [ -z "$EMBEDDED" ]; then
@@ -608,6 +602,12 @@ cat <<EOF
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+
+ PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;
+ .stack ${RELOCATING+__stack_start_} : { ${RELOCATING+___stack = .;} *(.stack) }
+
+ PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );
+ PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );
EOF
if test -n "${NON_ALLOC_DYN}"; then
@@ -640,23 +640,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- /*${STACK_ADDR+${STACK}}*/
-
- PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;
- .stack ${RELOCATING+__stack_start_} : { ___stack = .; *(.stack) }
-
- PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );
- /*.heap_start __heap_start_ : { _heap_start_ = .; *(.heap_start) }*/
-
- PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );
-
-
- /* .heap_end __heap_end_ : { _heap_end_ = .; *(.heap_end) }*/
-
-
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}
diff --git a/ld/scripttempl/nds32elf.sc b/ld/scripttempl/nds32elf.sc
index de2b28b..db4bf57 100644
--- a/ld/scripttempl/nds32elf.sc
+++ b/ld/scripttempl/nds32elf.sc
@@ -246,10 +246,11 @@ DTOR=".dtors ${CONSTRUCTING-0} :
KEEP (*(.dtors))
${CONSTRUCTING+${DTOR_END}}
}"
-STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
*(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
}"
TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
@@ -594,6 +595,9 @@ SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_A
${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
EOF
test -z "${NON_ALLOC_DYN}" || emit_dyn
@@ -614,11 +618,6 @@ EOF
. $srcdir/scripttempl/DWARF.sc
cat <<EOF
-
- ${TINY_DATA_SECTION}
- ${TINY_BSS_SECTION}
-
- ${STACK_ADDR+${STACK}}
${ATTRS_SECTIONS}
${OTHER_SECTIONS}
${RELOCATING+${OTHER_SYMBOLS}}