cpuelf.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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,
  23. systems,ogbase,ogelf,assemble;
  24. type
  25. TElfTargetSparc=class(TElfTarget)
  26. class function encodereloc(objrel:TObjRelocation):byte;override;
  27. class procedure loadreloc(objrel:TObjRelocation);override;
  28. end;
  29. const
  30. { Relocation types }
  31. R_SPARC_NONE = 0;
  32. R_SPARC_8 = 1;
  33. R_SPARC_16 = 2;
  34. R_SPARC_32 = 3;
  35. R_SPARC_DISP8 = 4;
  36. R_SPARC_DISP16 = 5;
  37. R_SPARC_DISP32 = 6;
  38. R_SPARC_WDISP30 = 7;
  39. R_SPARC_WDISP22 = 8;
  40. R_SPARC_HI22 = 9;
  41. R_SPARC_22 = 10;
  42. R_SPARC_13 = 11;
  43. R_SPARC_LO10 = 12;
  44. R_SPARC_GOT10 = 13;
  45. R_SPARC_GOT13 = 14;
  46. R_SPARC_GOT22 = 15;
  47. R_SPARC_PC10 = 16;
  48. R_SPARC_PC22 = 17;
  49. R_SPARC_WPLT30 = 18;
  50. R_SPARC_COPY = 19;
  51. R_SPARC_GLOB_DAT = 20;
  52. R_SPARC_JMP_SLOT = 21;
  53. R_SPARC_RELATIVE = 22;
  54. R_SPARC_UA32 = 23;
  55. R_SPARC_GNU_VTINHERIT = 250;
  56. R_SPARC_GNU_VTENTRY = 251;
  57. {****************************************************************************
  58. TElfTargetSparc
  59. ****************************************************************************}
  60. class function TElfTargetSparc.encodereloc(objrel:TObjRelocation):byte;
  61. begin
  62. case objrel.typ of
  63. RELOC_NONE :
  64. result:=R_SPARC_NONE;
  65. RELOC_ABSOLUTE :
  66. result:=R_SPARC_32;
  67. { TODO }
  68. else
  69. result:=0;
  70. InternalError(2012082303);
  71. end;
  72. end;
  73. class procedure TElfTargetSparc.loadreloc(objrel:TObjRelocation);
  74. begin
  75. end;
  76. {*****************************************************************************
  77. Initialize
  78. *****************************************************************************}
  79. const
  80. as_sparc_elf32_info : tasminfo =
  81. (
  82. id : as_sparc_elf32;
  83. idtxt : 'ELF';
  84. asmbin : '';
  85. asmcmd : '';
  86. supported_targets : [system_sparc_linux, system_sparc_solaris,
  87. system_sparc_embedded];
  88. // flags : [af_outputbinary,af_smartlink_sections];
  89. flags : [af_outputbinary,af_supports_dwarf];
  90. labelprefix : '.L';
  91. comment : '';
  92. dollarsign: '$';
  93. );
  94. initialization
  95. RegisterAssembler(as_sparc_elf32_info,TElfAssembler);
  96. ElfTarget:=TElfTargetSparc;
  97. end.