elf64mmix.sh 2.3 KB

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