M2-Planet.1 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. .\"Made with Love
  2. .TH M2-Planet 1 "JULY 2019" Linux "User Manuals"
  3. .SH NAME
  4. M2-Planet \- The PLAtform NEutral Transpiler (Or just terrible C compiler)
  5. .SH SYNOPSIS
  6. .na
  7. M2-Planet --architecture ARCHITECTURE --file FILE [--output FILE] [--debug]
  8. .SH DESCRIPTION
  9. M2 is the most minimal C compiler that can be bootstrapped from Hex
  10. .br
  11. At it's core is the minimal subset of the C language required
  12. to make a more powerful C compiler. (with a few extras for convience)
  13. .br
  14. Those core primitives being: if (with continue), while (with
  15. break), asm, structs (with -> support) gotos (with labels) and return.
  16. With do and for loops, arrays, function pointers and simple macro support
  17. as nice extras
  18. .br
  19. The supported ARCHITECTURES are as follows: knight-native,
  20. knight-posix, x86, amd64, armv7l, aarch64 and riscv64.
  21. Unofficially all tested armv7l binaries have also worked on armv6l
  22. hosts that have thus far been tested but no promise of compatibility
  23. until someone is willing to put in the work.
  24. (with planned ports to z80 and 6502)
  25. If you fail to specify an architecture, the default of knight-native
  26. will be used.
  27. The option --bootstrap-mode exists purely for testing C code for cc_*
  28. compatibility
  29. .br
  30. The minimal libc required to work with M2-Planet generated output is
  31. literally only a half-dozen lines of assembly and to simplify use
  32. M2libc (https://github.com/oriansj/M2libc.git) was created with the
  33. goal of providing commonly desired C library functionality.
  34. with architecture specific elf-headers and functions in the
  35. directories matching the architecture name.
  36. .br
  37. .SH EXAMPLES
  38. Typically, M2-Planet will be called in scripts used in bootstrapping
  39. .br
  40. # M2-Planet --architecture x86 -f return.c -o return.M1
  41. .br
  42. Then to convert the assembled output into a working binary,
  43. M1 and hex2 are used to convert the assembly output of M2-Planet;
  44. with blood-elf generating dwarf stubs if additional debug info is
  45. desired.
  46. .br
  47. # M1 -f M2libc/x86/x86_defs.M1 -f M2libc/x86/libc-full.M1 \
  48. -f return.M1 --little-endian --architecture x86 -o return.hex2
  49. # hex2 -f M2libc/x86/ELF-x86.hex2 -f return.hex2 --little-endian \
  50. --architecture x86 --base-address 0x8048000 -o example
  51. .br
  52. .SH COMPATIBILITY
  53. M2-Planet is compatible with all Turing complete machines;
  54. even the ones that try to be Turing complete -1
  55. .SH AUTHORS
  56. Jeremiah Orians <Jeremiah@pdp10.guru>
  57. .br
  58. Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  59. .br
  60. deesix <deesix@tuta.io>
  61. .br
  62. Sanne Wouda <sanne.wouda@gmail.com>
  63. .SH COPYRIGHT
  64. Copyright 2016-2021 Jeremiah Orians <Jeremiah@pdp10.guru>
  65. .br
  66. Copyright 2017 Jan Nieuwenhuizen <janneke@gnu.org>
  67. .br
  68. Copyright 2020-2021 deesix <deesix@tuta.io>
  69. .br
  70. Copyright 2020-2021 Sanne Wouda <sanne.wouda@gmail.com>
  71. .br
  72. License GPLv3+.
  73. .SH "SEE ALSO"
  74. M1(1), hex2(1), blood-elf(1), kaem(1), syscalls(2)