diff options
author | Alan Modra <amodra@gmail.com> | 2017-02-20 13:25:13 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-02-20 19:33:28 +1030 |
commit | 74dc9032e79b7950095ee5f94f5517209ef4747e (patch) | |
tree | 4cd2fe2d3c2216cb646a0c02d591f7461d62efd4 /ld/emulparams | |
parent | ece5dcc1c00a48ecf63eae71983d04270cef4280 (diff) | |
download | gdb-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/emulparams')
-rw-r--r-- | ld/emulparams/elf32m32c.sh | 17 | ||||
-rw-r--r-- | ld/emulparams/elf32mt.sh | 17 | ||||
-rw-r--r-- | ld/emulparams/elf32rl78.sh | 21 | ||||
-rw-r--r-- | ld/emulparams/elf32rx.sh | 17 | ||||
-rw-r--r-- | ld/emulparams/shelf.sh | 16 | ||||
-rw-r--r-- | ld/emulparams/shelf32.sh | 26 | ||||
-rw-r--r-- | ld/emulparams/shelf64.sh | 11 | ||||
-rw-r--r-- | ld/emulparams/shelf_nbsd.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/shelf_uclinux.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/shlsymbian.sh | 4 |
10 files changed, 33 insertions, 100 deletions
diff --git a/ld/emulparams/elf32m32c.sh b/ld/emulparams/elf32m32c.sh index eaf2c4e..cd2b700 100644 --- a/ld/emulparams/elf32m32c.sh +++ b/ld/emulparams/elf32m32c.sh @@ -10,17 +10,8 @@ TEMPLATE_NAME=elf32 EXTRA_EM_FILE=needrelax ELFSIZE=32 MAXPAGESIZE=256 -# This is like setting STACK_ADDR to 0x0073FFFF0, except that the setting can -# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra -# sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(__stack) ? __stack : 0x7fc)} : - { - ${RELOCATING+__stack = .;} - *(.stack) - LONG(0xdeaddead) - }" + +STACK_ADDR="(DEFINED(__stack) ? __stack : 0x7fc)" +STACK_SENTINEL="LONG(0xdeaddead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +test -n "$CREATE_SHLIB" && unset STACK_ADDR diff --git a/ld/emulparams/elf32mt.sh b/ld/emulparams/elf32mt.sh index 04fc1ed..6880db8 100644 --- a/ld/emulparams/elf32mt.sh +++ b/ld/emulparams/elf32mt.sh @@ -10,17 +10,8 @@ ENTRY=_start EMBEDDED=yes ELFSIZE=32 MAXPAGESIZE=256 -# This is like setting STACK_ADDR to 0x0073FFFF0, except that the setting can -# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra -# sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(__stack) ? __stack : 0x007FFFF0)} : - { - ${RELOCATING+__stack = .;} - *(.stack) - LONG(0xdeaddead) - }" + +STACK_ADDR="(DEFINED(__stack) ? __stack : 0x007FFFF0)" +STACK_SENTINEL="LONG(0xdeaddead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +test -n "$CREATE_SHLIB" && unset STACK_ADDR diff --git a/ld/emulparams/elf32rl78.sh b/ld/emulparams/elf32rl78.sh index 7073efb..b782d03 100644 --- a/ld/emulparams/elf32rl78.sh +++ b/ld/emulparams/elf32rl78.sh @@ -10,18 +10,11 @@ TEMPLATE_NAME=elf32 ELFSIZE=32 # EXTRA_EM_FILE=needrelax MAXPAGESIZE=256 -# This is like setting STACK_ADDR to 0xffedc, except that the setting can -# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra -# sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(__stack) ? __stack : 0xffedc)} : - { - ${RELOCATING+__stack = .;} - *(.stack) - LONG(0xdead) - } - ${RELOCATING+PROVIDE (__rl78_abs__ = 0);}" + +STACK_ADDR="(DEFINED(__stack) ? __stack : 0xffedc)" +STACK_SENTINEL="LONG(0xdead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +test -n "$CREATE_SHLIB" && unset STACK_ADDR + +OTHER_SYMBOLS="PROVIDE (__rl78_abs__ = 0);" +test -n "$CREATE_SHLIB" && unset OTHER_SYMBOLS diff --git a/ld/emulparams/elf32rx.sh b/ld/emulparams/elf32rx.sh index 2288667..e139be7 100644 --- a/ld/emulparams/elf32rx.sh +++ b/ld/emulparams/elf32rx.sh @@ -11,20 +11,11 @@ EXTRA_EM_FILE=rxelf # EXTRA_EM_FILE=needrelax ELFSIZE=32 MAXPAGESIZE=256 -# This is like setting STACK_ADDR to 0xbffffffc, except that the setting can -# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra -# sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(__stack) ? __stack : 0xbffffffc)} : - { - ${RELOCATING+__stack = .;} - *(.stack) - LONG(0xdeaddead) - }" + +STACK_ADDR="(DEFINED(__stack) ? __stack : 0xbffffffc)" +STACK_SENTINEL="LONG(0xdeaddead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +test -n "$CREATE_SHLIB" && unset STACK_ADDR OTHER_TEXT_SECTIONS='*(P)' OTHER_READONLY_SECTIONS='C_1 : { *(C_1) } C_2 : { *(C_2) } C : { *(C) } W_1 : { *(W_1) } W_2 : { *(W_2) } W : { *(W) }' diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh index d3f4752..8d79b8d 100644 --- a/ld/emulparams/shelf.sh +++ b/ld/emulparams/shelf.sh @@ -21,17 +21,7 @@ CTOR_START='___ctors = .;' CTOR_END='___ctors_end = .;' DTOR_START='___dtors = .;' DTOR_END='___dtors_end = .;' -# This is like setting STACK_ADDR to 0x3FFFFF00, except that the setting can -# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra -# sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x3FFFFF00)} : - { - ${RELOCATING+_stack = .;} - *(.stack) - LONG(0xdeaddead) - }" +STACK_ADDR="(DEFINED(_stack) ? _stack : 0x3FFFFF00)" +STACK_SENTINEL="LONG(0xdeaddead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +test -n "$CREATE_SHLIB" && unset STACK_ADDR diff --git a/ld/emulparams/shelf32.sh b/ld/emulparams/shelf32.sh index bf362c5..7f46407 100644 --- a/ld/emulparams/shelf32.sh +++ b/ld/emulparams/shelf32.sh @@ -34,28 +34,12 @@ CTOR_END='___ctors_end = .;' DTOR_START='___dtors = .;' DTOR_END='___dtors_end = .;' -# Do not use the varname=${varname-'string'} construct here; there are -# problems with that on some shells (e.g. on Solaris) where there is a bug -# that trigs when $varname contains a "}". -# The effect of the .stack definition is like setting STACK_ADDR to 0x80000, -# except that the setting can be overridden, e.g. --defsym _stack=0xff000, -# and that we put an extra sentinal value at the bottom. -# N.B. We can't use PROVIDE to set the default value in a symbol because -# the address is needed to place the .stack section, which in turn is needed -# to hold the sentinel value(s). -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" - .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : ALIGN (0x40000) + 0x80000)} : - { - ${RELOCATING+_stack = .;} - *(.stack) - LONG(0xdeaddead) - } - .cranges 0 : { *(.cranges) } -" +STACK_ADDR="(DEFINED(_stack) ? _stack : ALIGN (0x40000) + 0x80000)" +STACK_SENTINEL="LONG(0xdeaddead)" # We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS=" - .cranges 0 : { *(.cranges) } -" +test -n "$CREATE_SHLIB" && unset STACK_ADDR + +OTHER_SECTIONS=".cranges 0 : { *(.cranges) }" # We need to adjust sizes in the .cranges section after relaxation, so # we need an after_allocation function, and it goes in this file. diff --git a/ld/emulparams/shelf64.sh b/ld/emulparams/shelf64.sh index 5037f35..5ddcc8d 100644 --- a/ld/emulparams/shelf64.sh +++ b/ld/emulparams/shelf64.sh @@ -6,13 +6,4 @@ EXTRA_EM_FILE= . ${srcdir}/emulparams/shelf32.sh # We do not need .cranges -test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" - .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : ALIGN (0x40000) + 0x80000)} : - { - ${RELOCATING+_stack = .;} - *(.stack) - LONG(0xdeaddead) - } -" -# We do not need .stack for shared library. -test -n "$CREATE_SHLIB" && OTHER_SECTIONS="" +unset OTHER_SECTIONS diff --git a/ld/emulparams/shelf_nbsd.sh b/ld/emulparams/shelf_nbsd.sh index 9d331c6..b27993d 100644 --- a/ld/emulparams/shelf_nbsd.sh +++ b/ld/emulparams/shelf_nbsd.sh @@ -12,4 +12,4 @@ DATA_START_SYMBOLS='PROVIDE (__data_start = .);'; ENTRY=_start unset EMBEDDED -unset OTHER_SECTIONS +unset STACK_ADDR diff --git a/ld/emulparams/shelf_uclinux.sh b/ld/emulparams/shelf_uclinux.sh index 2af5da4..dac390e 100644 --- a/ld/emulparams/shelf_uclinux.sh +++ b/ld/emulparams/shelf_uclinux.sh @@ -1,4 +1,4 @@ . ${srcdir}/emulparams/shelf.sh # We do not want a .stack section -OTHER_SECTIONS="" +unset STACK_ADDR diff --git a/ld/emulparams/shlsymbian.sh b/ld/emulparams/shlsymbian.sh index 9c6dfba..f729bb5 100644 --- a/ld/emulparams/shlsymbian.sh +++ b/ld/emulparams/shlsymbian.sh @@ -11,7 +11,9 @@ DTOR_START='__dtors = .;' DTOR_END='__dtors_end = .;' # Suppress the .stack section. -test -z "$CREATE_SHLIB" && OTHER_SECTIONS="${RELOCATING+PROVIDE (_stack = 0x30000);}" +unset STACK_ADDR +OTHER_SYMBOLS="PROVIDE (_stack = 0x30000);" +test -n "$CREATE_SHLIB" && unset OTHER_SYMBOLS OUTPUT_FORMAT="elf32-shl-symbian" SCRIPT_NAME=elf32sh-symbian |