/src/core/sys/osx/mach/loader.d

http://github.com/AlexeyProkhin/druntime · D · 97 lines · 77 code · 9 blank · 11 comment · 0 complexity · 51250111ec49b410a0567d632487142d MD5 · raw file

  1. /**
  2. * Copyright: Copyright Digital Mars 2010.
  3. * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
  4. * Authors: Jacob Carlborg
  5. * Version: Initial created: Feb 20, 2010
  6. */
  7. /* Copyright Digital Mars 2010.
  8. * Distributed under the Boost Software License, Version 1.0.
  9. * (See accompanying file LICENSE or copy at
  10. * http://www.boost.org/LICENSE_1_0.txt)
  11. */
  12. module core.sys.osx.mach.loader;
  13. version (OSX):
  14. extern (C):
  15. struct mach_header
  16. {
  17. uint magic;
  18. int cputype;
  19. int cpusubtype;
  20. uint filetype;
  21. uint ncmds;
  22. uint sizeofcmds;
  23. uint flags;
  24. }
  25. struct mach_header_64
  26. {
  27. uint magic;
  28. int cputype;
  29. int cpusubtype;
  30. uint filetype;
  31. uint ncmds;
  32. uint sizeofcmds;
  33. uint flags;
  34. uint reserved;
  35. }
  36. enum uint MH_MAGIC = 0xfeedface;
  37. enum uint MH_CIGAM = 0xcefaedfe;
  38. enum uint MH_MAGIC_64 = 0xfeedfacf;
  39. enum uint MH_CIGAM_64 = 0xcffaedfe;
  40. enum SEG_PAGEZERO = "__PAGEZERO";
  41. enum SEG_TEXT = "__TEXT";
  42. enum SECT_TEXT = "__text";
  43. enum SECT_FVMLIB_INIT0 = "__fvmlib_init0";
  44. enum SECT_FVMLIB_INIT1 = "__fvmlib_init1";
  45. enum SEG_DATA = "__DATA";
  46. enum SECT_DATA = "__data";
  47. enum SECT_BSS = "__bss";
  48. enum SECT_COMMON = "__common";
  49. enum SEG_OBJC = "__OBJC";
  50. enum SECT_OBJC_SYMBOLS = "__symbol_table";
  51. enum SECT_OBJC_MODULES = "__module_info";
  52. enum SECT_OBJC_STRINGS = "__selector_strs";
  53. enum SECT_OBJC_REFS = "__selector_refs";
  54. enum SEG_ICON = "__ICON";
  55. enum SECT_ICON_HEADER = "__header";
  56. enum SECT_ICON_TIFF = "__tiff";
  57. enum SEG_LINKEDIT = "__LINKEDIT";
  58. enum SEG_UNIXSTACK = "__UNIXSTACK";
  59. enum SEG_IMPORT = "__IMPORT";
  60. struct section
  61. {
  62. char[16] sectname;
  63. char[16] segname;
  64. uint addr;
  65. uint size;
  66. uint offset;
  67. uint align_;
  68. uint reloff;
  69. uint nreloc;
  70. uint flags;
  71. uint reserved1;
  72. uint reserved2;
  73. }
  74. struct section_64
  75. {
  76. char[16] sectname;
  77. char[16] segname;
  78. ulong addr;
  79. ulong size;
  80. uint offset;
  81. uint align_;
  82. uint reloff;
  83. uint nreloc;
  84. uint flags;
  85. uint reserved1;
  86. uint reserved2;
  87. uint reserved3;
  88. }