cpuelf.pas 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. TElfObjOutputSparc=class(TElfObjectOutput)
  26. function encodereloc(objrel:TObjRelocation):byte;override;
  27. end;
  28. TElfAssemblerSparc=class(TInternalAssembler)
  29. constructor create(smart:boolean);override;
  30. end;
  31. const
  32. { Relocation types }
  33. R_SPARC_32 = 3;
  34. R_SPARC_WDISP30 = 7;
  35. R_SPARC_HI22 = 9;
  36. R_SPARC_LO10 = 12;
  37. R_SPARC_GNU_VTINHERIT = 250;
  38. R_SPARC_GNU_VTENTRY = 251;
  39. {****************************************************************************
  40. TElfObjOutputSparc
  41. ****************************************************************************}
  42. function TElfObjOutputSparc.encodereloc(objrel:TObjRelocation):byte;
  43. begin
  44. case objrel.typ of
  45. RELOC_ABSOLUTE :
  46. result:=R_SPARC_32;
  47. { TODO }
  48. else
  49. result:=0;
  50. InternalError(2012082303);
  51. end;
  52. end;
  53. {****************************************************************************
  54. TElfAssemblerSparc
  55. ****************************************************************************}
  56. constructor TElfAssemblerSparc.create(smart:boolean);
  57. begin
  58. inherited Create(smart);
  59. CObjOutput:=TElfObjOutputSparc;
  60. end;
  61. {*****************************************************************************
  62. Initialize
  63. *****************************************************************************}
  64. const
  65. as_sparc_elf32_info : tasminfo =
  66. (
  67. id : as_sparc_elf32;
  68. idtxt : 'ELF';
  69. asmbin : '';
  70. asmcmd : '';
  71. supported_targets : [system_sparc_linux, system_sparc_solaris,
  72. system_sparc_embedded];
  73. // flags : [af_outputbinary,af_smartlink_sections];
  74. flags : [af_outputbinary,af_supports_dwarf];
  75. labelprefix : '.L';
  76. comment : '';
  77. dollarsign: '$';
  78. );
  79. initialization
  80. RegisterAssembler(as_sparc_elf32_info,TElfAssemblerSparc);
  81. end.