cpuelf.pas 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {
  2. Copyright (c) 1998-2006 by Peter Vreman
  3. Includes ELF-related code specific to SPARC
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit cpuelf;
  18. {$i fpcdefs.inc}
  19. interface
  20. implementation
  21. uses
  22. verbose,elfbase,
  23. systems,ogbase,ogelf,assemble;
  24. const
  25. { Relocation types }
  26. R_SPARC_NONE = 0;
  27. R_SPARC_8 = 1;
  28. R_SPARC_16 = 2;
  29. R_SPARC_32 = 3;
  30. R_SPARC_DISP8 = 4;
  31. R_SPARC_DISP16 = 5;
  32. R_SPARC_DISP32 = 6;
  33. R_SPARC_WDISP30 = 7;
  34. R_SPARC_WDISP22 = 8;
  35. R_SPARC_HI22 = 9;
  36. R_SPARC_22 = 10;
  37. R_SPARC_13 = 11;
  38. R_SPARC_LO10 = 12;
  39. R_SPARC_GOT10 = 13;
  40. R_SPARC_GOT13 = 14;
  41. R_SPARC_GOT22 = 15;
  42. R_SPARC_PC10 = 16;
  43. R_SPARC_PC22 = 17;
  44. R_SPARC_WPLT30 = 18;
  45. R_SPARC_COPY = 19;
  46. R_SPARC_GLOB_DAT = 20;
  47. R_SPARC_JMP_SLOT = 21;
  48. R_SPARC_RELATIVE = 22;
  49. R_SPARC_UA32 = 23;
  50. R_SPARC_GNU_VTINHERIT = 250;
  51. R_SPARC_GNU_VTENTRY = 251;
  52. {****************************************************************************
  53. ELF Target methods
  54. ****************************************************************************}
  55. function elf_sparc_encodereloc(objrel:TObjRelocation):byte;
  56. begin
  57. case objrel.typ of
  58. RELOC_NONE :
  59. result:=R_SPARC_NONE;
  60. RELOC_ABSOLUTE :
  61. result:=R_SPARC_32;
  62. { TODO }
  63. else
  64. result:=0;
  65. InternalError(2012082303);
  66. end;
  67. end;
  68. function elf_sparc_relocname(reltyp:byte):string;
  69. begin
  70. result:='TODO';
  71. end;
  72. procedure elf_sparc.loadreloc(objrel:TObjRelocation);
  73. begin
  74. end;
  75. {*****************************************************************************
  76. Initialize
  77. *****************************************************************************}
  78. const
  79. elf_target_sparc: TElfTarget =
  80. (
  81. max_page_size: $8000; // fixme
  82. exe_image_base: $8000; // fixme
  83. machine_code: EM_SPARC;
  84. relocs_use_addend: false;
  85. dyn_reloc_codes: (
  86. R_SPARC_RELATIVE,
  87. R_SPARC_GLOB_DAT,
  88. R_SPARC_JUMP_SLOT,
  89. R_SPARC_COPY,
  90. 0 // IRELATIVE is absent(?)
  91. );
  92. relocname: @elf_sparc_relocName;
  93. encodereloc: @elf_sparc_encodeReloc;
  94. loadreloc: @elf_sparc_loadReloc;
  95. loadsection: nil;
  96. encodeflags: nil;
  97. );
  98. as_sparc_elf32_info : tasminfo =
  99. (
  100. id : as_sparc_elf32;
  101. idtxt : 'ELF';
  102. asmbin : '';
  103. asmcmd : '';
  104. supported_targets : [system_sparc_linux, system_sparc_solaris,
  105. system_sparc_embedded];
  106. // flags : [af_outputbinary,af_smartlink_sections];
  107. flags : [af_outputbinary,af_supports_dwarf];
  108. labelprefix : '.L';
  109. comment : '';
  110. dollarsign: '$';
  111. );
  112. initialization
  113. RegisterAssembler(as_sparc_elf32_info,TElfAssembler);
  114. ElfTarget:=elf_target_sparc;
  115. end.