summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/ld/emulparams
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/binutils/ld/emulparams')
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armelf.sh5
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armelf_linux.sh6
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armelf_oabi.sh3
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armelfb.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armelfb_linux.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/armnto.sh3
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/coff_i860.sh5
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32_i860.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32am33lin.sh11
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32-defs.sh31
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32.sh3
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32bsmip.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32btsmipn32.sh3
-rwxr-xr-xgnu/usr.bin/binutils/ld/emulparams/elf32frv.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32frvfd.sh15
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32ip2k.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32mcore.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32mipswindiss.sh27
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32xtensa.sh26
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64_ia64.sh14
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64_ia64_fbsd.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64_s390.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64bmip.sh9
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64btsmip.sh3
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf64ppc.sh18
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf_s390.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/h8300sx.sh5
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/h8300sxelf.sh3
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/h8300sxn.sh5
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/h8300sxnelf.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/hppanbsd.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/m32relf_linux.sh13
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/m32rlelf.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/m32rlelf_linux.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/mn10300.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/msp430all.sh804
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shelf.sh5
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shelf32.sh23
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shelf32_nbsd.sh4
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shelf64.sh11
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shlelf32_linux.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/shlelf_linux.sh2
42 files changed, 1017 insertions, 66 deletions
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armelf.sh b/gnu/usr.bin/binutils/ld/emulparams/armelf.sh
index 9e2ada7b1ea..35a6d232573 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/armelf.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/armelf.sh
@@ -7,9 +7,9 @@ TEXT_START_ADDR=0x8000
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
-OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
DATA_START_SYMBOLS='__data_start = . ;';
@@ -23,3 +23,6 @@ EMBEDDED=yes
# This sets the stack to the top of the simulator memory (2^19 bytes).
STACK_ADDR=0x80000
+
+# ARM does not support .s* sections.
+NO_SMALL_DATA=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armelf_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/armelf_linux.sh
index f03fb760372..88a2d19151d 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/armelf_linux.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/armelf_linux.sh
@@ -4,14 +4,18 @@ OUTPUT_FORMAT="elf32-littlearm"
BIG_OUTPUT_FORMAT="elf32-bigarm"
LITTLE_OUTPUT_FORMAT="elf32-littlearm"
MAXPAGESIZE=0x8000
+COMMONPAGESIZE=0x1000
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
GENERATE_SHLIB_SCRIPT=yes
DATA_START_SYMBOLS='__data_start = . ;';
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
-OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
TEXT_START_ADDR=0x00008000
+
+# ARM does not support .s* sections.
+NO_SMALL_DATA=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armelf_oabi.sh b/gnu/usr.bin/binutils/ld/emulparams/armelf_oabi.sh
index f1c967dcb66..0c2c1d313c1 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/armelf_oabi.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/armelf_oabi.sh
@@ -18,3 +18,6 @@ EMBEDDED=yes
# This sets the stack to the top of the simulator memory (2^19 bytes).
STACK_ADDR=0x80000
+
+# ARM does not support .s* sections.
+NO_SMALL_DATA=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armelfb.sh b/gnu/usr.bin/binutils/ld/emulparams/armelfb.sh
new file mode 100644
index 00000000000..2d8f38217ac
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/armelfb.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/armelf.sh
+OUTPUT_FORMAT="elf32-bigarm"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armelfb_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/armelfb_linux.sh
new file mode 100644
index 00000000000..9ce9e9abf39
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/armelfb_linux.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/armelf_linux.sh
+OUTPUT_FORMAT="elf32-bigarm"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/armnto.sh b/gnu/usr.bin/binutils/ld/emulparams/armnto.sh
index d000de3bb49..7e4644bc80c 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/armnto.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/armnto.sh
@@ -22,3 +22,6 @@ ENTRY=_start
# This sets the stack to the top of the simulator memory (2^19 bytes).
STACK_ADDR=0x80000
+
+# ARM does not support .s* sections.
+NO_SMALL_DATA=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/coff_i860.sh b/gnu/usr.bin/binutils/ld/emulparams/coff_i860.sh
new file mode 100644
index 00000000000..03b649313c0
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/coff_i860.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=i860coff
+OUTPUT_FORMAT="coff-i860"
+PAGE_SIZE=0x1000
+MAXPAGESIZE=0x1000
+ARCH=i860
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32_i860.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32_i860.sh
index 531c493f5c5..6769fa54d26 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32_i860.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32_i860.sh
@@ -3,6 +3,7 @@ SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i860-little"
BIG_OUTPUT_FORMAT="elf32-i860"
LITTLE_OUTPUT_FORMAT="elf32-i860-little"
+TEXT_START_ADDR=0
PAGE_SIZE=0x1000
MAXPAGESIZE=0x1000
ARCH=i860
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32am33lin.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32am33lin.sh
new file mode 100644
index 00000000000..f8b3a890621
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32am33lin.sh
@@ -0,0 +1,11 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-am33lin"
+TEXT_START_ADDR=0x8000000
+MAXPAGESIZE=0x1000
+NONPAGED_TEXT_START_ADDR=0x8000000
+ARCH=mn10300
+MACHINE=
+NOP=0xcbcb
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32-defs.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32-defs.sh
index 790eecf6f8d..f7b0d08f858 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32-defs.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32-defs.sh
@@ -50,28 +50,9 @@ TEXT_START_SYMBOLS='_ftext = . ;'
DATA_START_SYMBOLS='_fdata = . ;'
OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS="
- .MIPS.events.text ${RELOCATING-0} :
- {
- *(.MIPS.events.text${RELOCATING+ .MIPS.events.gnu.linkonce.t*})
- }
- .MIPS.content.text ${RELOCATING-0} :
- {
- *(.MIPS.content.text${RELOCATING+ .MIPS.content.gnu.linkonce.t*})
- }
- .MIPS.events.data ${RELOCATING-0} :
- {
- *(.MIPS.events.data${RELOCATING+ .MIPS.events.gnu.linkonce.d*})
- }
- .MIPS.content.data ${RELOCATING-0} :
- {
- *(.MIPS.content.data${RELOCATING+ .MIPS.content.gnu.linkonce.d*})
- }
- .MIPS.events.rodata ${RELOCATING-0} :
- {
- *(.MIPS.events.rodata${RELOCATING+ .MIPS.events.gnu.linkonce.r*})
- }
- .MIPS.content.rodata ${RELOCATING-0} :
- {
- *(.MIPS.content.rodata${RELOCATING+ .MIPS.content.gnu.linkonce.r*})
- }"
+INITIAL_READONLY_SECTIONS=".MIPS.options : { *(.MIPS.options) }"
+# Discard any .MIPS.content* or .MIPS.events* sections. The linker
+# doesn't know how to adjust them.
+OTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"
+
+TEXT_DYNAMIC=
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32.sh
index 75338379ee1..a320eb23ed0 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32bmipn32.sh
@@ -3,6 +3,7 @@ OUTPUT_FORMAT="elf32-nbigmips"
BIG_OUTPUT_FORMAT="elf32-nbigmips"
LITTLE_OUTPUT_FORMAT="elf32-nlittlemips"
SHLIB_TEXT_START_ADDR=0x5ffe0000
+COMMONPAGESIZE=0x1000
# IRIX6 defines these symbols. 0x34 is the size of the ELF header.
EXECUTABLE_SYMBOLS="
@@ -17,3 +18,5 @@ EXECUTABLE_SYMBOLS="
# Following the IRIX linker, we simply put .rodata in the data
# segment.
WRITABLE_RODATA=
+
+EXTRA_EM_FILE=irix
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32bsmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32bsmip.sh
index 5b2939a94f4..dfe0fe06af1 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32bsmip.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32bsmip.sh
@@ -1,2 +1,3 @@
. ${srcdir}/emulparams/elf32bmip.sh
ENTRY=__start
+EXTRA_EM_FILE=irix
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32btsmipn32.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32btsmipn32.sh
index d287417e286..5ca6797e52a 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32btsmipn32.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32btsmipn32.sh
@@ -5,6 +5,7 @@
OUTPUT_FORMAT="elf32-ntradbigmips"
BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
+COMMONPAGESIZE=0x1000
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
@@ -12,5 +13,3 @@ OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
-
-TEXT_DYNAMIC=
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32frv.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32frv.sh
index fd4be3e1847..042ed8c21f8 100755
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32frv.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32frv.sh
@@ -10,6 +10,7 @@ OTHER_EXCLUDE_FILES='*frvend.o'
OTHER_BSS_END_SYMBOLS='__end = .;'
DATA_START_SYMBOLS='__data_start = . ;'
STACK_ADDR=0x200000
+NOP=0x80000000
OTHER_GOT_SYMBOLS='
. = ALIGN(8); _gp = . + 2048;
PROVIDE (gp = _gp);'
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32frvfd.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32frvfd.sh
new file mode 100644
index 00000000000..c49687807df
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32frvfd.sh
@@ -0,0 +1,15 @@
+. ${srcdir}/emulparams/elf32frv.sh
+unset STACK_ADDR
+OUTPUT_FORMAT="elf32-frvfdpic"
+MAXPAGESIZE=0x4000
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+EMBEDDED= # This gets us program headers mapped as part of the text segment.
+OTHER_GOT_SYMBOLS=
+OTHER_READONLY_SECTIONS="
+ .rofixup : {
+ ${RELOCATING+__ROFIXUP_LIST__ = .;}
+ *(.rofixup)
+ ${RELOCATING+__ROFIXUP_END__ = .;}
+ }
+"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32ip2k.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32ip2k.sh
index be2ce337c64..17fb7aba9c7 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32ip2k.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32ip2k.sh
@@ -1,3 +1,4 @@
+TEMPLATE_NAME=elf32
MACHINE=
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-ip2k"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32mcore.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32mcore.sh
index 36befc8cb33..930a9c3c8bc 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32mcore.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32mcore.sh
@@ -47,7 +47,7 @@ PARSE_AND_LIST_OPTIONS='
PARSE_AND_LIST_ARGS_CASES='
case OPTION_BASE_FILE:
- link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
+ link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL)
{
/* xgettext:c-format */
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32mipswindiss.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32mipswindiss.sh
new file mode 100644
index 00000000000..4f1148b9518
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32mipswindiss.sh
@@ -0,0 +1,27 @@
+TEMPLATE_NAME=elf32
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-bigmips"
+BIG_OUTPUT_FORMAT="elf32-bigmips"
+LITTLE_OUTPUT_FORMAT="elf32-littlemips"
+ARCH=mips
+MACHINE=
+EMBEDDED=yes
+MAXPAGESIZE=0x40000
+
+# The data below is taken from the windiss.dld linker script that comes with
+# the Diab linker.
+TEXT_START_ADDR=0x100000
+DATA_START_SYMBOLS='__DATA_ROM = .; __DATA_RAM = .;'
+SDATA_START_SYMBOLS='_SDA_BASE_ = .; _gp = . + 0x7ff0;'
+SDATA2_START_SYMBOLS='_SDA2_BASE_ = .;'
+EXECUTABLE_SYMBOLS='__HEAP_START = .; __SP_INIT = 0x800000; __SP_END = __SP_INIT - 0x20000; __HEAP_END = __SP_END; __DATA_END = _edata; __BSS_START = __bss_start; __BSS_END = _end; __HEAP_START = _end;'
+
+# The Diab tools use a different init/fini convention. Initialization code
+# is place in sections named ".init$NN". These sections are then concatenated
+# into the .init section. It is important that .init$00 be first and .init$99
+# be last. The other sections should be sorted, but the current linker script
+# parse does not seem to allow that with the SORT keyword in this context.
+INIT_START='*(.init$00); *(.init$0[1-9]); *(.init$[1-8][0-9]); *(.init$9[0-8])'
+INIT_END='*(.init$99)'
+FINI_START='*(.fini$00); *(.fini$0[1-9]); *(.fini$[1-8][0-9]); *(.fini$9[0-8])'
+FINI_END='*(.fini$99)'
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32xtensa.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32xtensa.sh
index 12e28820b3f..76f9da85d5a 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32xtensa.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32xtensa.sh
@@ -15,18 +15,18 @@ MACHINE=
GENERATE_SHLIB_SCRIPT=yes
GENERATE_COMBRELOC_SCRIPT=yes
NO_SMALL_DATA=yes
-OTHER_READONLY_SECTIONS='
- .xt_except_table : { KEEP (*(.xt_except_table)) }
- .xt.lit : { *(.xt.lit*) *(.gnu.linkonce.p*) }
-'
-OTHER_READWRITE_SECTIONS='
- .xt_except_desc :
+OTHER_READONLY_SECTIONS="
+ .got.loc ${RELOCATING-0} : { *(.got.loc) }
+ .xt_except_table ${RELOCATING-0} : { KEEP (*(.xt_except_table)) }
+"
+OTHER_READWRITE_SECTIONS="
+ .xt_except_desc ${RELOCATING-0} :
{
- *(.xt_except_desc)
- *(.gnu.linkonce.h.*)
- *(.xt_except_desc_end)
+ *(.xt_except_desc${RELOCATING+ .gnu.linkonce.h.*})
+ ${RELOCATING+*(.xt_except_desc_end)}
}
-'
-OTHER_SECTIONS='
- .xt.insn : { *(.xt.insn) *(.gnu.linkonce.x*) }
-'
+"
+OTHER_SECTIONS="
+ .xt.lit 0 : { *(.xt.lit${RELOCATING+ .xt.lit.* .gnu.linkonce.p.*}) }
+ .xt.insn 0 : { *(.xt.insn${RELOCATING+ .gnu.linkonce.x.*}) }
+"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64.sh
index 817c50adad5..60c8c4c9ebf 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64.sh
@@ -2,7 +2,7 @@
SCRIPT_NAME=elf
ELFSIZE=64
TEMPLATE_NAME=elf32
-EXTRA_EM_FILE=needrelax
+EXTRA_EM_FILE=ia64elf
OUTPUT_FORMAT="elf64-ia64-little"
ARCH=ia64
MACHINE=
@@ -16,12 +16,20 @@ fi
TEXT_START_ADDR="0x4000000000000000"
DATA_ADDR="0x6000000000000000 + (. & (${MAXPAGESIZE} - 1))"
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
NOP=0x00300000010070000002000001000400 # a bundle full of nops
OTHER_GOT_SECTIONS="
.IA_64.pltoff ${RELOCATING-0} : { *(.IA_64.pltoff) }"
OTHER_PLT_RELOC_SECTIONS="
.rela.IA_64.pltoff ${RELOCATING-0} : { *(.rela.IA_64.pltoff) }"
-OTHER_READONLY_SECTIONS="
- .opd ${RELOCATING-0} : { *(.opd) }
+OTHER_READONLY_SECTIONS=
+OTHER_READWRITE_SECTIONS=
+test -z "$CREATE_PIE" && OTHER_READONLY_SECTIONS="
+ .opd ${RELOCATING-0} : { *(.opd) }"
+test -n "$CREATE_PIE" && OTHER_READWRITE_SECTIONS="
+ .opd ${RELOCATING-0} : { *(.opd) }"
+test -n "$CREATE_PIE" && OTHER_GOT_RELOC_SECTIONS="
+ .rela.opd ${RELOCATING-0} : { *(.rela.opd) }"
+OTHER_READONLY_SECTIONS="${OTHER_READONLY_SECTIONS}
.IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info${RELOCATING+* .gnu.linkonce.ia64unwi.*}) }
.IA_64.unwind ${RELOCATING-0} : { *(.IA_64.unwind${RELOCATING+* .gnu.linkonce.ia64unw.*}) }"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64_fbsd.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64_fbsd.sh
index d9c9600482b..47cde5c5db0 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64_fbsd.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64_ia64_fbsd.sh
@@ -1,2 +1,4 @@
. ${srcdir}/emulparams/elf64_ia64.sh
+TEXT_START_ADDR="0x2000000000000000"
+unset DATA_ADDR
. ${srcdir}/emulparams/elf_fbsd.sh
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64_s390.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64_s390.sh
index e441b8ac4db..0c689a912f9 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64_s390.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64_s390.sh
@@ -9,6 +9,8 @@ MACHINE=
NOP=0x07070707
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+NO_SMALL_DATA=yes
# Treat a host that matches the target with the possible exception of "x"
# in the name as if it were native.
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64bmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64bmip.sh
index 7078a788af9..a4ce6d49519 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64bmip.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64bmip.sh
@@ -2,12 +2,15 @@
OUTPUT_FORMAT="elf64-bigmips"
BIG_OUTPUT_FORMAT="elf64-bigmips"
LITTLE_OUTPUT_FORMAT="elf64-littlemips"
+SHLIB_TEXT_START_ADDR=0x3ffffe0000
# IRIX6 defines these symbols. 0x40 is the size of the ELF header.
EXECUTABLE_SYMBOLS="
__dso_displacement = 0;
- __elf_header = ${TEXT_START_ADDR};
- __program_header_table = ${TEXT_START_ADDR} + 0x40;
+ ${CREATE_SHLIB-${CREATE_PIE-__elf_header = ${TEXT_START_ADDR};}}
+ ${CREATE_SHLIB+__elf_header = ${SHLIB_TEXT_START_ADDR};}
+ ${CREATE_PIE+__elf_header = ${SHLIB_TEXT_START_ADDR};}
+ __program_header_table = __elf_header + 0x40;
"
# There are often dynamic relocations against the .rodata section.
@@ -16,3 +19,5 @@ EXECUTABLE_SYMBOLS="
# Following the IRIX linker, we simply put .rodata in the data
# segment.
WRITABLE_RODATA=
+
+EXTRA_EM_FILE=irix
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64btsmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64btsmip.sh
index c4595ced90a..23a20c7b8b0 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64btsmip.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64btsmip.sh
@@ -7,11 +7,10 @@ BIG_OUTPUT_FORMAT="elf64-tradbigmips"
LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"
# Magic sections.
-INITIAL_READONLY_SECTIONS='.MIPS.options : { *(.MIPS.options) }'
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
-TEXT_DYNAMIC=
+TEXT_START_ADDR="0x120000000"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64ppc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64ppc.sh
index 300b8d4b543..c190b189f69 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf64ppc.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf64ppc.sh
@@ -2,6 +2,7 @@ TEMPLATE_NAME=elf32
EXTRA_EM_FILE=ppc64elf
ELFSIZE=64
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf64-powerpc"
TEXT_START_ADDR=0x10000000
@@ -11,20 +12,21 @@ COMMONPAGESIZE=0x1000
ARCH=powerpc:common64
MACHINE=
NOP=0x60000000
-EXECUTABLE_SYMBOLS='PROVIDE (__stack = 0); PROVIDE (___stack = 0);'
-OTHER_BSS_END_SYMBOLS='__end = .;'
-CTOR_START='PROVIDE (__CTOR_LIST__ = .); PROVIDE (___CTOR_LIST__ = .);'
-CTOR_END='PROVIDE (__CTOR_END__ = .); PROVIDE (___CTOR_END__ = .);'
-DTOR_START='PROVIDE (__DTOR_LIST__ = .); PROVIDE (___DTOR_LIST__ = .);'
-DTOR_END='PROVIDE (__DTOR_END__ = .); PROVIDE (___DTOR_END__ = .);'
OTHER_TEXT_SECTIONS="*(.sfpr .glink)"
BSS_PLT=
OTHER_BSS_SYMBOLS="
.tocbss ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.tocbss)}"
OTHER_PLT_RELOC_SECTIONS="
.rela.tocbss ${RELOCATING-0} : { *(.rela.tocbss) }"
-OTHER_GOT_SECTIONS="
- .toc ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc) }"
+
+if test x${RELOCATING+set} = xset; then
+ GOT="
+ .got ALIGN(8) : { *(.got .toc) }"
+else
+ GOT="
+ .got 0 : { *(.got) }
+ .toc 0 : { *(.toc) }"
+fi
OTHER_GOT_RELOC_SECTIONS="
.rela.toc ${RELOCATING-0} : { *(.rela.toc) }"
OTHER_READWRITE_SECTIONS="
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf_s390.sh b/gnu/usr.bin/binutils/ld/emulparams/elf_s390.sh
index 2804aceeb9b..e7106731114 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf_s390.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf_s390.sh
@@ -8,3 +8,5 @@ MACHINE=
NOP=0x07070707
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+NO_SMALL_DATA=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/h8300sx.sh b/gnu/usr.bin/binutils/ld/emulparams/h8300sx.sh
new file mode 100644
index 00000000000..b46b6f97bc4
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/h8300sx.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=h8300sx
+OUTPUT_FORMAT="coff-h8300"
+TEXT_START_ADDR=0x8000
+TARGET_PAGE_SIZE=128
+ARCH=h8300
diff --git a/gnu/usr.bin/binutils/ld/emulparams/h8300sxelf.sh b/gnu/usr.bin/binutils/ld/emulparams/h8300sxelf.sh
new file mode 100644
index 00000000000..18f82f64f43
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/h8300sxelf.sh
@@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/h8300elf.sh
+ARCH="h8300:h8300sx"
+STACK_ADDR=0x2fefc
diff --git a/gnu/usr.bin/binutils/ld/emulparams/h8300sxn.sh b/gnu/usr.bin/binutils/ld/emulparams/h8300sxn.sh
new file mode 100644
index 00000000000..7cad9746a44
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/h8300sxn.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=h8300sxn
+OUTPUT_FORMAT="coff-h8300"
+TEXT_START_ADDR=0x8000
+TARGET_PAGE_SIZE=128
+ARCH=h8300
diff --git a/gnu/usr.bin/binutils/ld/emulparams/h8300sxnelf.sh b/gnu/usr.bin/binutils/ld/emulparams/h8300sxnelf.sh
new file mode 100644
index 00000000000..98e9d497261
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/h8300sxnelf.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/h8300elf.sh
+ARCH="h8300:h8300sxn"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/hppanbsd.sh b/gnu/usr.bin/binutils/ld/emulparams/hppanbsd.sh
index c782c6d4fb5..3f376b47608 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/hppanbsd.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/hppanbsd.sh
@@ -3,4 +3,3 @@
. ${srcdir}/emulparams/hppalinux.sh
-OUTPUT_FORMAT="elf32-hppa"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/m32relf_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/m32relf_linux.sh
new file mode 100644
index 00000000000..814c91a792e
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/m32relf_linux.sh
@@ -0,0 +1,13 @@
+MACHINE=
+SCRIPT_NAME=elf
+TEMPLATE_NAME=elf32
+OUTPUT_FORMAT="elf32-m32r-linux"
+TEXT_START_ADDR=0x1000
+ARCH=m32r
+MACHINE=
+MAXPAGESIZE=0x1000
+
+# Hmmm, there's got to be a better way. This sets the stack to the
+# top of simulator memory (32MB).
+OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = 0x2000000);'
+GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/m32rlelf.sh b/gnu/usr.bin/binutils/ld/emulparams/m32rlelf.sh
new file mode 100644
index 00000000000..2d4488b57fb
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/m32rlelf.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/m32relf.sh
+OUTPUT_FORMAT="elf32-m32rle"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/m32rlelf_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/m32rlelf_linux.sh
new file mode 100644
index 00000000000..6d16a1ccd33
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/m32rlelf_linux.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/m32relf_linux.sh
+OUTPUT_FORMAT="elf32-m32rle-linux"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/mn10300.sh b/gnu/usr.bin/binutils/ld/emulparams/mn10300.sh
index eec2f84ca82..23bbda440d9 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/mn10300.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/mn10300.sh
@@ -1,3 +1,5 @@
. ${srcdir}/emulparams/mn10200.sh
OUTPUT_FORMAT="elf32-mn10300"
ARCH=mn10300
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/msp430all.sh b/gnu/usr.bin/binutils/ld/emulparams/msp430all.sh
new file mode 100644
index 00000000000..3aa3289ee0d
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/msp430all.sh
@@ -0,0 +1,804 @@
+#!/bin/sh
+
+# This called by genscripts_extra.sh
+
+MSP430_NAME=${EMULATION_NAME}
+
+if [ "${MSP430_NAME}" = "msp430x110" ] ; then
+ARCH=msp:11
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xfc00
+ROM_SIZE=0x3e0
+RAM_START=0x0200
+RAM_SIZE=128
+
+STACK=0x280
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1101" ] ; then
+ARCH=msp:110
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xfc00
+ROM_SIZE=0x3e0
+RAM_START=0x0200
+RAM_SIZE=128
+
+STACK=0x280
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1111" ] ; then
+ARCH=msp:110
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf800
+ROM_SIZE=0x07e0
+RAM_START=0x0200
+RAM_SIZE=128
+
+STACK=0x280
+fi
+
+if [ "${MSP430_NAME}" = "msp430x112" ] ; then
+ARCH=msp:11
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0xfe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1121" ] ; then
+ARCH=msp:110
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0x0fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1122" ] ; then
+ARCH=msp:110
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0x0fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1132" ] ; then
+ARCH=msp:110
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x122" ] ; then
+ARCH=msp:12
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0xfe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1222" ] ; then
+ARCH=msp:12
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0xfe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x123" ] ; then
+ARCH=msp:12
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1232" ] ; then
+ARCH=msp:12
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x133" ] ; then
+ARCH=msp:13
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1331" ] ; then
+ARCH=msp:13
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x135" ] ; then
+ARCH=msp:13
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x1351" ] ; then
+ARCH=msp:13
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x147" ] ; then
+ARCH=msp:14
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x148" ] ; then
+ARCH=msp:14
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x4000
+ROM_SIZE=0xbef0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430x149" ] ; then
+ARCH=msp:14
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x1100
+ROM_SIZE=0xeee0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430x155" ] ; then
+ARCH=msp:15
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x156" ] ; then
+ARCH=msp:15
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xa000
+ROM_SIZE=0x5fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x157" ] ; then
+ARCH=msp:15
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x167" ] ; then
+ARCH=msp:16
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x168" ] ; then
+ARCH=msp:16
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x4000
+ROM_SIZE=0xbef0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430x169" ] ; then
+ARCH=msp:16
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x1100
+ROM_SIZE=0xeee0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430x311" ] ; then
+ARCH=msp:31
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf800
+ROM_SIZE=0x07e0
+RAM_START=0x0200
+RAM_SIZE=128
+
+STACK=0x280
+fi
+
+if [ "${MSP430_NAME}" = "msp430x312" ] ; then
+ARCH=msp:31
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0x0fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x313" ] ; then
+ARCH=msp:31
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x314" ] ; then
+ARCH=msp:31
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xd000
+ROM_SIZE=0x2fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x315" ] ; then
+ARCH=msp:31
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x323" ] ; then
+ARCH=msp:32
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x325" ] ; then
+ARCH=msp:32
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x336" ] ; then
+ARCH=msp:33
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xa000
+ROM_SIZE=0x5fe0
+RAM_START=0x0200
+RAM_SIZE=1024
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x337" ] ; then
+ARCH=msp:33
+MACHINE=
+SCRIPT_NAME=elf32msp430_3
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1024
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x412" ] ; then
+ARCH=msp:41
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xf000
+ROM_SIZE=0x0fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x413" ] ; then
+ARCH=msp:41
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430x435" ] ; then
+ARCH=msp:43
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430x436" ] ; then
+ARCH=msp:43
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xa000
+ROM_SIZE=0x5fe0
+RAM_START=0x0200
+RAM_SIZE=1024
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x437" ] ; then
+ARCH=msp:43
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1024
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x447" ] ; then
+ARCH=msp:44
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430x448" ] ; then
+ARCH=msp:44
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x4000
+ROM_SIZE=0xbef0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430x449" ] ; then
+ARCH=msp:44
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x1100
+ROM_SIZE=0xeee0
+RAM_START=0x0200
+RAM_SIZE=0x07ff
+
+STACK=0xa00
+fi
+
+if [ "${MSP430_NAME}" = "msp430xE423" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430xE425" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430xE427" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
+
+if [ "${MSP430_NAME}" = "msp430xW423" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xe000
+ROM_SIZE=0x1fe0
+RAM_START=0x0200
+RAM_SIZE=256
+
+STACK=0x300
+fi
+
+if [ "${MSP430_NAME}" = "msp430xW425" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0xc000
+ROM_SIZE=0x3fe0
+RAM_START=0x0200
+RAM_SIZE=512
+
+STACK=0x400
+fi
+
+if [ "${MSP430_NAME}" = "msp430xW427" ] ; then
+ARCH=msp:42
+MACHINE=
+SCRIPT_NAME=elf32msp430
+OUTPUT_FORMAT="elf32-msp430"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=generic
+
+ROM_START=0x8000
+ROM_SIZE=0x7fe0
+RAM_START=0x0200
+RAM_SIZE=1K
+
+STACK=0x600
+fi
diff --git a/gnu/usr.bin/binutils/ld/emulparams/shelf.sh b/gnu/usr.bin/binutils/ld/emulparams/shelf.sh
index 5c0c9d640e8..ef0de461915 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shelf.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shelf.sh
@@ -23,10 +23,11 @@ DTOR_END='___dtors_end = .;'
# 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).
-OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x30000)} :
+test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x30000)} :
{
${RELOCATING+_stack = .;}
*(.stack)
LONG(0xdeaddead)
}"
-
+# We do not need .stack for shared library.
+test -n "$CREATE_SHLIB" && OTHER_SECTIONS=""
diff --git a/gnu/usr.bin/binutils/ld/emulparams/shelf32.sh b/gnu/usr.bin/binutils/ld/emulparams/shelf32.sh
index c05da3f90bf..6582b02839a 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shelf32.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shelf32.sh
@@ -3,7 +3,6 @@
SCRIPT_NAME=elf
OUTPUT_FORMAT=${OUTPUT_FORMAT-"elf32-sh64"}
TEXT_START_ADDR=0x1000
-STACK_ADDR='ALIGN (0x40000) + 0x40000'
MAXPAGESIZE=128
ARCH=sh
MACHINE=sh5
@@ -34,9 +33,25 @@ 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 "}".
-OTHER_SECTIONS='
- .cranges 0 : { *(.cranges) }
-'
+# 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) + 0x40000)} :
+ {
+ ${RELOCATING+_stack = .;}
+ *(.stack)
+ LONG(0xdeaddead)
+ }
+ .cranges 0 : { *(.cranges) }
+"
+# We do not need .stack for shared library.
+test -n "$CREATE_SHLIB" && 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/gnu/usr.bin/binutils/ld/emulparams/shelf32_nbsd.sh b/gnu/usr.bin/binutils/ld/emulparams/shelf32_nbsd.sh
index edd6216860f..14965ef95b5 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shelf32_nbsd.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shelf32_nbsd.sh
@@ -11,3 +11,7 @@ ENTRY=__start
unset EMBEDDED
unset STACK_ADDR
+unset OTHER_SECTIONS
+OTHER_SECTIONS="
+ .cranges 0 : { *(.cranges) }
+"
diff --git a/gnu/usr.bin/binutils/ld/emulparams/shelf64.sh b/gnu/usr.bin/binutils/ld/emulparams/shelf64.sh
index 2c9a9c513bd..eb1f6c76ecd 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shelf64.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shelf64.sh
@@ -6,4 +6,13 @@ EXTRA_EM_FILE=
. ${srcdir}/emulparams/shelf32.sh
# We do not need .cranges
-OTHER_SECTIONS=''
+test -z "$CREATE_SHLIB" && OTHER_SECTIONS="
+ .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : ALIGN (0x40000) + 0x40000)} :
+ {
+ ${RELOCATING+_stack = .;}
+ *(.stack)
+ LONG(0xdeaddead)
+ }
+"
+# We do not need .stack for shared library.
+test -n "$CREATE_SHLIB" && OTHER_SECTIONS=""
diff --git a/gnu/usr.bin/binutils/ld/emulparams/shlelf32_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/shlelf32_linux.sh
index 01b9ce36c98..63a8356c535 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shlelf32_linux.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shlelf32_linux.sh
@@ -10,6 +10,7 @@ MACHINE=sh5
ALIGNMENT=8
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
DATA_START_SYMBOLS='PROVIDE (___data = .);'
diff --git a/gnu/usr.bin/binutils/ld/emulparams/shlelf_linux.sh b/gnu/usr.bin/binutils/ld/emulparams/shlelf_linux.sh
index 875b2f3750b..528b7257f3b 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/shlelf_linux.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/shlelf_linux.sh
@@ -5,10 +5,12 @@ SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh-linux"
TEXT_START_ADDR=0x400000
MAXPAGESIZE=0x10000
+COMMONPAGESIZE=0x1000
ARCH=sh
MACHINE=
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
DATA_START_SYMBOLS='__data_start = . ;';