1*d2201f2fSdrahnTEMPLATE_NAME=elf32
2*d2201f2fSdrahnGENERATE_SHLIB_SCRIPT=yes
3*d2201f2fSdrahnELFSIZE=64
4*d2201f2fSdrahnSCRIPT_NAME=elf
5*d2201f2fSdrahnOUTPUT_FORMAT="elf64-mmix"
6*d2201f2fSdrahnENTRY=_start.
7*d2201f2fSdrahn
8*d2201f2fSdrahn# Default to 0 as mmixal does.
9*d2201f2fSdrahnTEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
10*d2201f2fSdrahn# Don't add SIZEOF_HEADERS.
11*d2201f2fSdrahn# Don't set EMBEDDED, that would be misleading; it's not that kind of system.
12*d2201f2fSdrahnTEXT_BASE_ADDRESS=$TEXT_START_ADDR
13*d2201f2fSdrahnDATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
14*d2201f2fSdrahn
15*d2201f2fSdrahn# Setting this anywhere near the quite reasonable value of 0x10000
16*d2201f2fSdrahn# causes the binary to bloat to reach page alignment between segments.
17*d2201f2fSdrahn# Let's just have a 256-byte default page alignment.  Having some
18*d2201f2fSdrahn# alignment at all gives a warm feeling but not much more.
19*d2201f2fSdrahnMAXPAGESIZE=256
20*d2201f2fSdrahnARCH=mmix
21*d2201f2fSdrahnMACHINE=
22*d2201f2fSdrahnCOMPILE_IN=yes
23*d2201f2fSdrahnEXTRA_EM_FILE=mmixelf
24*d2201f2fSdrahn
25*d2201f2fSdrahn# The existence of a symbol __start (or _start) should overrule Main, so
26*d2201f2fSdrahn# it can be a user symbol without the associated mmixal magic.  We
27*d2201f2fSdrahn# also want to provide Main as a synonym for _start, if Main wasn't
28*d2201f2fSdrahn# defined but is referred to, and _start was defined.
29*d2201f2fSdrahn#
30*d2201f2fSdrahn# The reason we use a symbol "_start." as a mediator is to avoid
31*d2201f2fSdrahn# causing ld to force the type of _start to object rather than no
32*d2201f2fSdrahn# type, which confuses disassembly; we also make it alphanumerically
33*d2201f2fSdrahn# a successor of _start for similar reasons.  Perhaps it's a linker
34*d2201f2fSdrahn# bug that linker-defined symbols set the symbol-type.
35*d2201f2fSdrahn#
36*d2201f2fSdrahn# Note that we smuggle this into OTHER_TEXT_SECTIONS (at the end
37*d2201f2fSdrahn# of .text) rather than TEXT_START_SYMBOLS.  This is necessary, as
38*d2201f2fSdrahn# DEFINED wouldn't find the symbol if it was at the top; presumably
39*d2201f2fSdrahn# before the definition, if the definition is not in the first file.
40*d2201f2fSdrahn# FIXME: Arguably a linker bug.
41*d2201f2fSdrahnOTHER_TEXT_SECTIONS='
42*d2201f2fSdrahn _start. = (DEFINED (_start) ? _start
43*d2201f2fSdrahn            : (DEFINED (Main) ? Main : (DEFINED (.text) ? .text : 0)));
44*d2201f2fSdrahn PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.));
45*d2201f2fSdrahn'
46*d2201f2fSdrahn
47*d2201f2fSdrahnOTHER_SECTIONS='
48*d2201f2fSdrahn .MMIX.reg_contents :
49*d2201f2fSdrahn {
50*d2201f2fSdrahn   /* Note that this section always has a fixed VMA - that of its
51*d2201f2fSdrahn      first register * 8.  */
52*d2201f2fSdrahn   *(.MMIX.reg_contents.linker_allocated);
53*d2201f2fSdrahn   *(.MMIX.reg_contents);
54*d2201f2fSdrahn }
55*d2201f2fSdrahn'
56*d2201f2fSdrahn
57*d2201f2fSdrahn# FIXME: Also bit by the PROVIDE bug?  If not, this could be
58*d2201f2fSdrahn# EXECUTABLE_SYMBOLS.
59*d2201f2fSdrahn# By default, put the high end of the stack where the register stack
60*d2201f2fSdrahn# begins.  They grow in opposite directions.  */
61*d2201f2fSdrahnOTHER_END_SYMBOLS="PROVIDE (__Stack_start = 0x6000000000000000);"
62