1TEMPLATE_NAME=elf
2GENERATE_SHLIB_SCRIPT=yes
3ELFSIZE=64
4SCRIPT_NAME=elf
5OUTPUT_FORMAT="elf64-mmix"
6NO_REL_RELOCS=yes
7ENTRY=_start.
8
9# Default to 0 as mmixal does.
10TEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
11# Don't add SIZEOF_HEADERS.
12# Don't set EMBEDDED, that would be misleading; it's not that kind of system.
13TEXT_BASE_ADDRESS=$TEXT_START_ADDR
14DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
15
16MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
17ARCH=mmix
18MACHINE=
19EXTRA_EM_FILE=mmixelf
20
21# The existence of a symbol __start (or _start) should overrule Main, so
22# it can be a user symbol without the associated mmixal magic.  We
23# also want to provide Main as a synonym for _start, if Main wasn't
24# defined but is referred to, and _start was defined.
25#
26# The reason we use a symbol "_start." as a mediator is to avoid
27# causing ld to force the type of _start to object rather than no
28# type, which confuses disassembly; we also make it alphanumerically
29# a successor of _start for similar reasons.  Perhaps it's a linker
30# bug that linker-defined symbols set the symbol-type.
31#
32# Note that we smuggle this into OTHER_TEXT_SECTIONS (at the end
33# of .text) rather than TEXT_START_SYMBOLS.  This is necessary, as
34# DEFINED wouldn't find the symbol if it was at the top; presumably
35# before the definition, if the definition is not in the first file.
36# FIXME: Arguably a linker bug.
37# Only do this for a final link, or else we'll mess up e.g. error
38# messages.
39OTHER_TEXT_SECTIONS="
40${RELOCATING+
41 _start. = (DEFINED (_start) ? _start
42	    : (DEFINED (Main) ? Main : (DEFINED (.text) ? .text : 0)));
43 PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.));
44}"
45
46# We need a symbol at the end of the read-only data, which is
47# colocated with the code.  We make __etext fit.
48ETEXT_LAST_IN_RODATA_SEGMENT=" "
49
50OTHER_SECTIONS='
51 .MMIX.reg_contents :
52 {
53   /* Note that this section always has a fixed VMA - that of its
54      first register * 8.  */
55   *(.MMIX.reg_contents.linker_allocated);
56   *(.MMIX.reg_contents);
57 }
58'
59
60# FIXME: Also bit by the PROVIDE bug?  If not, this could be
61# EXECUTABLE_SYMBOLS.
62# By default, put the high end of the stack where the register stack
63# begins.  They grow in opposite directions.  */
64OTHER_SYMBOLS="PROVIDE (__Stack_start = 0x6000000000000000);"
65